EDIT: I'm just wondering if this bit of HDL could be the cause of the problem? Lines 305-312 in GPU.sv:
assign Z80_WR_data[7] = data_en ? Z80_RD_data[7] : 1'bz;
assign Z80_WR_data[6] = data_en ? Z80_RD_data[6] : 1'bz;
assign Z80_WR_data[5] = data_en ? Z80_RD_data[5] : 1'bz;
assign Z80_WR_data[4] = data_en ? Z80_RD_data[4] : 1'bz;
assign Z80_WR_data[3] = data_en ? Z80_RD_data[3] : 1'bz;
assign Z80_WR_data[2] = data_en ? Z80_RD_data[2] : 1'bz;
assign Z80_WR_data[1] = data_en ? Z80_RD_data[1] : 1'bz;
assign Z80_WR_data[0] = data_en ? Z80_RD_data[0] : 1'bz;
I'm just trying to work out exactly what's going on here to ascertain if this is the cause of the problem. Would certainly explain the 0xFF's being written to GPU RAM if there's an issue with data_en...
Ok, what's going on here is if the signal 'data_en' is low, then the wires 'Z80_WR_data[ x ]' will be tristate.
If 'data_en' is high, then the wires 'Z80_WR_data[ x ]' will output the 'Z80_RD_data[ x ]'.
This means the the 'Z80_WR_data[ x ]' should be sent directly to your FPGA IO pins.
Now, to write data, this means you need to send the IO pins to the Z80 bridge,,,, wait
This does sound fishy as the line should really read:
assign Z80_data[7] = data_en ? Z80_RD_data[7] : 1'bz;
assign Z80_data[6] = data_en ? Z80_RD_data[6] : 1'bz;
assign Z80_data[5] = data_en ? Z80_RD_data[5] : 1'bz;
assign Z80_data[4] = data_en ? Z80_RD_data[4] : 1'bz;
assign Z80_data[3] = data_en ? Z80_RD_data[3] : 1'bz;
assign Z80_data[2] = data_en ? Z80_RD_data[2] : 1'bz;
assign Z80_data[1] = data_en ? Z80_RD_data[1] : 1'bz;
assign Z80_data[0] = data_en ? Z80_RD_data[0] : 1'bz;
Or, make your life easier:
assign Z80_data = data_en ? Z80_RD_data : 8'bzzzzzzzz;
And for the other direction,
However, you will need to kill line 684:
assign Z80_data = Z80_WR_data;
And change line 243 in 'Z80_bridge_v2.sv' from:
.Z80_wData(Z80_WR_data),
to:
.Z80_wData(Z80_data),
This ties the Z80_data pins directly to your 'Z80_bridge_v2.sv' Z80 data input.
Remember, the GPU.sv I gave you was generated automatically by Quartus from the original GPU.bdf, hence the reason I said you need to go through it, compare it to your original .bdf and relable some of the wires to make more sense.