Fix GitHub issue #356 - use pull strength for tri0/tri1 tie-offs.

When connecting module inout ports, an island is created. If there
is no other driver on one of the island ports, a tie-off is added.
In the case of a tri0 or tri1 net, this must have the correct (pull)
drive strength.

(cherry picked from commit 9d15b771b1)
This commit is contained in:
Martin Whitaker 2020-08-06 14:20:16 +01:00
parent f6c2b79608
commit fabdf42365
1 changed files with 18 additions and 6 deletions

View File

@ -651,14 +651,15 @@ static void draw_net_input_x(ivl_nexus_t nex,
0.0 into the net. */
if (ndrivers == 0) {
unsigned wid = width_of_nexus(nex);
int pull = (res == IVL_SIT_TRI0) || (res == IVL_SIT_TRI1);
/* For real nets put 0.0. */
if (signal_data_type_of_nexus(nex) == IVL_VT_REAL) {
nex_private = draw_Cr_to_string(0.0);
} else {
unsigned jdx;
char*tmp = malloc(wid + 5);
char*tmp = malloc((pull ? 3 : 1) * wid + 5);
nex_private = tmp;
strcpy(tmp, "C4<");
strcpy(tmp, pull ? "C8<" : "C4<");
tmp += strlen(tmp);
switch (res) {
case IVL_SIT_TRI:
@ -669,12 +670,18 @@ static void draw_net_input_x(ivl_nexus_t nex,
*tmp++ = 'z';
break;
case IVL_SIT_TRI0:
for (jdx = 0 ; jdx < wid ; jdx += 1)
for (jdx = 0 ; jdx < wid ; jdx += 1) {
*tmp++ = '5';
*tmp++ = '5';
*tmp++ = '0';
}
break;
case IVL_SIT_TRI1:
for (jdx = 0 ; jdx < wid ; jdx += 1)
for (jdx = 0 ; jdx < wid ; jdx += 1) {
*tmp++ = '5';
*tmp++ = '5';
*tmp++ = '1';
}
break;
default:
assert(0);
@ -687,8 +694,13 @@ static void draw_net_input_x(ivl_nexus_t nex,
to do this so that .nets have something to hang onto. */
char buf[64];
snprintf(buf, sizeof buf, "o%p", nex);
fprintf(vvp_out, "%s .functor BUFZ %u, %s; HiZ drive\n",
buf, wid, nex_private);
if (pull) {
fprintf(vvp_out, "%s .functor BUFT %u, %s, C4<0>, C4<0>, C4<0>; pull drive\n",
buf, wid, nex_private);
} else {
fprintf(vvp_out, "%s .functor BUFZ %u, %s; HiZ drive\n",
buf, wid, nex_private);
}
nex_private = realloc(nex_private, strlen(buf)+1);
strcpy(nex_private, buf);