+2003-10-07 Dave Brolley <brolley@redhat.com>
+
+ * cgen-model.h (class cgen_model): step_cycles and step_latency
+ now public.
+
+2003-10-07 Dave Brolley <brolley@redhat.com>
+
+ * cgen-model.h (sidtypes.h): #include it.
+ (model_insn_before): Call step_latency. Initialize vliw_cycles.
+ (model_insn_after): Call step_cycles. Update vliw_cycles.
+ (step_cycles): New method.
+ (step_latency): New method.
+ (vliw_cycles): New member of cgen_model.
+ * cgen-engine.h (enum sem_status): Add SEM_STATUS_STALLED.
+
2003-09-08 Doug Evans <dje@casey.transmeta.com>
* CGEN.sh.h: New arg arch-file.
// cgen-engine.h - CGEN engine support. -*- C++ -*-
-// Copyright (C) 1999, 2000 Red Hat.
+// Copyright (C) 1999, 2000, 2003 Red Hat.
// This file is part of SID and is licensed under the GPL.
// See the file COPYING.SID for conditions for redistribution.
{
SEM_STATUS_NORMAL,
SEM_STATUS_BRANCH_TAKEN,
- SEM_STATUS_DELAYED_BRANCH_TAKEN
+ SEM_STATUS_DELAYED_BRANCH_TAKEN,
+ SEM_STATUS_STALLED
};
// Exceptions used to exit the cpu's "main loop".
#ifndef CGEN_MODEL_H
#define CGEN_MODEL_H
+#include <sidtypes.h>
#include "cgen-cpu.h"
namespace cgen
// 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) {}
+ virtual void model_insn_before (bool first_p = true)
+ {
+ if (first_p)
+ {
+ // There may be latency from insn fetch.
+ step_latency ();
+ this->vliw_cycles = 1;
+ }
+ }
// 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)
+ // Accumulate the max cycles used by any one vliw insn.
+ if (cycles > this->vliw_cycles)
+ this->vliw_cycles = cycles;
+
+ // Account for the latency of this group of insns.
+ if (last_p)
+ step_cycles (vliw_cycles);
+ }
+
+ // To be overridden as needed. Update any state associated with an
+ // insn using the given number of cycles.
+ virtual void step_cycles (sid::host_int_4 cycles)
+ {
+ if (cycles > 0)
+ {
+ // The cpu counts cycles as number of insns + total latency.
cpu->update_total_latency (cycles - 1);
+ step_latency (1);
}
+ }
+
+ // To be overridden as needed. Update any state associated with an
+ // insn having latency. Insn latency is tracked using the cpu's
+ // get_total_latency () method.
+ virtual void step_latency (sid::host_int_4 = 0) {}
protected:
cgen_bi_endian_cpu *cpu;
+ sid::host_int_4 vliw_cycles;
};
} // namespace cgen