latch for vvp output

This commit is contained in:
Johann Klammer 2016-03-11 21:46:31 +01:00 committed by Martin Whitaker
parent 35a61b4680
commit d7736d7eba
2 changed files with 30 additions and 0 deletions

View File

@ -436,6 +436,7 @@ static char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr)
if (lpm) switch (ivl_lpm_type(lpm)) {
case IVL_LPM_FF:
case IVL_LPM_LATCH:
case IVL_LPM_ABS:
case IVL_LPM_ADD:
case IVL_LPM_ARRAY:

View File

@ -1830,6 +1830,31 @@ static void draw_lpm_ff(ivl_lpm_t net)
fprintf(vvp_out, ";\n");
}
/*
* Emit a LATCH primitive. This uses the following syntax:
*
* .latch <width> <data>, <enable>;
*/
static void draw_lpm_latch(ivl_lpm_t net)
{
ivl_nexus_t nex;
unsigned width = ivl_lpm_width(net);
fprintf(vvp_out, "L_%p .latch %u ", net, width);
nex = ivl_lpm_data(net,0);
assert(nex);
fprintf(vvp_out, "%s", draw_net_input(nex));
assert(width_of_nexus(nex) == width);
nex = ivl_lpm_enable(net);
assert(nex);
assert(width_of_nexus(nex) == 1);
fprintf(vvp_out, ", %s", draw_net_input(nex));
fprintf(vvp_out, ";\n");
}
static void draw_lpm_shiftl(ivl_lpm_t net)
{
unsigned width = ivl_lpm_width(net);
@ -2160,6 +2185,10 @@ static void draw_lpm_in_scope(ivl_lpm_t net)
draw_lpm_ff(net);
return;
case IVL_LPM_LATCH:
draw_lpm_latch(net);
return;
case IVL_LPM_CMP_EEQ:
case IVL_LPM_CMP_EQ:
case IVL_LPM_CMP_EQX: