diff --git a/vvp/parse.y b/vvp/parse.y index d51c7ab2b..33af4861f 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -688,6 +688,9 @@ statement | T_LABEL K_EXPORT T_SYMBOL ';' { compile_island_export($1, $3); } + | K_TRAN T_SYMBOL ',' T_SYMBOL T_SYMBOL ';' + { compile_island_tranif(0, $2, $4, $5, 0); } + | K_TRANIF0 T_SYMBOL ',' T_SYMBOL T_SYMBOL ',' T_SYMBOL ';' { compile_island_tranif(0, $2, $4, $5, $7); } diff --git a/vvp/vvp_island.cc b/vvp/vvp_island.cc index 2188fe4e7..07f78a563 100644 --- a/vvp/vvp_island.cc +++ b/vvp/vvp_island.cc @@ -490,14 +490,18 @@ void compile_island_tranif(int sense, char*island, char*pa, char*pb, char*pe) else br->active_high = false; - br->en = use_island->find_port(pe); - assert(br->en); + if (pe == 0) { + br->en = 0; + } else { + br->en = use_island->find_port(pe); + assert(br->en); + free(pe); + } use_island->add_branch(br, pa, pb); free(pa); free(pb); - free(pe); } void compile_island_cleanup(void)