Add uwire support/functionality to the stub and vvp back ends
This patch adds a check in the vvp back end that a uwire has at most one driver. Previously this was just converted (with a warning message) to a wire just after elaboration.
This commit is contained in:
parent
860f8627ba
commit
f29d09dcbe
|
|
@ -353,7 +353,8 @@ typedef enum ivl_signal_type_e {
|
|||
IVL_SIT_TRI0 = 5,
|
||||
IVL_SIT_TRI1 = 6,
|
||||
IVL_SIT_TRIAND = 7,
|
||||
IVL_SIT_TRIOR = 8
|
||||
IVL_SIT_TRIOR = 8,
|
||||
IVL_SIT_UWIRE = 9
|
||||
} ivl_signal_type_t;
|
||||
|
||||
/* This is the type code for ivl_statement_t objects. */
|
||||
|
|
|
|||
2
main.cc
2
main.cc
|
|
@ -1105,7 +1105,7 @@ int main(int argc, char*argv[])
|
|||
if (int emit_rc = des->emit(&dll_target_obj)) {
|
||||
if (emit_rc > 0) {
|
||||
cerr << "error: Code generation had "
|
||||
<< emit_rc << " errors."
|
||||
<< emit_rc << " error(s)."
|
||||
<< endl;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
8
t-dll.cc
8
t-dll.cc
|
|
@ -2384,10 +2384,12 @@ void dll_target::signal(const NetNet*net)
|
|||
assert(0);
|
||||
break;
|
||||
|
||||
/* We will convert this to a TRI after we check that there
|
||||
is only one driver. */
|
||||
case NetNet::UWIRE:
|
||||
cerr << net->get_fileline()
|
||||
<< ": warning: uwire is not currently supported, converting "
|
||||
"it to a wire!" << endl;
|
||||
obj->type_ = IVL_SIT_UWIRE;
|
||||
break;
|
||||
|
||||
case NetNet::TRI:
|
||||
case NetNet::WIRE:
|
||||
case NetNet::IMPLICIT:
|
||||
|
|
|
|||
|
|
@ -1224,6 +1224,9 @@ static void show_signal(ivl_signal_t net)
|
|||
case IVL_SIT_TRI1:
|
||||
type = "tri1";
|
||||
break;
|
||||
case IVL_SIT_UWIRE:
|
||||
type = "uwire";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ static ivl_signal_type_t signal_type_of_nexus(ivl_nexus_t nex)
|
|||
continue;
|
||||
if (stype == IVL_SIT_NONE)
|
||||
continue;
|
||||
if (stype == IVL_SIT_UWIRE) return IVL_SIT_UWIRE;
|
||||
out = stype;
|
||||
}
|
||||
|
||||
|
|
@ -572,6 +573,7 @@ static void draw_net_input_x(ivl_nexus_t nex,
|
|||
res = signal_type_of_nexus(nex);
|
||||
switch (res) {
|
||||
case IVL_SIT_TRI:
|
||||
case IVL_SIT_UWIRE:
|
||||
resolv_type = "tri";
|
||||
break;
|
||||
case IVL_SIT_TRI0:
|
||||
|
|
@ -660,6 +662,7 @@ static void draw_net_input_x(ivl_nexus_t nex,
|
|||
tmp += strlen(tmp);
|
||||
switch (res) {
|
||||
case IVL_SIT_TRI:
|
||||
case IVL_SIT_UWIRE:
|
||||
for (jdx = 0 ; jdx < wid ; jdx += 1)
|
||||
*tmp++ = 'z';
|
||||
break;
|
||||
|
|
@ -698,6 +701,28 @@ static void draw_net_input_x(ivl_nexus_t nex,
|
|||
return;
|
||||
}
|
||||
|
||||
/* A uwire is a tri with only one driver. */
|
||||
if (res == IVL_SIT_UWIRE) {
|
||||
if (ndrivers > 1) {
|
||||
unsigned uidx;
|
||||
ivl_signal_t usig;
|
||||
/* Find the uwire signal. */
|
||||
for (uidx = 0 ; uidx < ivl_nexus_ptrs(nex) ; uidx += 1) {
|
||||
ivl_nexus_ptr_t ptr = ivl_nexus_ptr(nex, uidx);
|
||||
usig = ivl_nexus_ptr_sig(ptr);
|
||||
if (usig != 0) break;
|
||||
}
|
||||
assert(usig);
|
||||
|
||||
fprintf(stderr, "%s:%u: vvp.tgt error: uwire \"%s\" must "
|
||||
"have a single driver, found (%u).\n",
|
||||
ivl_signal_file(usig),
|
||||
ivl_signal_lineno(usig),
|
||||
ivl_signal_basename(usig), ndrivers);
|
||||
vvp_errors += 1;
|
||||
}
|
||||
res = IVL_SIT_TRI;
|
||||
}
|
||||
|
||||
/* If the nexus has exactly one driver, then simply draw
|
||||
it. Note that this will *not* work if the nexus is not a
|
||||
|
|
|
|||
Loading…
Reference in New Issue