# defs.h - generate defs.h file (cpu-family specific decls)
# decode.h - generate decoder header file
# decode.cxx - generate decoder
+# model.h - generate model header file
+# model.cxx - generate model
# semantics.cxx - generate semantics
# sem-switch.cxx - generate semantics, pbb switch version
#
defs.h) fileopts="$fileopts -E tmp-defs-$$.h1" ;;
decode.h) fileopts="$fileopts -T tmp-dec-$$.h1" ;;
decode.cxx) fileopts="$fileopts -D tmp-dec-$$.cxx1" ;;
+ model.h) fileopts="$fileopts -N tmp-mod-$$.h1" ;;
+ model.cxx) fileopts="$fileopts -M tmp-mod-$$.cxx1" ;;
semantics.cxx) fileopts="$fileopts -S tmp-sem-$$.cxx1" ;;
sem-switch.cxx) fileopts="$fileopts -X tmp-semsw-$$.cxx1" ;;
write.cxx) fileopts="$fileopts -W tmp-write-$$.cxx1" ;;
< tmp-dec-$$.cxx1 > tmp-dec-$$.cxx
${rootdir}/move-if-change tmp-dec-$$.cxx ${srcdir}/${fileprefix}decode.cxx
;;
+ model.h)
+ sed -e "s=@ARCH@=${ARCH}=g" -e "s=@arch@=${arch}=g" \
+ -e "s=@CPU@=${CPU}=g" -e "s=@cpu@=${cpu}=g" \
+ -e "s=@PREFIX@=${PREFIX}=g" -e "s=@"prefix"@=${prefix}=g" \
+ < tmp-mod-$$.h1 > tmp-mod-$$.h
+ ${rootdir}/move-if-change tmp-mod-$$.h ${srcdir}/${fileprefix}model.h
+ ;;
+ model.cxx)
+ sed -e "s=@ARCH@=${ARCH}=g" -e "s=@arch@=${arch}=g" \
+ -e "s=@CPU@=${CPU}=g" -e "s=@cpu@=${cpu}=g" \
+ -e "s=@PREFIX@=${PREFIX}=g" -e "s=@"prefix"@=${prefix}=g" \
+ < tmp-mod-$$.cxx1 > tmp-mod-$$.cxx
+ ${rootdir}/move-if-change tmp-mod-$$.cxx ${srcdir}/${fileprefix}model.cxx
+ ;;
semantics.cxx)
sed -e "s=@ARCH@=${ARCH}=g" -e "s=@arch@=${arch}=g" \
-e "s=@CPU@=${CPU}=g" -e "s=@cpu@=${cpu}=g" \
rm -f tmp-write-$$.cxx1 tmp-write-$$.cxx
rm -f tmp-dec-$$.h1 tmp-dec-$$.h
rm -f tmp-dec-$$.cxx1 tmp-dec-$$.cxx
+rm -f tmp-mod-$$.h1 tmp-mod-$$.h
+rm -f tmp-mod-$$.cxx1 tmp-mod-$$.cxx
exit 0
--- /dev/null
+// cgen-model.h -*- C++ -*-
+
+// Copyright (C) 2003 Red Hat.
+// This file is part of SID and is licensed under the GPL.
+// See the file COPYING.SID for conditions for redistribution.
+
+#ifndef CGEN_MODEL_H
+#define CGEN_MODEL_H
+
+#include "cgen-cpu.h"
+
+namespace cgen
+{
+
+class cgen_model
+{
+public:
+ cgen_model (cgen_bi_endian_cpu *c) : cpu (c) {}
+
+ // To be overridden as needed. Call before each insn is executed. first_p is
+ // true when the insn is the first of a group of parallel insns.
+ virtual void model_insn_before (bool first_p = true) {}
+
+ // To be overridden as needed. Call after each insn is executed. last_p is
+ // true when the insn is the first of a group of parallel insns. cycles is the
+ // number of cycles used by each particular insn.
+ virtual void model_insn_after (bool last_p = true, sid::host_int_4 cycles = 1)
+ {
+ if (last_p && cycles > 0)
+ cpu->update_total_latency (cycles - 1);
+ }
+
+protected:
+ cgen_bi_endian_cpu *cpu;
+};
+
+} // namespace cgen
+
+#endif /* CGEN_MODEL_H */