A
Ann
Guest
Could you please explain what the following code does
// HOST Memory Array (written via serial interface)
reg [(REGWIDTH-1):0] HOSTmemory[(REGDEPTH-1):0];
// FPGA Memory Array (written directly by FPGA)
reg [(REGWIDTH-1):0] FPGAmemory[(REGDEPTH-1):0];
//
======================================================================
// Fetch READ value
assign memRD = (memRA[7] == HI)?
FPGAmemory[memRA[(REGLOG2DEPTH-1):0]]:
HOSTmemory[memRA[(REGLOG2DEPTH-1):0]];
//
======================================================================
// HOST Register Write Process
always @ (posedge clk)
begin
if ((memWS == HI) && (memWA[(REGWIDTH-1):REGLOG2DEPTH] == 0) )
HOSTmemory[memWA[(REGLOG2DEPTH-1):0]] <= memWD;
else
HOSTmemory[memWA[(REGLOG2DEPTH-1):0]] <=
HOSTmemory[memWA[(REGLOG2DEPTH-1):0]];
end
I dont understand the "Fetch Read Value" and the "HOST Register Write
Process".
// HOST Memory Array (written via serial interface)
reg [(REGWIDTH-1):0] HOSTmemory[(REGDEPTH-1):0];
// FPGA Memory Array (written directly by FPGA)
reg [(REGWIDTH-1):0] FPGAmemory[(REGDEPTH-1):0];
//
======================================================================
// Fetch READ value
assign memRD = (memRA[7] == HI)?
FPGAmemory[memRA[(REGLOG2DEPTH-1):0]]:
HOSTmemory[memRA[(REGLOG2DEPTH-1):0]];
//
======================================================================
// HOST Register Write Process
always @ (posedge clk)
begin
if ((memWS == HI) && (memWA[(REGWIDTH-1):REGLOG2DEPTH] == 0) )
HOSTmemory[memWA[(REGLOG2DEPTH-1):0]] <= memWD;
else
HOSTmemory[memWA[(REGLOG2DEPTH-1):0]] <=
HOSTmemory[memWA[(REGLOG2DEPTH-1):0]];
end
I dont understand the "Fetch Read Value" and the "HOST Register Write
Process".