Hello all
I have an issue with the following construct (array of structures with realtime type members)
package i2c_bfm_pkg;
typedef enum bit unsigned [2:0] {
STANDARD = 0, FAST = 1, HIGHSPEED = 2, CUSTOM = 3, FASTP = 4} t_mode;
parameter realtime cstScl_h = 2.5us;
typedef struct packed{
realtime tBUF; // Bus Free Time between STOP and START
realtime tHD_STA; // Hold time, (Repeated) START condition
realtime tLOW; // Low Period of the SCL Clock
realtime tHIGH; // High Period of the SCL Clock
realtime tHD_DAT; // SDA hold
realtime tSU_DAT; // SDA setup
realtime tSU_STA; // Start condition setup
realtime tSU_ST0; // Stop condition setup
} t_timings;
parameter t_timings p_timings[] = '{
/* tBUF tHD_STA, tLOW, tHIGH, tHD_DAT, tSU_DAT, tSU_STA, tSU_ST0 */
/* 0 STD */ '{ 4.7us, 4us, 4.7us, 4us, 0.1us, 0.25us, 4.7us, 4us},
/* 1 FAST */ '{ 1.3us, 0.6us, 1.6us, 0.6us, 0.3us, 0.1us, 0.6us, 0.6us},
/* 2 HS */ '{ 0.15us, 0.16us, 0.16us, 0.06us, 0.07us, 0.01us, 0.16us, 0.16us},
/* 3 CST */ '{cstScl_h*4, cstScl_h*2, cstScl_h*2, cstScl_h*2, cstScl_h*0, cstScl_h*2, cstScl_h*2, cstScl_h*2},
/* 4 FASTP */ '{ 0.5us, 0.26us, 0.5us, 0.26us, 0.3us, 0.05us, 0.26us, 0.66us}
};
endpackage : i2c_bfm_pkg
and the package is used as following
module i2c_bfm
(
input logic VDD,
inout logic SDAH,
inout logic SCLH,
input t_mode speed_mode,
input bit stop_on_err
);
...
t_timings _timings;
assign _timings = i2c_bfm_pkg::p_timings[int'(speed_mode)];
...
task i2c_start;
scl_out = 1;
sda_out = 0;
#_timings.tHD_STA;
scl_out = 0;
#(_timings.tLOW-_timings.tHD_DAT - _timings.tSU_DAT);
endtask: i2c_start
The issue is that delays are not applied properly, and si mulation shows they are always zero. All of this works perfectly using cadence IRUN simulator so I wonder what I am missing
I tried writing this differently - e.g. using variables, static variables, const in place of parameters but no joy …
Modelsim version is v6.6
Thanks much