0

What is the equivalent syntax in Specman E for $readmemh(file,array) and similar system tasks and functions in System verilog?

I am working in converting the existing System verilog code into Specman E ,I have converted and implemented most of the concepts except few system methods like below .Please help me to implement methods like below in Specman E.

$readmemh(file_s,data_2d_i);//For converting SV code into Specman E
Sreejin TJ
  • 177
  • 12

1 Answers1

1

In the vr_ad Package there is an equivalent method. Assuming you have a vr_ad_mem object called data_2d_i, you can e.g. call

data_2d_i.readmemh(file_s,0,1000,0,1000);

To read addresses 0..1000 from that file into memory.

Example:

import vr_ad/e/vr_ad_top;
extend sys {
   mem: vr_ad_mem;
   keep mem.addressing_width_in_bytes == 1;
   keep mem.size == 1000;

   run() is also {
      var data_2d_l: list of byte;
      -- read first 16 bytes of mem-file and store the result in a list
      mem.readmemh("mem.txt", 0, 15, 0, 15);
      data_2d_l = mem.fetch(0, 16);
      print data_2d_l;
   };
};
Thorsten
  • 710
  • 8
  • 17
  • Thank you for the answer. For your information “data_2d_i” is not a struct but an array.I tried your suggestion but I got a compile error that “data_2d_i” is not a structure.Could you please elaborate how to implement it or suggest someother way with an example. – Sreejin TJ Jul 31 '19 at 04:58
  • @SreejinTJ In *e* there are no arrays. Maybe you mean a list? How did you declare it? – Yuri Tsoglin Jul 31 '19 at 05:34
  • Yes,Pardon me as I am new to E Lang. It is a list , I have declared it as “var data_2d_i : list of int “ – Sreejin TJ Jul 31 '19 at 05:47
  • @Thorsten .Thank you for your example. I am able to convert it now successfully. – Sreejin TJ Jul 31 '19 at 13:28