From 817b1ef3d40f437878cb1b49ddef4ff62ebc74e4 Mon Sep 17 00:00:00 2001 From: Cary R Date: Tue, 4 Aug 2009 13:12:24 -0700 Subject: [PATCH] UDPs need to evaluate their arguments before generation When generating a .udp call the arguments need to be evaluated before the .udp is. This allows things like .resolv to be built correctly. (cherry picked from commit cb5c4299fb95f83eae7d726398683ac501a4de53) --- tgt-vvp/vvp_scope.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index fa1832659..431e8ba53 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -615,6 +615,8 @@ static void draw_udp_in_scope(ivl_net_logic_t lptr) static ivl_udp_t *udps = 0x0; static int nudps = 0; int i; + unsigned ninp; + const char **input_strings; for (i=0; i"); + input_strings[pdx] = "C4"; } else { - fprintf(vvp_out, ", %s", draw_net_input(nex)); + input_strings[pdx] = draw_net_input(nex); } } + fprintf(vvp_out, "L_%p .udp", lptr); + fprintf(vvp_out, " UDP_%s", + vvp_mangle_id(ivl_udp_name(udp))); + draw_delay(lptr); + + for (pdx = 0 ; pdx < ninp ; pdx += 1) { + fprintf(vvp_out, ", %s", input_strings[pdx]); + } + free(input_strings); + fprintf(vvp_out, ";\n"); } @@ -805,7 +819,6 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr) input_strings[pdx] = draw_net_input(ivl_logic_pin(lptr, pdx+1)); level = 0; - ninp = ivl_logic_pins(lptr) - 1; while (ninp) { int inst; for (inst = 0; inst < ninp; inst += 4) {