Why didn't you simplify your sim display to Z80 bus / HW_REGS only and click on the '
+ ' on the HW_REGS, zoom out, so you can see what's going on like I did?
SEE:
Also, why do you have 16regs only, I said to use 64 so you can at least go above 1 single 128bit wide WDATA all at address 16'h0000.
And again, why did you choose such poor test write data which wouldn't give you a clue to the actual problem, why not try these Z80 writes (inside Z80_cmd_stimulus.txt) to see what is going on:
@LOG_FILE Z80_cmd_stimulus_log.txt
@RESET
@CMD WM 0000 aa Write to memory address
@CMD WM 0001 11 Write to memory address
@CMD WM 0002 22 Write to memory address
@CMD WM 0003 33 Write to memory address
@CMD WM 0004 44 Write to memory address
@CMD WM 0005 55 Write to memory address
@CMD WM 0006 66 Write to memory address
@CMD WM 0007 77 Write to memory address
@CMD WM 0010 10 Write to memory address
@CMD WM 0020 20 Write to memory address
@CMD WM 0030 30 Write to memory address
@CMD WM 0040 40 Write to memory address
@CMD WM 0050 50 Write to memory address
@CMD WM 1110 BB Write to memory address
@CMD WM 2210 CC Write to memory address
@CMD WM 3310 DD Write to memory address
Now do not look at this line, see if you can figure out the problem by yourself first:
for (i = 0; i < PORT_CACHE_BITS/8; i = i + 1) if (valid_wr && WMASK[i ^ ENDIAN]) HW_REGS[( ADDR_IN[HW_REGS_SIZE-1:0] | (i^(PORT_CACHE_BITS/8-1)) )] <= DATA_IN[i*8+:8] ;Next, work out why the 'ENDIAN' only messes up then entire HW_REG system, why you need to get rid of it and why making new IO port with the same output reg renamed to 8bit and these new assigned output wires would help provide a better solution:
)(
input RESET,
input CLK,
input WE,
input [PORT_ADDR_SIZE-1:0] ADDR_IN,
input [PORT_CACHE_BITS-1:0] DATA_IN,
input [PORT_CACHE_BITS/8-1:0] WMASK,
output reg [ 7:0] HW_REGS_8bit[0:(2**HW_REGS_SIZE-1)]
output wire [ 15:0] HW_REGS_16bit[0:(2**HW_REGS_SIZE-1)]
output wire [ 31:0] HW_REGS_32bit[0:(2**HW_REGS_SIZE-1)]
);
You may also do the 'reset' values in the same way for defaults which are 8bit, 16bit, or 32bit.
(BTW: I do not have a "D:\tmp" drive. Also, isn't there a way to define the tmp folrder in the code instead of modifying Micron's ddr3.v source code + make that folder in the same folder as the work directory...)