More UDP consolidation from Stephan Boettcher.
This commit is contained in:
parent
57b0d9691e
commit
66cf3ec8fa
8
PGate.h
8
PGate.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: PGate.h,v 1.18 2000/05/06 15:41:56 steve Exp $"
|
||||
#ident "$Id: PGate.h,v 1.19 2001/04/22 23:09:45 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "svector.h"
|
||||
|
|
@ -211,14 +211,16 @@ class PGModule : public PGate {
|
|||
PExpr*lsb_;
|
||||
|
||||
void elaborate_mod_(Design*, Module*mod, const string&path) const;
|
||||
void elaborate_sudp_(Design*, PUdp *udp, const string&path) const;
|
||||
void elaborate_cudp_(Design*, PUdp *udp, const string&path) const;
|
||||
void elaborate_udp_(Design*, PUdp *udp, const string&path) const;
|
||||
void elaborate_scope_mod_(Design*des, Module*mod, NetScope*sc) const;
|
||||
bool elaborate_sig_mod_(Design*des, NetScope*scope, Module*mod) const;
|
||||
};
|
||||
|
||||
/*
|
||||
* $Log: PGate.h,v $
|
||||
* Revision 1.19 2001/04/22 23:09:45 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.18 2000/05/06 15:41:56 steve
|
||||
* Carry assignment strength to pform.
|
||||
*
|
||||
|
|
|
|||
7
PUdp.h
7
PUdp.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: PUdp.h,v 1.4 2000/02/23 02:56:53 steve Exp $"
|
||||
#ident "$Id: PUdp.h,v 1.5 2001/04/22 23:09:45 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <map>
|
||||
|
|
@ -72,8 +72,8 @@ class PUdp {
|
|||
|
||||
void dump(ostream&out) const;
|
||||
|
||||
private:
|
||||
const string name_;
|
||||
private:
|
||||
|
||||
private: // Not implemented
|
||||
PUdp(const PUdp&);
|
||||
|
|
@ -82,6 +82,9 @@ class PUdp {
|
|||
|
||||
/*
|
||||
* $Log: PUdp.h,v $
|
||||
* Revision 1.5 2001/04/22 23:09:45 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.4 2000/02/23 02:56:53 steve
|
||||
* Macintosh compilers do not support ident.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: design_dump.cc,v 1.111 2001/02/17 05:13:36 steve Exp $"
|
||||
#ident "$Id: design_dump.cc,v 1.112 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -367,77 +367,12 @@ void NetTaskDef::dump(ostream&o, unsigned ind) const
|
|||
o << setw(ind) << "" << "endtask" << endl;
|
||||
}
|
||||
|
||||
void NetUDP::dump_sequ_(ostream&o, unsigned ind) const
|
||||
{
|
||||
string tmp = "";
|
||||
for (unsigned idx = 0 ; idx < ind ; idx += 1)
|
||||
tmp += " ";
|
||||
|
||||
o << tmp << "Sequential UDP" << " #(" << rise_time() <<
|
||||
"," << fall_time() << "," << decay_time() << ") " << name() <<
|
||||
endl;
|
||||
|
||||
for (FSM_::const_iterator ent = fsm_.begin()
|
||||
; ent != fsm_.end() ; ent++) {
|
||||
o << setw(ind+6) << "" << (*ent).first << " -->";
|
||||
|
||||
state_t_*st = (*ent).second;
|
||||
assert((*ent).first[0] == st->out);
|
||||
for (unsigned idx = 1 ; idx < pin_count() ; idx += 1) {
|
||||
string tmp = (*ent).first;
|
||||
if (st->pins[idx].zer) {
|
||||
tmp[0] = st->pins[idx].zer->out;
|
||||
tmp[idx] = '0';
|
||||
o << " " << tmp;
|
||||
}
|
||||
|
||||
if (st->pins[idx].one) {
|
||||
tmp[0] = st->pins[idx].one->out;
|
||||
tmp[idx] = '1';
|
||||
o << " " << tmp;
|
||||
}
|
||||
|
||||
if (st->pins[idx].xxx) {
|
||||
tmp[0] = st->pins[idx].xxx->out;
|
||||
tmp[idx] = 'x';
|
||||
o << " " << tmp;
|
||||
}
|
||||
}
|
||||
|
||||
o << endl;
|
||||
}
|
||||
|
||||
o << setw(ind+6) << "" << "initial value == " << init_ << endl;
|
||||
|
||||
dump_node_pins(o, ind+4);
|
||||
dump_obj_attr(o, ind+4);
|
||||
}
|
||||
|
||||
void NetUDP::dump_comb_(ostream&o, unsigned ind) const
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
void NetUDP::dump_node(ostream&o, unsigned ind) const
|
||||
{
|
||||
if (is_sequential())
|
||||
dump_sequ_(o, ind);
|
||||
else
|
||||
dump_comb_(o, ind);
|
||||
}
|
||||
|
||||
void NetUDP_COMB::dump_node(ostream&o, unsigned ind) const
|
||||
{
|
||||
o << setw(ind) << "" << "Combinational primitive: ";
|
||||
o << setw(ind) << "" << "UDP (" << udp_name() << "): ";
|
||||
o << " #(" << rise_time() << "," << fall_time() << "," << decay_time() <<
|
||||
") " << name() << endl;
|
||||
|
||||
for (map<string,char>::const_iterator ent = cm_.begin()
|
||||
; ent != cm_.end() ; ent++) {
|
||||
o << setw(ind+6) << "" << (*ent).first << " --> " <<
|
||||
(*ent).second << endl;
|
||||
}
|
||||
|
||||
dump_node_pins(o, ind+4);
|
||||
dump_obj_attr(o, ind+4);
|
||||
}
|
||||
|
|
@ -1001,6 +936,9 @@ void Design::dump(ostream&o) const
|
|||
|
||||
/*
|
||||
* $Log: design_dump.cc,v $
|
||||
* Revision 1.112 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.111 2001/02/17 05:13:36 steve
|
||||
* Check that the port really exists here.
|
||||
*
|
||||
|
|
|
|||
84
elaborate.cc
84
elaborate.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: elaborate.cc,v 1.209 2001/04/02 02:28:12 steve Exp $"
|
||||
#ident "$Id: elaborate.cc,v 1.210 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -604,60 +604,16 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const
|
|||
}
|
||||
}
|
||||
|
||||
void PGModule::elaborate_cudp_(Design*des, PUdp*udp, const string&path) const
|
||||
{
|
||||
const string my_name = path+"."+get_name();
|
||||
NetUDP_COMB*net = new NetUDP_COMB(my_name, udp->ports.count());
|
||||
net->set_attributes(udp->attributes);
|
||||
|
||||
/* Run through the pins, making netlists for the pin
|
||||
expressions and connecting them to the pin in question. All
|
||||
of this is independent of the nature of the UDP. */
|
||||
for (unsigned idx = 0 ; idx < net->pin_count() ; idx += 1) {
|
||||
if (pin(idx) == 0)
|
||||
continue;
|
||||
|
||||
NetNet*sig = pin(idx)->elaborate_net(des, path, 1, 0, 0, 0);
|
||||
if (sig == 0) {
|
||||
cerr << "internal error: Expression too complicated "
|
||||
"for elaboration:" << *pin(idx) << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
connect(sig->pin(0), net->pin(idx));
|
||||
|
||||
// Delete excess holding signal.
|
||||
if (NetTmp*tmp = dynamic_cast<NetTmp*>(sig))
|
||||
delete tmp;
|
||||
}
|
||||
|
||||
/* Build up the truth table for the netlist from the input
|
||||
strings. */
|
||||
for (unsigned idx = 0 ; idx < udp->tinput.count() ; idx += 1) {
|
||||
string input = udp->tinput[idx];
|
||||
|
||||
bool flag = net->set_table(input, udp->toutput[idx]);
|
||||
if (flag == false) {
|
||||
cerr << get_line()<<": error: invalid table format." << endl;
|
||||
des->errors += 1;
|
||||
}
|
||||
}
|
||||
|
||||
net->cleanup_table();
|
||||
|
||||
// All done. Add the object to the design.
|
||||
des->add_node(net);
|
||||
}
|
||||
|
||||
/*
|
||||
* From a UDP definition in the source, make a NetUDP
|
||||
* object. Elaborate the pin expressions as netlists, then connect
|
||||
* those networks to the pins.
|
||||
*/
|
||||
void PGModule::elaborate_sudp_(Design*des, PUdp*udp, const string&path) const
|
||||
|
||||
void PGModule::elaborate_udp_(Design*des, PUdp*udp, const string&path) const
|
||||
{
|
||||
const string my_name = path+"."+get_name();
|
||||
NetUDP*net = new NetUDP(my_name, udp->ports.count(), udp->sequential);
|
||||
NetUDP*net = new NetUDP(my_name, udp->ports.count(), udp);
|
||||
net->set_attributes(udp->attributes);
|
||||
|
||||
/* Run through the pins, making netlists for the pin
|
||||
|
|
@ -680,29 +636,7 @@ void PGModule::elaborate_sudp_(Design*des, PUdp*udp, const string&path) const
|
|||
if (NetTmp*tmp = dynamic_cast<NetTmp*>(sig))
|
||||
delete tmp;
|
||||
}
|
||||
|
||||
/* Build up the truth table for the netlist from the input
|
||||
strings. */
|
||||
for (unsigned idx = 0 ; idx < udp->tinput.count() ; idx += 1) {
|
||||
string input = string("") + udp->tcurrent[idx] + udp->tinput[idx];
|
||||
net->set_table(input, udp->toutput[idx]);
|
||||
}
|
||||
|
||||
net->cleanup_table();
|
||||
|
||||
switch (udp->initial) {
|
||||
case verinum::V0:
|
||||
net->set_initial('0');
|
||||
break;
|
||||
case verinum::V1:
|
||||
net->set_initial('1');
|
||||
break;
|
||||
case verinum::Vx:
|
||||
case verinum::Vz:
|
||||
net->set_initial('x');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// All done. Add the object to the design.
|
||||
des->add_node(net);
|
||||
}
|
||||
|
|
@ -731,10 +665,7 @@ void PGModule::elaborate(Design*des, const string&path) const
|
|||
// Try a primitive type
|
||||
map<string,PUdp*>::const_iterator udp = udplist->find(type_);
|
||||
if (udp != udplist->end()) {
|
||||
if ((*udp).second->sequential)
|
||||
elaborate_sudp_(des, (*udp).second, path);
|
||||
else
|
||||
elaborate_cudp_(des, (*udp).second, path);
|
||||
elaborate_udp_(des, (*udp).second, path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2369,6 +2300,9 @@ Design* elaborate(const map<string,Module*>&modules,
|
|||
|
||||
/*
|
||||
* $Log: elaborate.cc,v $
|
||||
* Revision 1.210 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.209 2001/04/02 02:28:12 steve
|
||||
* Generate code for task calls.
|
||||
*
|
||||
|
|
|
|||
11
emit.cc
11
emit.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: emit.cc,v 1.58 2001/04/06 02:28:02 steve Exp $"
|
||||
#ident "$Id: emit.cc,v 1.59 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -41,12 +41,6 @@ bool NetLogic::emit_node(struct target_t*tgt) const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool NetUDP_COMB::emit_node(struct target_t*tgt) const
|
||||
{
|
||||
tgt->udp_comb(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NetUDP::emit_node(struct target_t*tgt) const
|
||||
{
|
||||
tgt->udp(this);
|
||||
|
|
@ -478,6 +472,9 @@ bool emit(const Design*des, const char*type)
|
|||
|
||||
/*
|
||||
* $Log: emit.cc,v $
|
||||
* Revision 1.59 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.58 2001/04/06 02:28:02 steve
|
||||
* Generate vvp code for functions with ports.
|
||||
*
|
||||
|
|
|
|||
23
ivl_target.h
23
ivl_target.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: ivl_target.h,v 1.53 2001/04/21 00:55:46 steve Exp $"
|
||||
#ident "$Id: ivl_target.h,v 1.54 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -135,6 +135,7 @@ typedef struct ivl_lpm_ff_s *ivl_lpm_ff_t;
|
|||
typedef struct ivl_lval_s *ivl_lval_t;
|
||||
typedef struct ivl_net_const_s*ivl_net_const_t;
|
||||
typedef struct ivl_net_logic_s*ivl_net_logic_t;
|
||||
typedef struct ivl_udp_s *ivl_udp_t;
|
||||
typedef struct ivl_net_probe_s*ivl_net_probe_t;
|
||||
typedef struct ivl_nexus_s *ivl_nexus_t;
|
||||
typedef struct ivl_nexus_ptr_s*ivl_nexus_ptr_t;
|
||||
|
|
@ -184,7 +185,9 @@ typedef enum ivl_logic_e {
|
|||
IVL_LO_RPMOS,
|
||||
IVL_LO_PMOS,
|
||||
IVL_LO_XNOR,
|
||||
IVL_LO_XOR
|
||||
IVL_LO_XOR,
|
||||
|
||||
IVL_LO_UDP
|
||||
} ivl_logic_t;
|
||||
|
||||
/* This is the type of an LPM object. */
|
||||
|
|
@ -421,6 +424,19 @@ extern const char* ivl_logic_basename(ivl_net_logic_t net);
|
|||
extern ivl_logic_t ivl_logic_type(ivl_net_logic_t net);
|
||||
extern ivl_nexus_t ivl_logic_pin(ivl_net_logic_t net, unsigned pin);
|
||||
extern unsigned ivl_logic_pins(ivl_net_logic_t net);
|
||||
extern ivl_udp_t ivl_logic_udp(ivl_net_logic_t net);
|
||||
|
||||
/* UDP
|
||||
*
|
||||
*/
|
||||
|
||||
extern unsigned ivl_udp_sequ(ivl_udp_t net);
|
||||
extern unsigned ivl_udp_nin(ivl_udp_t net);
|
||||
extern unsigned ivl_udp_init(ivl_udp_t net);
|
||||
extern const char* ivl_udp_row(ivl_udp_t net, unsigned idx);
|
||||
extern unsigned ivl_udp_rows(ivl_udp_t net);
|
||||
extern const char* ivl_udp_name(ivl_udp_t net);
|
||||
|
||||
|
||||
/* LPM
|
||||
* These functions support access to the properties of LPM devices.
|
||||
|
|
@ -765,6 +781,9 @@ _END_DECL
|
|||
|
||||
/*
|
||||
* $Log: ivl_target.h,v $
|
||||
* Revision 1.54 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.53 2001/04/21 00:55:46 steve
|
||||
* Generate code for disable.
|
||||
*
|
||||
|
|
|
|||
37
mangle.cc
37
mangle.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: mangle.cc,v 1.5 2000/12/11 01:06:24 steve Exp $"
|
||||
#ident "$Id: mangle.cc,v 1.6 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -32,7 +32,7 @@ string mangle(const string&str)
|
|||
string tmp = str;
|
||||
|
||||
while (tmp.length() > 0) {
|
||||
size_t pos = tmp.find_first_of(".<\\[]");
|
||||
size_t pos = tmp.find_first_of(".<\\[]/");
|
||||
if (pos > tmp.length())
|
||||
pos = tmp.length();
|
||||
|
||||
|
|
@ -59,6 +59,10 @@ string mangle(const string&str)
|
|||
res << "$$";
|
||||
tmp = tmp.substr(1);
|
||||
break;
|
||||
case '/':
|
||||
res << "$sl$";
|
||||
tmp = tmp.substr(1);
|
||||
break;
|
||||
case '[':
|
||||
res << "$lb$";
|
||||
tmp = tmp.substr(1);
|
||||
|
|
@ -73,8 +77,37 @@ string mangle(const string&str)
|
|||
return res.str();
|
||||
}
|
||||
|
||||
string stresc(const string&str)
|
||||
{
|
||||
ostrstream res;
|
||||
string tmp = str;
|
||||
|
||||
while (tmp.length() > 0) {
|
||||
size_t pos = tmp.find_first_of("\\");
|
||||
if (pos > tmp.length())
|
||||
pos = tmp.length();
|
||||
|
||||
res << tmp.substr(0, pos);
|
||||
if (pos >= tmp.length())
|
||||
break;
|
||||
|
||||
tmp = tmp.substr(pos);
|
||||
switch (tmp[0]) {
|
||||
case '\\':
|
||||
res << "\\\\";
|
||||
tmp = tmp.substr(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
res << ends;
|
||||
return res.str();
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: mangle.cc,v $
|
||||
* Revision 1.6 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.5 2000/12/11 01:06:24 steve
|
||||
* Mangle [] characters. (PR#67)
|
||||
*
|
||||
|
|
|
|||
202
net_udp.cc
202
net_udp.cc
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2000 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -17,128 +18,13 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: net_udp.cc,v 1.3 2000/12/15 01:24:17 steve Exp $"
|
||||
#ident "$Id: net_udp.cc,v 1.4 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
||||
bool NetUDP::set_table(const string&input, char output)
|
||||
{
|
||||
assert((output == '0') || (output == '1')
|
||||
|| (is_sequential() && (output == '-')));
|
||||
|
||||
cm_[input] = output;
|
||||
|
||||
if (is_sequential()) {
|
||||
assert(input.length() == pin_count());
|
||||
/* XXXX Need to check to make sure that the input vector
|
||||
contains a legal combination of characters. */
|
||||
return sequ_glob_(input, output);
|
||||
|
||||
} else {
|
||||
assert(input.length() == (pin_count()-1));
|
||||
/* XXXX Need to check to make sure that the input vector
|
||||
contains a legal combination of characters. In
|
||||
combinational UDPs, only 0, 1, x, and ? are allowed. */
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void NetUDP::cleanup_table()
|
||||
{
|
||||
for (FSM_::iterator idx = fsm_.begin() ; idx != fsm_.end() ; idx++) {
|
||||
string str = (*idx).first;
|
||||
state_t_*st = (*idx).second;
|
||||
assert(str[0] == st->out);
|
||||
|
||||
for (unsigned pin = 0 ; pin < pin_count() ; pin += 1) {
|
||||
if (st->pins[pin].zer && st->pins[pin].zer->out == 'x')
|
||||
st->pins[pin].zer = 0;
|
||||
if (st->pins[pin].one && st->pins[pin].one->out == 'x')
|
||||
st->pins[pin].one = 0;
|
||||
if (st->pins[pin].xxx && st->pins[pin].xxx->out == 'x')
|
||||
st->pins[pin].xxx = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (FSM_::iterator idx = fsm_.begin() ; idx != fsm_.end() ; ) {
|
||||
FSM_::iterator cur = idx;
|
||||
idx ++;
|
||||
|
||||
state_t_*st = (*cur).second;
|
||||
|
||||
if (st->out != 'x')
|
||||
continue;
|
||||
|
||||
for (unsigned pin = 0 ; pin < pin_count() ; pin += 1) {
|
||||
if (st->pins[pin].zer)
|
||||
goto break_label;
|
||||
if (st->pins[pin].one)
|
||||
goto break_label;
|
||||
if (st->pins[pin].xxx)
|
||||
goto break_label;
|
||||
}
|
||||
|
||||
//delete st;
|
||||
fsm_.erase(cur);
|
||||
|
||||
break_label:;
|
||||
}
|
||||
}
|
||||
|
||||
char NetUDP::table_lookup(const string&from, char to, unsigned pin) const
|
||||
{
|
||||
assert(pin <= pin_count());
|
||||
assert(from.length() == pin_count());
|
||||
FSM_::const_iterator idx = fsm_.find(from);
|
||||
if (idx == fsm_.end())
|
||||
return 'x';
|
||||
|
||||
state_t_*next;
|
||||
switch (to) {
|
||||
case '0':
|
||||
next = (*idx).second->pins[pin].zer;
|
||||
break;
|
||||
case '1':
|
||||
next = (*idx).second->pins[pin].one;
|
||||
break;
|
||||
case 'x':
|
||||
next = (*idx).second->pins[pin].xxx;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
next = 0;
|
||||
}
|
||||
|
||||
return next? next->out : 'x';
|
||||
}
|
||||
|
||||
void NetUDP::set_initial(char val)
|
||||
{
|
||||
assert(is_sequential());
|
||||
assert((val == '0') || (val == '1') || (val == 'x'));
|
||||
init_ = val;
|
||||
}
|
||||
|
||||
NetUDP::state_t_* NetUDP::find_state_(const string&str)
|
||||
{
|
||||
map<string,state_t_*>::iterator cur = fsm_.find(str);
|
||||
if (cur != fsm_.end())
|
||||
return (*cur).second;
|
||||
|
||||
state_t_*st = fsm_[str];
|
||||
if (st == 0) {
|
||||
st = new state_t_(pin_count());
|
||||
st->out = str[0];
|
||||
fsm_[str] = st;
|
||||
}
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
NetUDP_COMB::NetUDP_COMB(const string&n, unsigned pins, bool sequ)
|
||||
: NetNode(n, pins), sequential_(sequ)
|
||||
NetUDP::NetUDP(const string&n, unsigned pins, PUdp *u)
|
||||
: NetNode(n, pins), udp(u)
|
||||
{
|
||||
pin(0).set_dir(Link::OUTPUT);
|
||||
pin(0).set_name("O", 0);
|
||||
|
|
@ -148,52 +34,64 @@ NetUDP_COMB::NetUDP_COMB(const string&n, unsigned pins, bool sequ)
|
|||
}
|
||||
}
|
||||
|
||||
bool NetUDP_COMB::set_table(const string&input, char output)
|
||||
bool NetUDP::first(string&inp, char&out) const
|
||||
{
|
||||
if ((output != '0') && (output != '1') && (output != 'x'))
|
||||
return false;
|
||||
table_idx = (unsigned) -1;
|
||||
return next(inp, out);
|
||||
}
|
||||
|
||||
bool NetUDP::next(string&inp, char&out) const
|
||||
{
|
||||
table_idx++;
|
||||
|
||||
assert((output == '0') || (output == '1') || (output == 'x'));
|
||||
assert(input.length() == (pin_count()-1));
|
||||
if (table_idx >= udp->tinput.count())
|
||||
return false;
|
||||
|
||||
/* XXXX Need to check to make sure that the input vector
|
||||
contains a legal combination of characters. In
|
||||
combinational UDPs, only 0, 1, x, and ? are allowed. */
|
||||
cm_[input] = output;
|
||||
if (is_sequential())
|
||||
{
|
||||
inp = string("") + udp->tcurrent[table_idx] + udp->tinput[table_idx];
|
||||
assert(inp.length() == pin_count());
|
||||
}
|
||||
else
|
||||
{
|
||||
inp = udp->tinput[table_idx];
|
||||
assert(inp.length() == (pin_count()-1));
|
||||
}
|
||||
|
||||
return true;
|
||||
out = udp->toutput[table_idx];
|
||||
assert( (out == '0')
|
||||
|| (out == '1')
|
||||
|| (out == 'x')
|
||||
|| (is_sequential() && (out == '-')));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void NetUDP_COMB::cleanup_table()
|
||||
char NetUDP::get_initial() const
|
||||
{
|
||||
assert (is_sequential());
|
||||
|
||||
switch (udp->initial)
|
||||
{
|
||||
case verinum::V0:
|
||||
return '0';
|
||||
case verinum::V1:
|
||||
return '1';
|
||||
case verinum::Vx:
|
||||
case verinum::Vz:
|
||||
return 'x';
|
||||
}
|
||||
|
||||
assert(0);
|
||||
return 'x';
|
||||
}
|
||||
|
||||
bool NetUDP_COMB::first(string&inp, char&out) const
|
||||
{
|
||||
idx_ = cm_.begin();
|
||||
if (idx_ == cm_.end())
|
||||
return false;
|
||||
|
||||
inp = (*idx_).first;
|
||||
out = (*idx_).second;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NetUDP_COMB::next(string&inp, char&out) const
|
||||
{
|
||||
idx_ ++;
|
||||
if (idx_ == cm_.end())
|
||||
return false;
|
||||
|
||||
inp = (*idx_).first;
|
||||
out = (*idx_).second;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: net_udp.cc,v $
|
||||
* Revision 1.4 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.3 2000/12/15 01:24:17 steve
|
||||
* Accept x in outputs of primitive. (PR#84)
|
||||
*
|
||||
|
|
|
|||
152
netlist.cc
152
netlist.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: netlist.cc,v 1.159 2001/04/06 02:28:02 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.160 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <cassert>
|
||||
|
|
@ -2321,155 +2321,11 @@ const NetProc*NetTaskDef::proc() const
|
|||
return proc_;
|
||||
}
|
||||
|
||||
/*
|
||||
* This method takes the input string, which contains exactly one
|
||||
* edge, and connects it to the correct output state. The output state
|
||||
* will be generated if needed, and the value compared.
|
||||
*/
|
||||
bool NetUDP::set_sequ_(const string&input, char output)
|
||||
{
|
||||
if (output == '-')
|
||||
output = input[0];
|
||||
|
||||
string frm = input;
|
||||
string to = input;
|
||||
to[0] = output;
|
||||
|
||||
unsigned edge = frm.find_first_not_of("01x");
|
||||
assert(frm.find_last_not_of("01x") == edge);
|
||||
|
||||
switch (input[edge]) {
|
||||
case 'r':
|
||||
frm[edge] = '0';
|
||||
to[edge] = '1';
|
||||
break;
|
||||
case 'R':
|
||||
frm[edge] = 'x';
|
||||
to[edge] = '1';
|
||||
break;
|
||||
case 'f':
|
||||
frm[edge] = '1';
|
||||
to[edge] = '0';
|
||||
break;
|
||||
case 'F':
|
||||
frm[edge] = 'x';
|
||||
to[edge] = '0';
|
||||
break;
|
||||
case 'P':
|
||||
frm[edge] = '0';
|
||||
to[edge] = 'x';
|
||||
break;
|
||||
case 'N':
|
||||
frm[edge] = '1';
|
||||
to[edge] = 'x';
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
state_t_*sfrm = find_state_(frm);
|
||||
state_t_*sto = find_state_(to);
|
||||
|
||||
switch (to[edge]) {
|
||||
case '0':
|
||||
// Notice that I might have caught this edge already
|
||||
if (sfrm->pins[edge].zer != sto) {
|
||||
assert(sfrm->pins[edge].zer == 0);
|
||||
sfrm->pins[edge].zer = sto;
|
||||
}
|
||||
break;
|
||||
case '1':
|
||||
// Notice that I might have caught this edge already
|
||||
if (sfrm->pins[edge].one != sto) {
|
||||
assert(sfrm->pins[edge].one == 0);
|
||||
sfrm->pins[edge].one = sto;
|
||||
}
|
||||
break;
|
||||
case 'x':
|
||||
// Notice that I might have caught this edge already
|
||||
if (sfrm->pins[edge].xxx != sto) {
|
||||
assert(sfrm->pins[edge].xxx == 0);
|
||||
sfrm->pins[edge].xxx = sto;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NetUDP::sequ_glob_(string input, char output)
|
||||
{
|
||||
for (unsigned idx = 0 ; idx < input.length() ; idx += 1)
|
||||
switch (input[idx]) {
|
||||
case '0':
|
||||
case '1':
|
||||
case 'x':
|
||||
case 'r':
|
||||
case 'R':
|
||||
case 'f':
|
||||
case 'F':
|
||||
case 'P':
|
||||
case 'N':
|
||||
break;
|
||||
|
||||
case '?': // Iterate over all the levels
|
||||
input[idx] = '0';
|
||||
sequ_glob_(input, output);
|
||||
input[idx] = '1';
|
||||
sequ_glob_(input, output);
|
||||
input[idx] = 'x';
|
||||
sequ_glob_(input, output);
|
||||
return true;
|
||||
|
||||
case 'n': // Iterate over (n) edges
|
||||
input[idx] = 'f';
|
||||
sequ_glob_(input, output);
|
||||
input[idx] = 'F';
|
||||
sequ_glob_(input, output);
|
||||
input[idx] = 'N';
|
||||
sequ_glob_(input, output);
|
||||
return true;
|
||||
|
||||
case 'p': // Iterate over (p) edges
|
||||
input[idx] = 'r';
|
||||
sequ_glob_(input, output);
|
||||
input[idx] = 'R';
|
||||
sequ_glob_(input, output);
|
||||
input[idx] = 'P';
|
||||
sequ_glob_(input, output);
|
||||
return true;
|
||||
|
||||
case '_': // Iterate over (?0) edges
|
||||
input[idx] = 'f';
|
||||
sequ_glob_(input, output);
|
||||
input[idx] = 'F';
|
||||
sequ_glob_(input, output);
|
||||
return true;
|
||||
|
||||
case '*': // Iterate over all the edges
|
||||
input[idx] = 'r';
|
||||
sequ_glob_(input, output);
|
||||
input[idx] = 'R';
|
||||
sequ_glob_(input, output);
|
||||
input[idx] = 'f';
|
||||
sequ_glob_(input, output);
|
||||
input[idx] = 'F';
|
||||
sequ_glob_(input, output);
|
||||
input[idx] = 'P';
|
||||
sequ_glob_(input, output);
|
||||
input[idx] = 'N';
|
||||
sequ_glob_(input, output);
|
||||
return true;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
return set_sequ_(input, output);
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.160 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.159 2001/04/06 02:28:02 steve
|
||||
* Generate vvp code for functions with ports.
|
||||
*
|
||||
|
|
|
|||
101
netlist.h
101
netlist.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: netlist.h,v 1.202 2001/04/06 02:28:02 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.203 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -1025,12 +1025,6 @@ class NetLogic : public NetNode {
|
|||
* In any case, pin 0 is an output, and all the remaining pins are
|
||||
* inputs.
|
||||
*
|
||||
* The sequential truth table is canonically represented as a finite state
|
||||
* machine with the current state representing the inputs and the
|
||||
* current output, and the next state carrying the new output value to
|
||||
* use. All the outgoing transitions from a state represent a single
|
||||
* edge.
|
||||
*
|
||||
* Set_table takes as input a string with one letter per pin. The
|
||||
* parser translates the written sequences to one of these. The
|
||||
* valid characters are:
|
||||
|
|
@ -1046,8 +1040,8 @@ class NetLogic : public NetNode {
|
|||
* It also takes one of the following glob letters to represent more
|
||||
* then one item.
|
||||
*
|
||||
* p -- 01, 0x or x1
|
||||
* n -- 10, 1x or x0
|
||||
* p -- 01, 0x or x1 // check this with the lexer
|
||||
* n -- 10, 1x or x0 // check this with the lexer
|
||||
* ? -- 0, 1, or x
|
||||
* * -- any edge
|
||||
* + -- 01 or x1
|
||||
|
|
@ -1068,99 +1062,35 @@ class NetLogic : public NetNode {
|
|||
* 1 are listed.
|
||||
*
|
||||
*/
|
||||
class NetUDP_COMB : public NetNode {
|
||||
#include "PUdp.h"
|
||||
|
||||
class NetUDP : public NetNode {
|
||||
|
||||
public:
|
||||
explicit NetUDP_COMB(const string&n, unsigned pins, bool sequ = false);
|
||||
explicit NetUDP(const string&n, unsigned pins, PUdp*u);
|
||||
|
||||
virtual bool emit_node(struct target_t*) const;
|
||||
virtual void dump_node(ostream&, unsigned ind) const;
|
||||
|
||||
/* append a new truth table row. */
|
||||
bool set_table(const string&input, char output);
|
||||
|
||||
/* After the primitive is built up, this method is called to
|
||||
clean up redundancies, and possibly optimize the table. */
|
||||
void cleanup_table();
|
||||
|
||||
/* Use these methods to scan the truth table of the
|
||||
device. "first" returns the first item in the table, and
|
||||
"next" returns the next item in the table. The method will
|
||||
return false when the scan is done. */
|
||||
bool first(string&inp, char&out) const;
|
||||
bool next(string&inp, char&out) const;
|
||||
unsigned rows() const { return udp->tinput.count(); }
|
||||
|
||||
bool is_sequential() const { return sequential_; }
|
||||
|
||||
protected:
|
||||
|
||||
// A combinational primitive is more simply represented as a
|
||||
// simple map of input signals to a single output.
|
||||
typedef map<string,char> CM_;
|
||||
CM_ cm_;
|
||||
unsigned nin() const { return pin_count()-1; }
|
||||
bool is_sequential() const { return udp->sequential; }
|
||||
string udp_name() const { return udp->name_; }
|
||||
char get_initial() const;
|
||||
|
||||
private:
|
||||
|
||||
bool sequential_;
|
||||
|
||||
mutable CM_::const_iterator idx_;
|
||||
mutable unsigned table_idx;
|
||||
PUdp *udp;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class NetUDP : public NetUDP_COMB {
|
||||
|
||||
public:
|
||||
explicit NetUDP(const string&n, unsigned pins, bool sequ = true)
|
||||
: NetUDP_COMB(n, pins, sequ), init_('x') {};
|
||||
|
||||
virtual bool emit_node( struct target_t*) const;
|
||||
virtual void dump_node(ostream&, unsigned ind) const;
|
||||
|
||||
/* return false if the entry conflicts with an existing
|
||||
entry. In any case, the new output overrides. */
|
||||
bool set_table(const string&input, char output);
|
||||
void cleanup_table();
|
||||
|
||||
/* Return the next output from the passed state. Each letter
|
||||
of the input string represents the pin of the same
|
||||
position. */
|
||||
char table_lookup(const string&from, char to, unsigned pin) const;
|
||||
|
||||
void set_initial(char);
|
||||
char get_initial() const { return init_; }
|
||||
|
||||
private:
|
||||
char init_;
|
||||
|
||||
struct state_t_;
|
||||
struct pin_t_ {
|
||||
state_t_*zer;
|
||||
state_t_*one;
|
||||
state_t_*xxx;
|
||||
|
||||
explicit pin_t_() : zer(0), one(0), xxx(0) { }
|
||||
};
|
||||
|
||||
struct state_t_ {
|
||||
char out;
|
||||
pin_t_*pins;
|
||||
|
||||
state_t_(unsigned n) : out(0), pins(new pin_t_[n]) {}
|
||||
~state_t_() { delete[]pins; }
|
||||
};
|
||||
|
||||
typedef map<string,state_t_*> FSM_;
|
||||
FSM_ fsm_;
|
||||
bool set_sequ_(const string&in, char out);
|
||||
bool sequ_glob_(string, char out);
|
||||
|
||||
state_t_*find_state_(const string&);
|
||||
|
||||
void dump_sequ_(ostream&o, unsigned ind) const;
|
||||
void dump_comb_(ostream&o, unsigned ind) const;
|
||||
};
|
||||
|
||||
/* =========
|
||||
* A process is a behavioral-model description. A process is a
|
||||
* statement that may be compound. the various statement types may
|
||||
|
|
@ -2872,6 +2802,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.203 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.202 2001/04/06 02:28:02 steve
|
||||
* Generate vvp code for functions with ports.
|
||||
*
|
||||
|
|
|
|||
48
t-dll-api.cc
48
t-dll-api.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-dll-api.cc,v 1.39 2001/04/21 00:55:46 steve Exp $"
|
||||
#ident "$Id: t-dll-api.cc,v 1.40 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "t-dll.h"
|
||||
|
|
@ -335,6 +335,49 @@ extern "C" ivl_nexus_t ivl_logic_pin(ivl_net_logic_t net, unsigned pin)
|
|||
return net->pins_[pin];
|
||||
}
|
||||
|
||||
extern "C" ivl_udp_t ivl_logic_udp(ivl_net_logic_t net)
|
||||
{
|
||||
assert(net->type_ == IVL_LO_UDP);
|
||||
assert(net->udp);
|
||||
return net->udp;
|
||||
}
|
||||
|
||||
|
||||
extern "C" unsigned ivl_udp_sequ(ivl_udp_t net)
|
||||
{
|
||||
return net->sequ;
|
||||
}
|
||||
|
||||
extern "C" unsigned ivl_udp_nin(ivl_udp_t net)
|
||||
{
|
||||
return net->nin;
|
||||
}
|
||||
|
||||
extern "C" unsigned ivl_udp_init(ivl_udp_t net)
|
||||
{
|
||||
return net->init;
|
||||
}
|
||||
|
||||
extern "C" const char* ivl_udp_row(ivl_udp_t net, unsigned idx)
|
||||
{
|
||||
assert(idx < net->nrows);
|
||||
assert(net->table);
|
||||
assert(net->table[idx]);
|
||||
return net->table[idx];
|
||||
}
|
||||
|
||||
extern "C" unsigned ivl_udp_rows(ivl_udp_t net)
|
||||
{
|
||||
return net->nrows;
|
||||
}
|
||||
|
||||
extern "C" const char* ivl_udp_name(ivl_udp_t net)
|
||||
{
|
||||
assert(net->name);
|
||||
return net->name;
|
||||
}
|
||||
|
||||
|
||||
extern "C" ivl_lpm_ff_t ivl_lpm_ff(ivl_lpm_t net)
|
||||
{
|
||||
assert(net->type == IVL_LPM_FF);
|
||||
|
|
@ -906,6 +949,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
|
|||
|
||||
/*
|
||||
* $Log: t-dll-api.cc,v $
|
||||
* Revision 1.40 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.39 2001/04/21 00:55:46 steve
|
||||
* Generate code for disable.
|
||||
*
|
||||
|
|
|
|||
65
t-dll.cc
65
t-dll.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-dll.cc,v 1.33 2001/04/05 01:12:28 steve Exp $"
|
||||
#ident "$Id: t-dll.cc,v 1.34 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "compiler.h"
|
||||
|
|
@ -409,6 +409,66 @@ void dll_target::logic(const NetLogic*net)
|
|||
scope_add_logic(scope, obj);
|
||||
}
|
||||
|
||||
void dll_target::udp(const NetUDP*net)
|
||||
{
|
||||
struct ivl_net_logic_s *obj = new struct ivl_net_logic_s;
|
||||
|
||||
obj->type_ = IVL_LO_UDP;
|
||||
|
||||
static map<string,ivl_udp_t> udps;
|
||||
|
||||
ivl_udp_t u = udps[net->udp_name()];
|
||||
if (!u)
|
||||
{
|
||||
u = new ivl_udp_s;
|
||||
u->nrows = net->rows();
|
||||
u->table = (char**)malloc((u->nrows+1)*sizeof(char*));
|
||||
assert(u->table);
|
||||
u->table[u->nrows] = 0x0;
|
||||
u->nin = net->nin();
|
||||
u->sequ = net->is_sequential();
|
||||
if (u->sequ)
|
||||
u->init = net->get_initial();
|
||||
u->name = strdup(net->udp_name().c_str());
|
||||
string inp;
|
||||
char out;
|
||||
int i = 0;
|
||||
if (net->first(inp, out))
|
||||
do
|
||||
{
|
||||
string tt = inp+out;
|
||||
u->table[i++] = strdup(tt.c_str());
|
||||
} while (net->next(inp, out));
|
||||
|
||||
udps[net->udp_name()] = u;
|
||||
}
|
||||
|
||||
obj->udp = u;
|
||||
|
||||
// Some duplication of code here, see: dll_target::logic()
|
||||
|
||||
/* Connect all the ivl_nexus_t objects to the pins of the
|
||||
device. */
|
||||
|
||||
obj->npins_ = net->pin_count();
|
||||
obj->pins_ = new ivl_nexus_t[obj->npins_];
|
||||
for (unsigned idx = 0 ; idx < obj->npins_ ; idx += 1) {
|
||||
const Nexus*nex = net->pin(idx).nexus();
|
||||
assert(nex->t_cookie());
|
||||
obj->pins_[idx] = (ivl_nexus_t) nex->t_cookie();
|
||||
nexus_log_add(obj->pins_[idx], obj, idx);
|
||||
}
|
||||
|
||||
assert(net->scope());
|
||||
ivl_scope_t scope = find_scope(des_.root_, net->scope());
|
||||
assert(scope);
|
||||
|
||||
obj->scope_= scope;
|
||||
obj->name_ = strdup(net->name());
|
||||
|
||||
scope_add_logic(scope, obj);
|
||||
}
|
||||
|
||||
void dll_target::lpm_ff(const NetFF*net)
|
||||
{
|
||||
ivl_lpm_ff_t obj = new struct ivl_lpm_ff_s;
|
||||
|
|
@ -746,6 +806,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
|
|||
|
||||
/*
|
||||
* $Log: t-dll.cc,v $
|
||||
* Revision 1.34 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.33 2001/04/05 01:12:28 steve
|
||||
* Get signed compares working correctly in vvp.
|
||||
*
|
||||
|
|
|
|||
19
t-dll.h
19
t-dll.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: t-dll.h,v 1.38 2001/04/15 02:58:11 steve Exp $"
|
||||
#ident "$Id: t-dll.h,v 1.39 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -57,6 +57,7 @@ struct dll_target : public target_t, public expr_scan_t {
|
|||
bool bufz(const NetBUFZ*);
|
||||
void event(const NetEvent*);
|
||||
void logic(const NetLogic*);
|
||||
void udp(const NetUDP*);
|
||||
void lpm_ff(const NetFF*);
|
||||
void net_assign(const NetAssign_*);
|
||||
bool net_const(const NetConst*);
|
||||
|
|
@ -251,6 +252,7 @@ struct ivl_net_const_s {
|
|||
*/
|
||||
struct ivl_net_logic_s {
|
||||
ivl_logic_t type_;
|
||||
ivl_udp_t udp;
|
||||
|
||||
char* name_;
|
||||
ivl_scope_t scope_;
|
||||
|
|
@ -260,6 +262,18 @@ struct ivl_net_logic_s {
|
|||
};
|
||||
|
||||
|
||||
/*
|
||||
* UDP definition.
|
||||
*/
|
||||
struct ivl_udp_s {
|
||||
char* name;
|
||||
unsigned nin;
|
||||
unsigned short sequ;
|
||||
char init;
|
||||
unsigned nrows;
|
||||
char **table; // zero terminated array of pointers
|
||||
};
|
||||
|
||||
/*
|
||||
* The ivl_nexus_t is a single-bit link of some number of pins of
|
||||
* devices. the __nexus_ptr structure is a helper that actually does
|
||||
|
|
@ -437,6 +451,9 @@ struct ivl_statement_s {
|
|||
|
||||
/*
|
||||
* $Log: t-dll.h,v $
|
||||
* Revision 1.39 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.38 2001/04/15 02:58:11 steve
|
||||
* vvp support for <= with internal delay.
|
||||
*
|
||||
|
|
|
|||
30
t-vvm.cc
30
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.205 2001/04/06 02:28:02 steve Exp $"
|
||||
#ident "$Id: t-vvm.cc,v 1.206 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <iostream>
|
||||
|
|
@ -166,7 +166,6 @@ class target_vvm : public target_t {
|
|||
virtual void logic(const NetLogic*);
|
||||
virtual bool bufz(const NetBUFZ*);
|
||||
virtual void udp(const NetUDP*);
|
||||
virtual void udp_comb(const NetUDP_COMB*);
|
||||
virtual void net_assign(const NetAssign_*) { }
|
||||
virtual void net_case_cmp(const NetCaseCmp*);
|
||||
virtual bool net_cassign(const NetCAssign*);
|
||||
|
|
@ -499,7 +498,7 @@ void vvm_proc_rval::expr_sfunc(const NetESFunc*fun)
|
|||
tgt_->defn << " vpip_bit_t " << retval << "_bits["<<retwid<<"];"
|
||||
<< endl;
|
||||
|
||||
tgt_->defn << " vpip_callfunc(\"" << fun->name() << "\", "
|
||||
tgt_->defn << " vpip_callfunc(\"" << stresc(fun->name()) << "\", "
|
||||
<< retwid << ", " << retval<<"_bits";
|
||||
|
||||
if (fun->nparms() == 0)
|
||||
|
|
@ -1031,7 +1030,7 @@ void target_vvm::scope(const NetScope*scope)
|
|||
}
|
||||
|
||||
init_code << " vpip_make_scope(&" << hname << ", " <<
|
||||
type_code << ", \"" << scope->name() << "\");" << endl;
|
||||
type_code << ", \"" << stresc(scope->name()) << "\");" << endl;
|
||||
|
||||
if (const NetScope*par = scope->parent()) {
|
||||
string pname = mangle(par->name()) + "_scope";
|
||||
|
|
@ -1149,7 +1148,7 @@ int target_vvm::end_design(const Design*mod)
|
|||
name = vpi_module_list;
|
||||
vpi_module_list = "";
|
||||
}
|
||||
out << " vvm_load_vpi_module(\"" << name << ".vpi\");" << endl;
|
||||
out << " vvm_load_vpi_module(\"" << stresc(name) << ".vpi\");" << endl;
|
||||
}
|
||||
out << " design_init();" << endl;
|
||||
out << " design_start();" << endl;
|
||||
|
|
@ -1269,7 +1268,7 @@ void target_vvm::signal(const NetNet*sig)
|
|||
signal_counter += 1;
|
||||
|
||||
init_code << " vpip_make_reg(&" << net_name
|
||||
<< ", \"" << sig->name() << "\", signal_bit_table+"
|
||||
<< ", \"" << stresc(sig->name()) << "\", signal_bit_table+"
|
||||
<< signal_bit_counter << ", " << sig->pin_count()
|
||||
<< ", " << (sig->get_signed()? "1" : "0") << ");" << endl;
|
||||
|
||||
|
|
@ -1353,7 +1352,7 @@ void target_vvm::memory(const NetMemory*mem)
|
|||
out << "static vvm_memory_t " << mname << ";"
|
||||
" /* " << mem->name() << " */" << endl;
|
||||
init_code << " vpip_make_memory(&" << mname << ", \"" <<
|
||||
mem->name() << "\", " << mem->width() << ", " <<
|
||||
stresc(mem->name()) << "\", " << mem->width() << ", " <<
|
||||
mem->count() << ");" << endl;
|
||||
}
|
||||
|
||||
|
|
@ -2087,12 +2086,14 @@ bool target_vvm::bufz(const NetBUFZ*gate)
|
|||
return true;
|
||||
}
|
||||
|
||||
void target_vvm::udp_comb(const NetUDP_COMB*gate)
|
||||
void target_vvm::udp(const NetUDP*gate)
|
||||
{
|
||||
string mname = mangle(gate->name());
|
||||
string nexus;
|
||||
unsigned ncode;
|
||||
|
||||
// TODO: maintain a map<string,PUdp*> of tables already
|
||||
// emited, and only print the table for each UDP once.
|
||||
|
||||
out << "static const char*" << mname << "_ctab =" << endl;
|
||||
|
||||
|
|
@ -2131,12 +2132,6 @@ void target_vvm::udp_comb(const NetUDP_COMB*gate)
|
|||
}
|
||||
|
||||
|
||||
void target_vvm::udp(const NetUDP*gate)
|
||||
{
|
||||
assert(gate->is_sequential());
|
||||
udp_comb(gate);
|
||||
}
|
||||
|
||||
void target_vvm::net_case_cmp(const NetCaseCmp*gate)
|
||||
{
|
||||
string mname = mangle(gate->name());
|
||||
|
|
@ -3402,7 +3397,7 @@ void target_vvm::proc_stask(const NetSTask*net)
|
|||
parameters. we don't need a parameter array for this. */
|
||||
|
||||
if (net->nparms() == 0) {
|
||||
defn << " vpip_calltask(thr->scope, \"" << net->name()
|
||||
defn << " vpip_calltask(thr->scope, \"" << stresc(net->name())
|
||||
<< "\", 0, 0);" << endl;
|
||||
defn << " if (vpip_finished()) return false;" << endl;
|
||||
return;
|
||||
|
|
@ -3425,7 +3420,7 @@ void target_vvm::proc_stask(const NetSTask*net)
|
|||
<< endl;
|
||||
}
|
||||
|
||||
defn << " vpip_calltask(thr->scope, \"" << net->name() << "\", "
|
||||
defn << " vpip_calltask(thr->scope, \"" << stresc(net->name()) << "\", "
|
||||
<< net->nparms() << ", " << ptmp << ");" << endl;
|
||||
defn << " if (vpip_finished()) return false;" << endl;
|
||||
}
|
||||
|
|
@ -3639,6 +3634,9 @@ extern const struct target tgt_vvm = {
|
|||
};
|
||||
/*
|
||||
* $Log: t-vvm.cc,v $
|
||||
* Revision 1.206 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.205 2001/04/06 02:28:02 steve
|
||||
* Generate vvp code for functions with ports.
|
||||
*
|
||||
|
|
|
|||
11
target.cc
11
target.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: target.cc,v 1.52 2001/04/06 02:28:02 steve Exp $"
|
||||
#ident "$Id: target.cc,v 1.53 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -72,12 +72,6 @@ void target_t::udp(const NetUDP*)
|
|||
"Unhandled UDP." << endl;
|
||||
}
|
||||
|
||||
void target_t::udp_comb(const NetUDP_COMB*)
|
||||
{
|
||||
cerr << "target (" << typeid(*this).name() << "): "
|
||||
"Unhandled combinational primitive." << endl;
|
||||
}
|
||||
|
||||
void target_t::lpm_add_sub(const NetAddSub*)
|
||||
{
|
||||
cerr << "target (" << typeid(*this).name() << "): "
|
||||
|
|
@ -389,6 +383,9 @@ void expr_scan_t::expr_binary(const NetEBinary*ex)
|
|||
|
||||
/*
|
||||
* $Log: target.cc,v $
|
||||
* Revision 1.53 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.52 2001/04/06 02:28:02 steve
|
||||
* Generate vvp code for functions with ports.
|
||||
*
|
||||
|
|
|
|||
10
target.h
10
target.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: target.h,v 1.51 2001/04/06 02:28:02 steve Exp $"
|
||||
#ident "$Id: target.h,v 1.52 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -87,7 +87,6 @@ struct target_t {
|
|||
virtual void logic(const NetLogic*);
|
||||
virtual bool bufz(const NetBUFZ*);
|
||||
virtual void udp(const NetUDP*);
|
||||
virtual void udp_comb(const NetUDP_COMB*);
|
||||
virtual void net_assign(const NetAssign_*);
|
||||
virtual void net_case_cmp(const NetCaseCmp*);
|
||||
virtual bool net_cassign(const NetCAssign*);
|
||||
|
|
@ -154,12 +153,19 @@ extern bool emit(const Design*des, const char*type);
|
|||
used by most any language. */
|
||||
extern string mangle(const string&str);
|
||||
|
||||
/* This function takes a string and produces an escaped version that can be
|
||||
used inside a string constant for a C++ compiler. */
|
||||
extern string stresc(const string&str);
|
||||
|
||||
/* This is the table of supported output targets. It is a null
|
||||
terminated array of pointers to targets. */
|
||||
extern const struct target *target_table[];
|
||||
|
||||
/*
|
||||
* $Log: target.h,v $
|
||||
* Revision 1.52 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.51 2001/04/06 02:28:02 steve
|
||||
* Generate vvp code for functions with ports.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: vvm_gates.h,v 1.70 2001/01/16 03:57:46 steve Exp $"
|
||||
#ident "$Id: vvm_gates.h,v 1.71 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvm.h"
|
||||
|
|
@ -841,6 +841,7 @@ class vvm_udp_sequ1 : public vvm_udp_comb
|
|||
public:
|
||||
explicit vvm_udp_sequ1(unsigned w, const char*t)
|
||||
: vvm_udp_comb(w+1, t) {};
|
||||
void init_I(unsigned idx, vpip_bit_t val);
|
||||
private:
|
||||
void take_value(unsigned key, vpip_bit_t val);
|
||||
};
|
||||
|
|
@ -959,6 +960,9 @@ class vvm_posedge : public vvm_nexus::recvr_t {
|
|||
|
||||
/*
|
||||
* $Log: vvm_gates.h,v $
|
||||
* Revision 1.71 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.70 2001/01/16 03:57:46 steve
|
||||
* Get rid of gate templates.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,11 +17,15 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: vvm_udp.cc,v 1.2 2000/11/04 06:36:24 steve Exp $"
|
||||
#ident "$Id: vvm_udp.cc,v 1.3 2001/04/22 23:09:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvm_gates.h"
|
||||
|
||||
#ifdef UDP_DEBUG
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
vvm_udp_comb::vvm_udp_comb(unsigned w, const char*t)
|
||||
: vvm_1bit_out(0), width_(w), table_(t)
|
||||
{
|
||||
|
|
@ -34,6 +38,11 @@ vvm_udp_comb::~vvm_udp_comb()
|
|||
delete[]ibits_;
|
||||
}
|
||||
|
||||
void vvm_udp_sequ1::init_I(unsigned idx, vpip_bit_t val)
|
||||
{
|
||||
vvm_udp_comb::init_I(idx, val);
|
||||
}
|
||||
|
||||
void vvm_udp_comb::init_I(unsigned idx, vpip_bit_t val)
|
||||
{
|
||||
assert(idx < width_);
|
||||
|
|
@ -50,6 +59,12 @@ void vvm_udp_sequ1::take_value(unsigned key, vpip_bit_t val)
|
|||
assert(key < width_ - 1);
|
||||
ibits_[0] = obit_;
|
||||
vvm_udp_comb::take_value(key+1, val);
|
||||
#ifdef UDP_DEBUG
|
||||
static int max_deb = UDP_DEBUG;
|
||||
if (max_deb>0)
|
||||
if (--max_deb<1000)
|
||||
cerr<<"sUDP(\""<<table_<<"\", \""<<ibits_<<"\")=\""<<obit_<<"\""<<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void vvm_udp_comb::take_value(unsigned key, vpip_bit_t val)
|
||||
|
|
@ -103,12 +118,20 @@ void vvm_udp_comb::take_value(unsigned key, vpip_bit_t val)
|
|||
if (old_bit=='x' && new_bit=='0')
|
||||
continue;
|
||||
break;
|
||||
case 'p':
|
||||
if (old_bit=='0')
|
||||
continue;
|
||||
break;
|
||||
case 'n':
|
||||
if (old_bit=='1')
|
||||
continue;
|
||||
break;
|
||||
case 'P':
|
||||
if (old_bit=='1' && new_bit=='x')
|
||||
if (old_bit=='0' && new_bit=='x')
|
||||
continue;
|
||||
break;
|
||||
case 'N':
|
||||
if (old_bit=='0' && new_bit=='x')
|
||||
if (old_bit=='1' && new_bit=='x')
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
|
@ -144,13 +167,19 @@ void vvm_udp_comb::take_value(unsigned key, vpip_bit_t val)
|
|||
}
|
||||
}
|
||||
|
||||
output(StX);
|
||||
obit_ = 'x';
|
||||
if (obit_ != 'x')
|
||||
{
|
||||
output(StX);
|
||||
obit_ = 'x';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* $Log: vvm_udp.cc,v $
|
||||
* Revision 1.3 2001/04/22 23:09:46 steve
|
||||
* More UDP consolidation from Stephan Boettcher.
|
||||
*
|
||||
* Revision 1.2 2000/11/04 06:36:24 steve
|
||||
* Apply sequential UDP rework from Stephan Boettcher (PR#39)
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue