From e0760873205678535ccff947082016f09204c9fa Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Wed, 30 Sep 2009 19:48:36 -0700 Subject: [PATCH] Draw PULLUP constants with their own BUFZ. This doesn't have any significant runtime consequence other then to create a functor that is otherwise stable. But this does connect to .net nodes more naturally, and gets me a step closer to banning Cx<> labels as arguments to .net records. --- tgt-vvp/draw_net_input.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tgt-vvp/draw_net_input.c b/tgt-vvp/draw_net_input.c index 18402c9bd..e2054785c 100644 --- a/tgt-vvp/draw_net_input.c +++ b/tgt-vvp/draw_net_input.c @@ -285,9 +285,11 @@ static char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr) } if (lptr && (ivl_logic_type(lptr) == IVL_LO_PULLUP)) { + char*result; + char tmp[32]; if (ivl_nexus_ptr_drive1(nptr) == IVL_DR_STRONG) { size_t result_len = 5 + ivl_logic_width(lptr); - char*result = malloc(result_len); + result = malloc(result_len); char*dp = result; strcpy(dp, "C4<"); dp += strlen(dp); @@ -296,11 +298,11 @@ static char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr) *dp++ = '>'; *dp = 0; assert((dp-result) <= result_len); - return result; + } else { char val[4]; size_t result_len = 5 + 3*ivl_logic_width(lptr); - char*result = malloc(result_len); + result = malloc(result_len); char*dp = result; val[0] = "01234567"[ivl_nexus_ptr_drive0(nptr)]; @@ -315,8 +317,17 @@ static char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr) *dp++ = '>'; *dp = 0; assert((dp-result) <= result_len); - return result; + } + + /* Make the constant an argument to a BUFZ, which is + what we use to drive the PULLed value. */ + fprintf(vvp_out, "L_%p .functor BUFZ 1, %s, C4<0>, C4<0>, C4<0>;\n", + lptr, result); + snprintf(tmp, sizeof tmp, "L_%p", lptr); + result = realloc(result, strlen(tmp)+1); + strcpy(result, tmp); + return result; } if (lptr && (nptr_pin == 0)) {