diff options
Diffstat (limited to 'core_selector')
-rw-r--r-- | core_selector/src/rtl/math_selector.v | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/core_selector/src/rtl/math_selector.v b/core_selector/src/rtl/math_selector.v index 93fc8d2..b47a433 100644 --- a/core_selector/src/rtl/math_selector.v +++ b/core_selector/src/rtl/math_selector.v @@ -57,10 +57,10 @@ module math_selector //---------------------------------------------------------------- // Address Decoder //---------------------------------------------------------------- - // upper 6 bits specify core being addressed - wire [ 5: 0] addr_core_num = sys_eim_addr[13: 8]; - // lower 8 bits specify register offset in core - wire [ 7: 0] addr_core_reg = sys_eim_addr[ 7: 0]; + // upper 2 bits specify core being addressed + wire [ 1: 0] core_select = sys_eim_addr[13: 12]; + // lower 12 bits specify addresses within the selected core. + wire [11: 0] core_addr = sys_eim_addr[11: 0]; //---------------------------------------------------------------- @@ -73,18 +73,14 @@ module math_selector //---------------------------------------------------------------- // Core Address Table //---------------------------------------------------------------- - localparam CORE_ADDR_MODEXP = 6'd0; - localparam CORE_ADDR_MODEXP_MODULUS = 6'd1; - localparam CORE_ADDR_MODEXP_EXPONENT = 6'd2; - localparam CORE_ADDR_MODEXP_MESSAGE = 6'd3; - localparam CORE_ADDR_MODEXP_RESULT = 6'd4; + localparam CORE_MODEXP = 2'd0; //---------------------------------------------------------------- // MODEXP //---------------------------------------------------------------- `ifdef USE_CORE_MODEXP - wire enable_modexp = sys_ena && (addr_core_num >= CORE_ADDR_MODEXP) && (addr_core_num <= CORE_ADDR_MODEXP_RESULT); + wire enable_modexp = sys_ena && (core_select == CORE_MODEXP); wire [31: 0] read_data_modexp; modexp modexp_inst @@ -95,7 +91,7 @@ module math_selector .cs(enable_modexp & (sys_eim_rd | sys_eim_wr)), .we(sys_eim_wr), - .address(addr_core_reg), + .address(core_addr), .write_data(sys_write_data), .read_data(read_data_modexp) ); @@ -111,7 +107,7 @@ module math_selector always @* // `ifdef USE_CORE_MODEXP - if ((addr_core_num >= CORE_ADDR_MODEXP) && (addr_core_num <= CORE_ADDR_MODEXP_RESULT)) + if (core_select == CORE_MODEXP) begin sys_read_data_mux = read_data_modexp; end |