From 7597270939a3c1d823676893bc1407c709339176 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 24 Jun 2015 23:33:03 +0200 Subject: [PATCH] vhdlpp: Fixed $ivlh_rising/falling_edge(). Conditions to detect rising/falling edges were incorrect. VHDL standard specifies it has to detect the current value, rather than compare against the previous one. --- vpi/vhdl_table.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vpi/vhdl_table.c b/vpi/vhdl_table.c index a6dcac300..a1b895df8 100644 --- a/vpi/vhdl_table.c +++ b/vpi/vhdl_table.c @@ -156,16 +156,16 @@ static PLI_INT32 ivlh_attribute_event_calltf(ICARUS_VPI_CONST PLI_BYTE8*data) rval.value.scalar = vpi1; - // Detect if there was any change + // Detect if change occured in this moment if (mon->last_event.high != tnow.high) rval.value.scalar = vpi0; if (mon->last_event.low != tnow.low) rval.value.scalar = vpi0; // Determine the edge, if required - if (type == RISING_EDGE && mon->last_value.value.scalar == vpi0) + if (type == RISING_EDGE && mon->last_value.value.scalar != vpi1) rval.value.scalar = vpi0; - else if (type == FALLING_EDGE && mon->last_value.value.scalar == vpi1) + else if (type == FALLING_EDGE && mon->last_value.value.scalar != vpi0) rval.value.scalar = vpi0; }