UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer zxvc
Observer
704 Views
Registered: ‎12-31-2007

$readmemh doesn't support string as the filename

 

I find a problem of $readmemh in Vivado Simulator 2017.4. It doesn't support string as its filename argument, however, Synopsys VCS supports it. This is an example code to reproduce the problem:

`timescale 1ns / 1ps

module tb();
    reg [7:0] mem [2]; 
        
    string f = "1.txt";    
    initial begin
        // Work.
        //$readmemh("1.txt", mem);
        // Don't work.   
        $readmemh(f, mem);
        
        #100;
        $display("%h", mem[0]);
        $finish;
    end    
endmodule

Running behavioral simulation, Vivado Simulator 2017.4 prints "xx" (unknown). The attached v.zip contains the full Vivado project files.

 

0 Kudos
2 Replies
Voyager
Voyager
662 Views
Registered: ‎06-20-2017

Re: $readmemh doesn't support string as the filename

Try:

 

reg [6*8:0] f;// filename

f="1.txt";

$readmemh(f, mem);


 

Mike
0 Kudos
Highlighted
Observer zxvc
Observer
648 Views
Registered: ‎12-31-2007

Re: $readmemh doesn't support string as the filename


@maps-mpls wrote:

Try:

 

reg [6*8:0] f;// filename

f="1.txt";

$readmemh(f, mem);


 


Thanks for your workaround. However, I still hope Xilinx fixes this problem. So, no more person needs to spend time on finding this problem.

0 Kudos