diff --git a/system/config.v b/system/config.v index a475d49..02a6404 100644 --- a/system/config.v +++ b/system/config.v @@ -47,6 +47,11 @@ `define L1_CACHE_SIZE 4 +// Use high impedance instead of some other undefined value +// when a signal is invalid (for example a data port when a +// memory is not selected). This could be used for debug +//`define USE_HIGH_IMPEDANCE + /********** Internal **********/ `ifdef SYNTHESIS `undef DEBUG_REG_WRITES diff --git a/system/memory.v b/system/memory.v index b655a80..cc79d1b 100644 --- a/system/memory.v +++ b/system/memory.v @@ -53,10 +53,13 @@ initial begin end - -assign cpu_read_data[7:0] = !address[0:0] & !rd & !cs ? memory[address[ADDRESS_WIDTH-1:1]][15:8] : 8'hz; - -assign cpu_read_data[15:8] = !BHE & !rd & !cs ? memory[address[ADDRESS_WIDTH-1:1]][ 7:0] : 8'hz; +`ifdef USE_HIGH_IMPEDANCE +assign cpu_read_data[7:0] = !address[0:0] & !rd & !cs ? memory[address[ADDRESS_WIDTH-1:1]][15:8] : `16'hz; +assign cpu_read_data[15:8] = !BHE & !rd & !cs ? memory[address[ADDRESS_WIDTH-1:1]][ 7:0] : `16'hz; +`else +assign cpu_read_data[7:0] = memory[address[ADDRESS_WIDTH-1:1]][15:8]; +assign cpu_read_data[15:8] = memory[address[ADDRESS_WIDTH-1:1]][ 7:0]; +`endif always @(posedge clock) begin