I compiled the IP core library in Modelsim. The library from Xilinx is installed on my computer and I also created a ROM using the Xilinx tools. However when I simulate the IP core I find that fetching data from the ROM will delay the simulation by one clock cycle. How can I deal with it?
I don't want to write a second set of code, one for the simulation and one for downloading into the Spartan-3E. I program in Verilog and the following is the test bench for the IP core:
`timescale 1ps / 1ps
module InstrMem_tb ;
reg clka ;
reg [31:0] dina ;
reg [7:0] addra ;
wire [31:0] douta ;
reg [0:0] wea ;
InstrMem
DUT (
.dina (dina ) ,
.addra (addra ) ,
.douta (douta ) ,
.wea (wea ) ,
.clka (clka ) );
initial begin
wea = 0;
dina = 0;
addra = 0;
clka = 0;
end
always
#50 clka = ~clka;
endmodule
I can only fetch the data at address in the IP core named InstrMem at the second posedge.