Search code examples
system-verilogspecmansystem-verilog-dpi

System Verilog to Specman E


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

Solution

  • 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;
       };
    };