From 2deb379c0648e270f01c80e1da3594ada00937f6 Mon Sep 17 00:00:00 2001 From: steve Date: Sat, 18 Mar 2000 23:22:37 +0000 Subject: [PATCH] Update the FF device to nexus style. --- t-vvm.cc | 223 +++++++++--------------------------------------- vvm/Makefile.in | 4 +- vvm/vvm_ff.cc | 103 ++++++++++++++++++++++ vvm/vvm_gates.h | 60 ++++++------- 4 files changed, 168 insertions(+), 222 deletions(-) create mode 100644 vvm/vvm_ff.cc diff --git a/t-vvm.cc b/t-vvm.cc index 3458441cb..404b379be 100644 --- a/t-vvm.cc +++ b/t-vvm.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-vvm.cc,v 1.117 2000/03/18 02:26:02 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.118 2000/03/18 23:22:37 steve Exp $" #endif # include @@ -119,9 +119,6 @@ class target_vvm : public target_t { char*defn_name; ofstream defn; - char*delayed_name; - ofstream delayed; - char*init_code_name; ofstream init_code; @@ -150,7 +147,7 @@ class target_vvm : public target_t { target_vvm::target_vvm() -: function_def_flag_(false), delayed_name(0), init_code_name(0) +: function_def_flag_(false), init_code_name(0) { } @@ -650,9 +647,6 @@ void target_vvm::start_design(ostream&os, const Design*mod) defn_name = tempnam(0, "ivldf"); defn.open(defn_name, ios::in | ios::out | ios::trunc); - delayed_name = tempnam(0, "ivlde"); - delayed.open(delayed_name, ios::in | ios::out | ios::trunc); - init_code_name = tempnam(0, "ivlic"); init_code.open(init_code_name, ios::in | ios::out | ios::trunc); @@ -730,16 +724,6 @@ void target_vvm::end_design(ostream&os, const Design*mod) defn_name = 0; os << "// **** end definition code" << endl; - delayed.close(); - os << "// **** Delayed code" << endl; - { ifstream rdelayed (delayed_name); - os << rdelayed.rdbuf(); - } - unlink(delayed_name); - free(delayed_name); - delayed_name = 0; - os << "// **** end delayed code" << endl; - os << "// **** init_code" << endl; init_code << "}" << endl; @@ -928,15 +912,8 @@ string target_vvm::defn_gate_outputfun_(ostream&os, const NetNode*gate, unsigned gpin) { - const NetObj::Link&lnk = gate->pin(gpin); - - ostrstream tmp; - tmp << mangle(gate->name()) << "_output_" << lnk.get_name() << - "_" << lnk.get_inst() << ends; - string name = tmp.str(); - - os << "static void " << name << "(vpip_bit_t);" << endl; - return name; + assert(0); + return ""; } void target_vvm::emit_init_value_(const NetObj::Link&lnk, verinum::V val) @@ -980,41 +957,7 @@ void target_vvm::emit_init_value_(const NetObj::Link&lnk, verinum::V val) */ void target_vvm::emit_gate_outputfun_(const NetNode*gate, unsigned gpin) { - const NetObj::Link&lnk = gate->pin(gpin); - - delayed << "static void " << mangle(gate->name()) << - "_output_" << lnk.get_name() << "_" << lnk.get_inst() << - "(vpip_bit_t val)" << - endl << "{" << endl; - - /* The output function connects to gpin of the netlist part - and causes the inputs that it is connected to to be set - with the new value. */ - - const NetObj*cur; - unsigned pin; - gate->pin(gpin).next_link(cur, pin); - for ( ; cur != gate ; cur->pin(pin).next_link(cur, pin)) { - - // Skip pins that are output only. - if (cur->pin(pin).get_dir() == NetObj::Link::OUTPUT) - continue; - - if (cur->pin(pin).get_name() != "") { - - delayed << " " << mangle(cur->name()) << ".set_" - << cur->pin(pin).get_name() << "(" << - cur->pin(pin).get_inst() << ", val);" << endl; - - } else { - - delayed << " " << mangle(cur->name()) << ".set(" - << pin << ", val);" << endl; - } - - } - - delayed << "}" << endl; + assert(0); } void target_vvm::lpm_add_sub(ostream&os, const NetAddSub*gate) @@ -1179,16 +1122,40 @@ void target_vvm::lpm_compare(ostream&os, const NetCompare*gate) void target_vvm::lpm_ff(ostream&os, const NetFF*gate) { + string nexus; + unsigned ncode; string mname = mangle(gate->name()); - os << "static vvm_ff<" << gate->width() << "> " << mname << ";" - << endl; + + os << "static vvm_ff " << mname << "(" << gate->width() << ");" << endl; + + /* Connect the clock input... */ + + nexus = nexus_from_link(&gate->pin_Clock()); + ncode = nexus_wire_map[nexus]; + + init_code << " nexus_wire_table["<width() ; idx += 1) { - unsigned pin = gate->pin_Q(idx).get_pin(); - string outfun = defn_gate_outputfun_(os, gate, pin); - init_code << " " << mangle(gate->name()) << - ".config_rout(" << idx << ", &" << outfun << ");" << endl; - emit_gate_outputfun_(gate, pin); + nexus = nexus_from_link(&gate->pin_Q(idx)); + ncode = nexus_wire_map[nexus]; + + init_code << " nexus_wire_table["<width() ; idx += 1) { + nexus = nexus_from_link(&gate->pin_Data(idx)); + ncode = nexus_wire_map[nexus]; + + init_code << " nexus_wire_table["< class vvm_ff { +class vvm_ff : public vvm_nexus::recvr_t { public: - explicit vvm_ff() - { clk_ = Vx; - for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) - q_[idx] = Vx; - } - ~vvm_ff() { } + explicit vvm_ff(unsigned wid); + ~vvm_ff(); - void init_Data(unsigned idx, vpip_bit_t val) { d_[idx] = val; } - void init_Clock(unsigned, vpip_bit_t val) { clk_ = val; } + vvm_nexus::drive_t* config_rout(unsigned idx); - void set_Clock(unsigned, vpip_bit_t val) - { if (val == clk_) return; - bool flag = posedge(clk_, val); - clk_ = val; - if (flag) latch_(); - } + unsigned key_Data(unsigned idx) const; + unsigned key_Clock() const; - void set_Data(unsigned idx, vpip_bit_t val) - { d_[idx] = val; - } - - void config_rout(unsigned idx, vvm_out_event::action_t o) - { out_[idx] = o; - } + void init_Data(unsigned idx, vpip_bit_t val); + void init_Clock(unsigned, vpip_bit_t val); private: - vpip_bit_t d_[WIDTH]; - vpip_bit_t q_[WIDTH]; + void take_value(unsigned key, vpip_bit_t val); + unsigned width_; + vpip_bit_t*bits_; vpip_bit_t clk_; - vvm_out_event::action_t out_[WIDTH]; + vvm_nexus::drive_t* out_; - void latch_() - { q_ = d_; - for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) - if (out_[idx]) { - vvm_event*ev = new vvm_out_event(q_[idx], out_[idx]); - ev->schedule(); - } - } + void latch_(); + + private: // not implemeneted + vvm_ff(const vvm_ff&); + vvm_ff& operator= (const vvm_ff&); }; /* @@ -817,6 +802,9 @@ template class vvm_pevent : public vvm_nexus::recvr_t { /* * $Log: vvm_gates.h,v $ + * Revision 1.48 2000/03/18 23:22:37 steve + * Update the FF device to nexus style. + * * Revision 1.47 2000/03/18 02:26:02 steve * Update bufz to nexus style. *