diff --git a/core/binary_occupancy.sv b/core/binary_occupancy.sv deleted file mode 100755 index 261eafb..0000000 --- a/core/binary_occupancy.sv +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright © 2017-2019 Eric Matthews, Lesley Shannon - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Initial code developed under the supervision of Dr. Lesley Shannon, - * Reconfigurable Computing Lab, Simon Fraser University. - * - * Author(s): - * Eric Matthews - */ - -module binary_occupancy - - import cva5_config::*; - import cva5_types::*; - - #(parameter DEPTH = 4) - ( - input logic clk, - input logic rst, - input logic push, - input logic pop, - output logic almost_full, - output logic full, - output logic empty, - output logic almost_empty, - output logic valid - ); - - logic[$clog2(DEPTH)-1:0] count; - - //Occupancy Tracking - always_ff @ (posedge clk) begin - if (rst) - count <= 0; - else begin - case ({push, pop}) - 2'b10: count <= count + 1; - 2'b01: count <= count - 1; - default : count <= count; - endcase - end - end - - always_ff @ (posedge clk) begin - if (rst) - valid <= 0; - else begin - case ({push, pop}) - 2'b10: valid <= 1; - 2'b01: valid <= !(count == 1); - default : valid <= valid; - endcase - end - end - - // always_ff @ (posedge clk) begin - // if (rst) - // full <= 0; - // else begin - // case ({push, pop}) - // 2'b10: full <= (count == DEPTH-2); - // 2'b01: full <= 0; - // default : full <= full; - // endcase - // end - // end - - // always_ff @ (posedge clk) begin - // if (rst) - // almost_full <= 0; - // else begin - // case ({push, pop}) - // 2'b10: almost_full <= (count == DEPTH-3); - // 2'b01: almost_full <= (count == DEPTH-1); - // default : almost_full <= almost_full; - // endcase - // end - // end - - // always_ff @ (posedge clk) begin - // if (rst) - // almost_empty <= 0; - // else begin - // case ({push, pop}) - // 2'b10: almost_empty <=(count == 0); - // 2'b01: almost_empty <= (count == 2); - // default : almost_empty <= almost_empty; - // endcase - // end - // end - - assign empty = ~valid; - - //////////////////////////////////////////////////// - //Assertions - always_ff @ (posedge clk) begin - assert (!(~rst & full & push)) else $error("overflow"); - assert (!(~rst & empty & pop)) else $error("underflow"); - end - -endmodule - - diff --git a/core/branch_predictor_ram.sv b/core/branch_predictor_ram.sv deleted file mode 100644 index d494e9b..0000000 --- a/core/branch_predictor_ram.sv +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright © 2019 Eric Matthews, Lesley Shannon - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Initial code developed under the supervision of Dr. Lesley Shannon, - * Reconfigurable Computing Lab, Simon Fraser University. - * - * Author(s): - * Eric Matthews - */ - -module branch_predictor_ram - - import cva5_config::*; - import cva5_types::*; - - #( - parameter C_DATA_WIDTH = 20, - parameter C_DEPTH = 512 - ) - ( - input logic clk, - input logic rst, - input logic [$clog2(C_DEPTH)-1:0] write_addr, - input logic write_en, - input logic [$clog2(C_DEPTH)-1:0] read_addr, - input logic read_en, - input logic [C_DATA_WIDTH-1:0] write_data, - output logic [C_DATA_WIDTH-1:0] read_data - ); - (* ram_style = "block" *)logic [C_DATA_WIDTH-1:0] branch_ram [C_DEPTH-1:0]; - //////////////////////////////////////////////////// - //Implementation - initial branch_ram = '{default: 0}; - always_ff @(posedge clk) begin - if (write_en) - branch_ram[write_addr] <= write_data; - end - always_ff @(posedge clk) begin - if (read_en) - read_data <= branch_ram[read_addr]; - end - //////////////////////////////////////////////////// - //End of Implementation - //////////////////////////////////////////////////// - - //////////////////////////////////////////////////// - //Assertions - - //////////////////////////////////////////////////// - //Trace Interface - -endmodule diff --git a/core/byte_en_BRAM.sv b/core/common_components/byte_en_bram.sv similarity index 98% rename from core/byte_en_BRAM.sv rename to core/common_components/byte_en_bram.sv index 94d1bbb..660ae79 100755 --- a/core/byte_en_BRAM.sv +++ b/core/common_components/byte_en_bram.sv @@ -22,7 +22,7 @@ -module byte_en_BRAM +module byte_en_bram import cva5_config::*; import cva5_types::*; diff --git a/core/clz.sv b/core/common_components/clz.sv similarity index 100% rename from core/clz.sv rename to core/common_components/clz.sv diff --git a/core/cva5_fifo.sv b/core/common_components/cva5_fifo.sv similarity index 96% rename from core/cva5_fifo.sv rename to core/common_components/cva5_fifo.sv index 3ee151a..f202cb1 100755 --- a/core/cva5_fifo.sv +++ b/core/common_components/cva5_fifo.sv @@ -32,7 +32,7 @@ module cva5_fifo import cva5_types::*; #( - parameter DATA_WIDTH = 70, + parameter type DATA_TYPE = logic, parameter FIFO_DEPTH = 4 ) ( @@ -63,7 +63,7 @@ module cva5_fifo //connected as a shift reg for the same resources as a LUTRAM FIFO //but with better timing else if (FIFO_DEPTH == 2) begin : gen_width_two - logic [DATA_WIDTH-1:0] shift_reg [FIFO_DEPTH]; + DATA_TYPE shift_reg [FIFO_DEPTH]; logic [LOG2_FIFO_DEPTH:0] inflight_count; //////////////////////////////////////////////////// //Occupancy Tracking @@ -115,7 +115,7 @@ module cva5_fifo .value(write_index) ); //Force FIFO depth to next power of 2 - lutram_1w_1r #(.WIDTH(DATA_WIDTH), .DEPTH(2**LOG2_FIFO_DEPTH)) + lutram_1w_1r #(.DATA_TYPE(DATA_TYPE), .DEPTH(2**LOG2_FIFO_DEPTH)) write_port ( .clk(clk), .waddr(write_index), diff --git a/core/cycler.sv b/core/common_components/cycler.sv similarity index 100% rename from core/cycler.sv rename to core/common_components/cycler.sv diff --git a/core/tag_bank.sv b/core/common_components/dual_port_bram.sv old mode 100755 new mode 100644 similarity index 64% rename from core/tag_bank.sv rename to core/common_components/dual_port_bram.sv index 3afc013..61da14a --- a/core/tag_bank.sv +++ b/core/common_components/dual_port_bram.sv @@ -1,5 +1,5 @@ /* - * Copyright © 2017-2020 Eric Matthews, Lesley Shannon + * Copyright © 2023 Eric Matthews, Lesley Shannon * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,46 +20,51 @@ * Eric Matthews */ -module tag_bank - #( + + +module dual_port_bram + + import cva5_config::*; + import cva5_types::*; + import riscv_types::*; + + #( parameter WIDTH = 32, - parameter LINES = 512 + parameter LINES = 4096 ) ( input logic clk, - input logic rst, - input logic[$clog2(LINES)-1:0] addr_a, - input logic[$clog2(LINES)-1:0] addr_b, input logic en_a, - input logic en_b, input logic wen_a, + input logic[$clog2(LINES)-1:0] addr_a, + input logic[WIDTH-1:0] data_in_a, + output logic[WIDTH-1:0] data_out_a, + + input logic en_b, input logic wen_b, - input logic [WIDTH-1:0] data_in_a, - input logic [WIDTH-1:0] data_in_b, - output logic [WIDTH-1:0] data_out_a, - output logic [WIDTH-1:0] data_out_b + input logic[$clog2(LINES)-1:0] addr_b, + input logic[WIDTH-1:0] data_in_b, + output logic[WIDTH-1:0] data_out_b ); - (* ram_style = "block", ramstyle = "no_rw_check" *) logic [WIDTH-1:0] tag_entry [LINES]; - initial tag_entry = '{default: 0}; + (* ram_style = "block", ramstyle = "no_rw_check" *) logic [WIDTH-1:0] ram [LINES]; + initial ram = '{default: 0}; always_ff @ (posedge clk) begin if (en_a) begin if (wen_a) - tag_entry[addr_a] <= data_in_a; - else - data_out_a <= tag_entry[addr_a]; + ram[addr_a] <= data_in_a; + data_out_a <= ram[addr_a]; end end always_ff @ (posedge clk) begin if (en_b) begin if (wen_b) - tag_entry[addr_b] <= data_in_b; - else - data_out_b <= tag_entry[addr_b]; + ram[addr_b] <= data_in_b; + data_out_b <= ram[addr_b]; end end -endmodule \ No newline at end of file +endmodule diff --git a/core/lfsr.sv b/core/common_components/lfsr.sv similarity index 100% rename from core/lfsr.sv rename to core/common_components/lfsr.sv diff --git a/core/lutrams/lutram_1w_1r.sv b/core/common_components/lutram_1w_1r.sv similarity index 88% rename from core/lutrams/lutram_1w_1r.sv rename to core/common_components/lutram_1w_1r.sv index d19454c..c05e9cb 100644 --- a/core/lutrams/lutram_1w_1r.sv +++ b/core/common_components/lutram_1w_1r.sv @@ -22,7 +22,7 @@ module lutram_1w_1r #( - parameter WIDTH = 32, + parameter type DATA_TYPE = logic, parameter DEPTH = 32 ) ( @@ -32,11 +32,11 @@ module lutram_1w_1r input logic[$clog2(DEPTH)-1:0] raddr, input logic ram_write, - input logic[WIDTH-1:0] new_ram_data, - output logic[WIDTH-1:0] ram_data_out + input DATA_TYPE new_ram_data, + output DATA_TYPE ram_data_out ); - (* ramstyle = "MLAB, no_rw_check", ram_style = "distributed" *) logic [WIDTH-1:0] ram [DEPTH-1:0]; + (* ramstyle = "MLAB, no_rw_check", ram_style = "distributed" *) logic [$bits(DATA_TYPE)-1:0] ram [DEPTH-1:0]; initial ram = '{default: 0}; always_ff @ (posedge clk) begin diff --git a/core/lutrams/lutram_1w_mr.sv b/core/common_components/lutram_1w_mr.sv similarity index 89% rename from core/lutrams/lutram_1w_mr.sv rename to core/common_components/lutram_1w_mr.sv index 4533013..b5b2182 100644 --- a/core/lutrams/lutram_1w_mr.sv +++ b/core/common_components/lutram_1w_mr.sv @@ -25,7 +25,7 @@ module lutram_1w_mr import cva5_config::*; #( - parameter WIDTH = 32, + parameter type DATA_TYPE = logic, parameter DEPTH = 32, parameter NUM_READ_PORTS = 2 ) @@ -36,14 +36,14 @@ module lutram_1w_mr input logic[$clog2(DEPTH)-1:0] raddr [NUM_READ_PORTS], input logic ram_write, - input logic[WIDTH-1:0] new_ram_data, - output logic[WIDTH-1:0] ram_data_out [NUM_READ_PORTS] + input DATA_TYPE new_ram_data, + output DATA_TYPE ram_data_out [NUM_READ_PORTS] ); //For Xilinx with their wider selection of LUTRAMs, infer a multi-read port LUTRAM //For Intel, build the multi-read port ram from simple-dual-port LUTRAMs generate if (FPGA_VENDOR == XILINX) begin : xilinx_gen - logic [WIDTH-1:0] ram [DEPTH-1:0]; + logic [$bits(DATA_TYPE)-1:0] ram [DEPTH-1:0]; initial ram = '{default: 0}; always_ff @ (posedge clk) begin @@ -61,7 +61,7 @@ end else if (FPGA_VENDOR == INTEL) begin : intel_gen for (genvar i = 0; i < NUM_READ_PORTS; i++) begin : lutrams - lutram_1w_1r #(.WIDTH(WIDTH), .DEPTH(DEPTH)) + lutram_1w_1r #(.DATA_TYPE(DATA_TYPE), .DEPTH(DEPTH)) write_port ( .clk(clk), .waddr(waddr), diff --git a/core/one_hot_to_integer.sv b/core/common_components/one_hot_to_integer.sv similarity index 100% rename from core/one_hot_to_integer.sv rename to core/common_components/one_hot_to_integer.sv diff --git a/core/priority_encoder.sv b/core/common_components/priority_encoder.sv similarity index 100% rename from core/priority_encoder.sv rename to core/common_components/priority_encoder.sv diff --git a/core/set_clr_reg_with_rst.sv b/core/common_components/set_clr_reg_with_rst.sv similarity index 100% rename from core/set_clr_reg_with_rst.sv rename to core/common_components/set_clr_reg_with_rst.sv diff --git a/core/toggle_memory.sv b/core/common_components/toggle_memory.sv similarity index 98% rename from core/toggle_memory.sv rename to core/common_components/toggle_memory.sv index b6793c4..bf20db9 100644 --- a/core/toggle_memory.sv +++ b/core/common_components/toggle_memory.sv @@ -51,7 +51,7 @@ module toggle_memory assign new_ram_data = toggle ^ _read_data[0]; lutram_1w_mr #( - .WIDTH(1), + .DATA_TYPE(logic), .DEPTH(DEPTH), .NUM_READ_PORTS(NUM_READ_PORTS+1) ) diff --git a/core/toggle_memory_set.sv b/core/common_components/toggle_memory_set.sv similarity index 100% rename from core/toggle_memory_set.sv rename to core/common_components/toggle_memory_set.sv diff --git a/core/intel/intel_byte_enable_ram.sv b/core/common_components/vendor_support/intel/intel_byte_enable_ram.sv similarity index 100% rename from core/intel/intel_byte_enable_ram.sv rename to core/common_components/vendor_support/intel/intel_byte_enable_ram.sv diff --git a/core/xilinx/cva5_wrapper_xilinx.sv b/core/common_components/vendor_support/xilinx/cva5_wrapper_xilinx.sv similarity index 100% rename from core/xilinx/cva5_wrapper_xilinx.sv rename to core/common_components/vendor_support/xilinx/cva5_wrapper_xilinx.sv diff --git a/core/xilinx/xilinx_byte_enable_ram.sv b/core/common_components/vendor_support/xilinx/xilinx_byte_enable_ram.sv similarity index 100% rename from core/xilinx/xilinx_byte_enable_ram.sv rename to core/common_components/vendor_support/xilinx/xilinx_byte_enable_ram.sv diff --git a/core/cva5.sv b/core/cva5.sv index f482df4..5287c86 100755 --- a/core/cva5.sv +++ b/core/cva5.sv @@ -51,51 +51,6 @@ module cva5 input interrupt_t m_interrupt ); - //////////////////////////////////////////////////// - //Unit ID Assignment - //Generate Issue IDs based on configuration options - //Then assigned to a struct for ease in passing to sub modules - - //Units with writeback - localparam int unsigned ALU_UNIT_ID = 32'd0; - localparam int unsigned LS_UNIT_ID = 32'd1; - localparam int unsigned CSR_UNIT_ID = LS_UNIT_ID + int'(CONFIG.INCLUDE_CSRS); - localparam int unsigned MUL_UNIT_ID = CSR_UNIT_ID + int'(CONFIG.INCLUDE_MUL); - localparam int unsigned DIV_UNIT_ID = MUL_UNIT_ID + int'(CONFIG.INCLUDE_DIV); - localparam int unsigned CUSTOM_UNIT_ID = DIV_UNIT_ID + int'(CONFIG.INCLUDE_CUSTOM); - //Non-writeback units - localparam int unsigned BRANCH_UNIT_ID = CUSTOM_UNIT_ID + 1; - localparam int unsigned IEC_UNIT_ID = BRANCH_UNIT_ID + 1; - - //Total number of units - localparam int unsigned NUM_UNITS = IEC_UNIT_ID + 1; - - localparam unit_id_param_t UNIT_IDS = '{ - ALU : ALU_UNIT_ID, - LS : LS_UNIT_ID, - CSR : CSR_UNIT_ID, - MUL : MUL_UNIT_ID, - DIV : DIV_UNIT_ID, - CUSTOM : CUSTOM_UNIT_ID, - BR : BRANCH_UNIT_ID, - IEC : IEC_UNIT_ID - }; - - //////////////////////////////////////////////////// - //Writeback Port Assignment - // - localparam int unsigned NUM_WB_UNITS_GROUP_1 = 1;//ALU - localparam int unsigned ALU_UNIT_WB1_ID = 32'd0; - - localparam int unsigned NUM_WB_UNITS_GROUP_2 = 1;//LS - localparam int unsigned LS_UNIT_WB2_ID = 32'd0; - - localparam int unsigned NUM_WB_UNITS_GROUP_3 = int'(CONFIG.INCLUDE_CSRS) + int'(CONFIG.INCLUDE_MUL) + int'(CONFIG.INCLUDE_DIV) + int'(CONFIG.INCLUDE_CUSTOM); - localparam int unsigned DIV_UNIT_WB3_ID = 32'd0; - localparam int unsigned MUL_UNIT_WB3_ID = 32'd0 + int'(CONFIG.INCLUDE_DIV); - localparam int unsigned CSR_UNIT_WB3_ID = 32'd0 + int'(CONFIG.INCLUDE_MUL)+ int'(CONFIG.INCLUDE_DIV); - localparam int unsigned CUSTOM_UNIT_WB3_ID = 32'd0 + int'(CONFIG.INCLUDE_MUL)+ int'(CONFIG.INCLUDE_DIV) + int'(CONFIG.INCLUDE_CSRS); - //////////////////////////////////////////////////// //Connecting Signals l1_arbiter_request_interface l1_request[L1_CONNECTIONS-1:0](); @@ -115,21 +70,17 @@ module cva5 issue_packet_t issue; register_file_issue_interface #(.NUM_WB_GROUPS(CONFIG.NUM_WB_GROUPS)) rf_issue(); - logic [NUM_UNITS-1:0] unit_needed; - logic [NUM_UNITS-1:0][REGFILE_READ_PORTS-1:0] unit_uses_rs; - logic [NUM_UNITS-1:0] unit_uses_rd; + logic [MAX_NUM_UNITS-1:0] unit_needed; + logic [MAX_NUM_UNITS-1:0][REGFILE_READ_PORTS-1:0] unit_uses_rs; + logic [MAX_NUM_UNITS-1:0] unit_uses_rd; logic [31:0] constant_alu; - unit_issue_interface unit_issue [NUM_UNITS-1:0](); + unit_issue_interface unit_issue [MAX_NUM_UNITS-1:0](); exception_packet_t ls_exception; logic ls_exception_is_store; - unit_writeback_interface unit_wb1 [NUM_WB_UNITS_GROUP_1](); - unit_writeback_interface unit_wb2 [NUM_WB_UNITS_GROUP_2](); - unit_writeback_interface unit_wb3 [NUM_WB_UNITS_GROUP_3 == 0 ? 1 : NUM_WB_UNITS_GROUP_3](); - mmu_interface immu(); mmu_interface dmmu(); @@ -170,6 +121,7 @@ module cva5 logic retire_port_valid [RETIRE_PORTS]; logic [LOG2_RETIRE_PORTS : 0] retire_count; //Writeback + unit_writeback_interface unit_wb [MAX_NUM_UNITS](); wb_packet_t wb_packet [CONFIG.NUM_WB_GROUPS]; phys_addr_t wb_phys_addr [CONFIG.NUM_WB_GROUPS]; //Exception @@ -286,7 +238,6 @@ module cva5 .iwishbone (iwishbone), .icache_on ('1), .tlb (itlb), - .tlb_on (tlb_on), .l1_request (l1_request[L1_ICACHE_ID]), .l1_response (l1_response[L1_ICACHE_ID]), .exception (1'b0) @@ -357,10 +308,8 @@ module cva5 //////////////////////////////////////////////////// //Decode/Issue decode_and_issue #( - .CONFIG (CONFIG), - .NUM_UNITS (NUM_UNITS), - .UNIT_IDS (UNIT_IDS) - ) + .CONFIG (CONFIG) + ) decode_and_issue_block ( .clk (clk), .rst (rst), @@ -419,12 +368,12 @@ module cva5 .decode_stage (decode), .issue_stage (issue), .issue_stage_ready (issue_stage_ready), - .unit_needed (unit_needed[UNIT_IDS.BR]), - .uses_rs (unit_uses_rs[UNIT_IDS.BR]), - .uses_rd (unit_uses_rd[UNIT_IDS.BR]), + .unit_needed (unit_needed[BR_ID]), + .uses_rs (unit_uses_rs[BR_ID]), + .uses_rd (unit_uses_rd[BR_ID]), .rf (rf_issue.data), .constant_alu (constant_alu), - .issue (unit_issue[UNIT_IDS.BR]), + .issue (unit_issue[BR_ID]), .br_results (br_results), .branch_flush (branch_flush), .exception (exception[BR_EXCEPTION]) @@ -437,14 +386,14 @@ module cva5 .decode_stage (decode), .issue_stage (issue), .issue_stage_ready (issue_stage_ready), - .unit_needed (unit_needed[UNIT_IDS.ALU]), - .uses_rs (unit_uses_rs[UNIT_IDS.ALU]), - .uses_rd (unit_uses_rd[UNIT_IDS.ALU]), + .unit_needed (unit_needed[ALU_ID]), + .uses_rs (unit_uses_rs[ALU_ID]), + .uses_rd (unit_uses_rd[ALU_ID]), .rf (rf_issue.data), .constant_alu (constant_alu), .issue_rs_addr (issue_rs_addr), - .issue (unit_issue[UNIT_IDS.ALU]), - .wb (unit_wb1[ALU_UNIT_WB1_ID]) + .issue (unit_issue[ALU_ID]), + .wb (unit_wb[ALU_ID]) ); load_store_unit #(.CONFIG(CONFIG)) @@ -455,16 +404,16 @@ module cva5 .decode_stage (decode), .issue_stage (issue), .issue_stage_ready (issue_stage_ready), - .unit_needed (unit_needed[UNIT_IDS.LS]), - .uses_rs (unit_uses_rs[UNIT_IDS.LS]), - .uses_rd (unit_uses_rd[UNIT_IDS.LS]), + .unit_needed (unit_needed[LS_ID]), + .uses_rs (unit_uses_rs[LS_ID]), + .uses_rd (unit_uses_rd[LS_ID]), .decode_is_store (decode_is_store), .instruction_issued_with_rd (instruction_issued_with_rd), .issue_rs_addr (issue_rs_addr), .issue_rd_wb_group (issue_rd_wb_group), .rs2_inuse (rf_issue.inuse[RS2]), .rf (rf_issue.data), - .issue (unit_issue[UNIT_IDS.LS]), + .issue (unit_issue[LS_ID]), .dcache_on (1'b1), .clear_reservation (1'b0), .tlb (dtlb), @@ -481,7 +430,7 @@ module cva5 .store_retire (store_retire), .exception (exception[LS_EXCEPTION]), .load_store_status(load_store_status), - .wb (unit_wb2[LS_UNIT_WB2_ID]) + .wb (unit_wb[LS_ID]) ); generate if (CONFIG.INCLUDE_S_MODE) begin : gen_dtlb_dmmu @@ -512,7 +461,7 @@ module cva5 end endgenerate - generate if (CONFIG.INCLUDE_CSRS) begin : gen_csrs + generate if (CONFIG.INCLUDE_UNIT.CSR) begin : gen_csrs csr_unit # (.CONFIG(CONFIG)) csr_unit_block ( .clk(clk), @@ -521,12 +470,12 @@ module cva5 .issue_stage (issue), .issue_stage_ready (issue_stage_ready), .issue_rs_addr (issue_rs_addr), - .unit_needed (unit_needed[UNIT_IDS.CSR]), - .uses_rs (unit_uses_rs[UNIT_IDS.CSR]), - .uses_rd (unit_uses_rd[UNIT_IDS.CSR]), + .unit_needed (unit_needed[CSR_ID]), + .uses_rs (unit_uses_rs[CSR_ID]), + .uses_rd (unit_uses_rd[CSR_ID]), .rf (rf_issue.data), - .issue (unit_issue[UNIT_IDS.CSR]), - .wb (unit_wb3[CSR_UNIT_WB3_ID]), + .issue (unit_issue[CSR_ID]), + .wb (unit_wb[CSR_ID]), .current_privilege(current_privilege), .interrupt_taken(interrupt_taken), .interrupt_pending(interrupt_pending), @@ -555,12 +504,12 @@ module cva5 .decode_stage (decode), .issue_stage (issue), .issue_stage_ready (issue_stage_ready), - .unit_needed (unit_needed[UNIT_IDS.IEC]), - .uses_rs (unit_uses_rs[UNIT_IDS.IEC]), - .uses_rd (unit_uses_rd[UNIT_IDS.IEC]), + .unit_needed (unit_needed[IEC_ID]), + .uses_rs (unit_uses_rs[IEC_ID]), + .uses_rd (unit_uses_rd[IEC_ID]), .constant_alu (constant_alu), .rf (rf_issue.data), - .issue (unit_issue[UNIT_IDS.IEC]), + .issue (unit_issue[IEC_ID]), .branch_flush (branch_flush), .exception (exception), .exception_target_pc (exception_target_pc), @@ -580,23 +529,23 @@ module cva5 .post_issue_count (post_issue_count) ); - generate if (CONFIG.INCLUDE_MUL) begin : gen_mul + generate if (CONFIG.INCLUDE_UNIT.MUL) begin : gen_mul mul_unit mul_unit_block ( .clk (clk), .rst (rst), .decode_stage (decode), .issue_stage (issue), .issue_stage_ready (issue_stage_ready), - .unit_needed (unit_needed[UNIT_IDS.MUL]), - .uses_rs (unit_uses_rs[UNIT_IDS.MUL]), - .uses_rd (unit_uses_rd[UNIT_IDS.MUL]), + .unit_needed (unit_needed[MUL_ID]), + .uses_rs (unit_uses_rs[MUL_ID]), + .uses_rd (unit_uses_rd[MUL_ID]), .rf (rf_issue.data), - .issue (unit_issue[UNIT_IDS.MUL]), - .wb (unit_wb3[MUL_UNIT_WB3_ID]) + .issue (unit_issue[MUL_ID]), + .wb (unit_wb[MUL_ID]) ); end endgenerate - generate if (CONFIG.INCLUDE_DIV) begin : gen_div + generate if (CONFIG.INCLUDE_UNIT.DIV) begin : gen_div div_unit div_unit_block ( .clk (clk), .rst (rst), @@ -606,69 +555,48 @@ module cva5 .issue_stage (issue), .issue_stage_ready (issue_stage_ready), .issue_rs_addr (issue_rs_addr), - .unit_needed (unit_needed[UNIT_IDS.DIV]), - .uses_rs (unit_uses_rs[UNIT_IDS.DIV]), - .uses_rd (unit_uses_rd[UNIT_IDS.DIV]), + .unit_needed (unit_needed[DIV_ID]), + .uses_rs (unit_uses_rs[DIV_ID]), + .uses_rd (unit_uses_rd[DIV_ID]), .rf (rf_issue.data), - .issue (unit_issue[UNIT_IDS.DIV]), - .wb (unit_wb3[DIV_UNIT_WB3_ID]) + .issue (unit_issue[DIV_ID]), + .wb (unit_wb[DIV_ID]) ); end endgenerate - generate if (CONFIG.INCLUDE_CUSTOM) begin : gen_custom + generate if (CONFIG.INCLUDE_UNIT.CUSTOM) begin : gen_custom custom_unit custom_unit_block ( .clk (clk), .rst (rst), .decode_stage (decode), - .unit_needed (unit_needed[UNIT_IDS.CUSTOM]), - .uses_rs (unit_uses_rs[UNIT_IDS.CUSTOM]), - .uses_rd (unit_uses_rd[UNIT_IDS.CUSTOM]), + .unit_needed (unit_needed[CUSTOM_ID]), + .uses_rs (unit_uses_rs[CUSTOM_ID]), + .uses_rd (unit_uses_rd[CUSTOM_ID]), .issue_stage (issue), .issue_stage_ready (issue_stage_ready), .rf (rf_issue.data), - .issue (unit_issue[UNIT_IDS.CUSTOM]), - .wb (unit_wb3[CUSTOM_UNIT_WB3_ID]) + .issue (unit_issue[CUSTOM_ID]), + .wb (unit_wb[CUSTOM_ID]) ); end endgenerate //////////////////////////////////////////////////// //Writeback - //First writeback port: ALU - //Second writeback port: LS, CSR, [MUL], [DIV] - writeback #( - .CONFIG (CONFIG), - .NUM_WB_UNITS (NUM_WB_UNITS_GROUP_1) - ) - writeback_block1 ( - .clk (clk), - .rst (rst), - .wb_packet (wb_packet[0]), - .unit_wb (unit_wb1) - ); - writeback #( - .CONFIG (CONFIG), - .NUM_WB_UNITS (NUM_WB_UNITS_GROUP_2) - ) - writeback_block2 ( - .clk (clk), - .rst (rst), - .wb_packet (wb_packet[1]), - .unit_wb (unit_wb2) - ); - - generate if (NUM_WB_UNITS_GROUP_3 > 0) begin : gen_wb3 + generate for (genvar i = 0; i < CONFIG.NUM_WB_GROUPS; i++) begin : gen_wb writeback #( .CONFIG (CONFIG), - .NUM_WB_UNITS (NUM_WB_UNITS_GROUP_3) + .NUM_WB_UNITS (get_num_wb_units(CONFIG.WB_GROUP[i])), + .WB_INDEX (CONFIG.WB_GROUP[i]) ) - writeback_block3 ( + writeback_block ( .clk (clk), .rst (rst), - .wb_packet (wb_packet[2]), - .unit_wb (unit_wb3) + .wb_packet (wb_packet[i]), + .unit_wb (unit_wb) ); end endgenerate + //////////////////////////////////////////////////// //End of Implementation //////////////////////////////////////////////////// diff --git a/core/ddata_bank.sv b/core/ddata_bank.sv deleted file mode 100755 index 6f3db48..0000000 --- a/core/ddata_bank.sv +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright © 2017 Eric Matthews, Lesley Shannon - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Initial code developed under the supervision of Dr. Lesley Shannon, - * Reconfigurable Computing Lab, Simon Fraser University. - * - * Author(s): - * Eric Matthews - */ - -module ddata_bank - - import cva5_config::*; - import cva5_types::*; - - #( - parameter LINES = 2048 - ) - ( - input logic clk, - input logic[$clog2(LINES)-1:0] addr_a, - input logic en_a, - input logic[3:0] be_a, - input logic[31:0] data_in_a, - output logic[31:0] data_out_a, - - //write only port - input logic[$clog2(LINES)-1:0] addr_b, - input logic en_b, - input logic[31:0] data_in_b - ); - - byte_en_BRAM #(LINES, "", 0) ram_block (.*, .be_b({4{en_b}}), .data_out_b()); - -endmodule diff --git a/core/decode_and_issue.sv b/core/decode_and_issue.sv index 1d32be2..e3be1e5 100755 --- a/core/decode_and_issue.sv +++ b/core/decode_and_issue.sv @@ -29,9 +29,7 @@ module decode_and_issue import opcodes::*; # ( - parameter cpu_config_t CONFIG = EXAMPLE_CONFIG, - parameter NUM_UNITS = 7, - parameter unit_id_param_t UNIT_IDS = EXAMPLE_UNIT_IDS + parameter cpu_config_t CONFIG = EXAMPLE_CONFIG ) ( @@ -47,9 +45,9 @@ module decode_and_issue //Renamer renamer_interface.decode renamer, - input logic [NUM_UNITS-1:0] unit_needed, - input logic [NUM_UNITS-1:0][REGFILE_READ_PORTS-1:0] unit_uses_rs, - input logic [NUM_UNITS-1:0] unit_uses_rd, + input logic [MAX_NUM_UNITS-1:0] unit_needed, + input logic [MAX_NUM_UNITS-1:0][REGFILE_READ_PORTS-1:0] unit_uses_rs, + input logic [MAX_NUM_UNITS-1:0] unit_uses_rd, output logic decode_uses_rd, output rs_addr_t decode_rd_addr, @@ -70,7 +68,7 @@ module decode_and_issue output logic [31:0] constant_alu, - unit_issue_interface.decode unit_issue [NUM_UNITS-1:0], + unit_issue_interface.decode unit_issue [MAX_NUM_UNITS-1:0], input gc_outputs_t gc, input logic [1:0] current_privilege, @@ -81,27 +79,21 @@ module decode_and_issue common_instruction_t decode_instruction;//rs1_addr, rs2_addr, fn3, fn7, rd_addr, upper/lower opcode - logic uses_rs [REGFILE_READ_PORTS]; - logic uses_rd; + logic decode_uses_rs [REGFILE_READ_PORTS]; rs_addr_t decode_rs_addr [REGFILE_READ_PORTS]; + logic [$clog2(CONFIG.NUM_WB_GROUPS)-1:0] decode_wb_group; - logic issue_valid; - logic operands_ready; - - logic [NUM_UNITS-1:0] unit_needed_issue_stage; - logic [NUM_UNITS-1:0] unit_ready; - logic [NUM_UNITS-1:0] issue_ready; - logic [NUM_UNITS-1:0] issue_to; + logic issue_hold; + logic [REGFILE_READ_PORTS-1:0] operand_ready; + logic [MAX_NUM_UNITS-1:0] unit_needed_issue_stage; + logic [MAX_NUM_UNITS-1:0] issue_to; logic [$clog2(CONFIG.NUM_WB_GROUPS)-1:0] issue_rs_wb_group [REGFILE_READ_PORTS]; logic issue_uses_rs [REGFILE_READ_PORTS]; logic pre_issue_exception_pending; logic illegal_instruction_pattern; - logic illegal_instruction_pattern_r; - - logic [REGFILE_READ_PORTS-1:0] rs_conflict; genvar i; //////////////////////////////////////////////////// @@ -109,8 +101,8 @@ module decode_and_issue //Can move data into issue stage if: // there is no instruction currently in the issue stage, or - // an instruction could issue (issue_flush, issue_hold and whether the instruction is valid are not needed in this check) - assign issue_stage_ready = ((~issue.stage_valid) | (issue_valid & |issue_ready)) & ~gc.issue_hold; + // an instruction could issue (ignoring gc.fetch_flush) + assign issue_stage_ready = (~issue.stage_valid) | (|issue_to); assign decode_advance = decode.valid & issue_stage_ready; //Instruction aliases @@ -123,37 +115,44 @@ module decode_and_issue //////////////////////////////////////////////////// //Register File Support always_comb begin - uses_rd = |unit_uses_rd; - uses_rs = '{default: 0}; - for (int i = 0; i < NUM_UNITS; i++) + decode_uses_rd = |unit_uses_rd; + decode_uses_rs = '{default: 0}; + for (int i = 0; i < MAX_NUM_UNITS; i++) for (int j = 0; j < REGFILE_READ_PORTS; j++) - uses_rs[j] |= unit_uses_rs[i][j]; + decode_uses_rs[j] |= unit_uses_rs[i][j]; end //////////////////////////////////////////////////// - //Renamer Support - logic [$clog2(CONFIG.NUM_WB_GROUPS)-1:0] renamer_wb_group; + //WB Group Determination + localparam units_t [MAX_NUM_UNITS-1:0] WB_UNITS_TYPE_REP = get_wb_units_type_representation(CONFIG.WB_GROUP); + logic [CONFIG.NUM_WB_GROUPS-1:0] uses_wb_group; + always_comb begin - renamer_wb_group = $clog2(CONFIG.NUM_WB_GROUPS)'(CONFIG.NUM_WB_GROUPS - 1); - if (unit_needed[UNIT_IDS.ALU]) - renamer_wb_group = 0; - else if (unit_needed[UNIT_IDS.LS] ) - renamer_wb_group = 1; + for (int i = 0; i < CONFIG.NUM_WB_GROUPS; i++) + uses_wb_group[i] = |(unit_needed & WB_UNITS_TYPE_REP[i]); end + + one_hot_to_integer #(.C_WIDTH(CONFIG.NUM_WB_GROUPS)) + wb_group_one_hot_block ( + .one_hot (uses_wb_group), + .int_out (decode_wb_group) + ); + + //////////////////////////////////////////////////// + //Renamer Support assign renamer.rd_addr = decode_instruction.rd_addr; assign renamer.rs_addr = decode_rs_addr; - assign renamer.uses_rd = uses_rd; - - assign renamer.rd_wb_group = renamer_wb_group; + assign renamer.uses_rd = decode_uses_rd; + assign renamer.rd_wb_group = decode_wb_group; assign renamer.id = decode.id; //////////////////////////////////////////////////// //Decode ID Support - assign decode_uses_rd = uses_rd; assign decode_rd_addr = decode_instruction.rd_addr; assign decode_phys_rd_addr = renamer.phys_rd_addr; assign decode_phys_rs_addr = renamer.phys_rs_addr; assign decode_rs_wb_group = renamer.rs_wb_group; + //////////////////////////////////////////////////// //Issue always_ff @(posedge clk) begin @@ -168,12 +167,12 @@ module decode_and_issue issue_rs_wb_group <= renamer.rs_wb_group; issue.rd_addr <= decode_instruction.rd_addr; issue.phys_rd_addr <= renamer.phys_rd_addr; - issue_rd_wb_group <= renamer_wb_group; - issue.is_multicycle <= ~unit_needed[UNIT_IDS.ALU]; + issue_rd_wb_group <= decode_wb_group; + issue.is_multicycle <= ~unit_needed[ALU_ID]; issue.id <= decode.id; issue.exception_unit <= decode_exception_unit; - issue_uses_rs <= uses_rs; - issue.uses_rd <= uses_rd; + issue_uses_rs <= decode_uses_rs; + issue.uses_rd <= decode_uses_rd; end end @@ -190,24 +189,23 @@ module decode_and_issue end //////////////////////////////////////////////////// - //Unit ready - generate for (i=0; i ID_COUNTER_W'(i); id_ready_to_retire[i] = (id_is_post_issue[i] & contiguous_retire & ~id_waiting_for_writeback[i]); - retire_port_valid_next[i] = id_ready_to_retire[i] & ~((retire_id_uses_rd[i] & retire_with_rd_found) | (retire_id_is_store[i] & retire_with_store_found)); + retire_port_valid_next[i] = id_ready_to_retire[i] & ~((retire_type[i].is_rd & retire_with_rd_found) | (retire_type[i].is_store & retire_with_store_found)); - retire_with_rd_found |= retire_port_valid_next[i] & retire_id_uses_rd[i]; - retire_with_store_found |= retire_port_valid_next[i] & retire_id_is_store[i]; - + retire_with_rd_found |= retire_port_valid_next[i] & retire_type[i].is_rd; + retire_with_store_found |= retire_port_valid_next[i] & retire_type[i].is_store; contiguous_retire &= retire_port_valid_next[i] & ~gc.exception_pending; + + if (retire_port_valid_next[i] & retire_type[i].is_rd) + retire_with_rd_sel = LOG2_RETIRE_PORTS'(i); + if (retire_port_valid_next[i] & retire_type[i].is_store) + retire_with_store_sel = LOG2_RETIRE_PORTS'(i); end end - //retire_next packet - priority_encoder #(.WIDTH(RETIRE_PORTS)) - retire_with_rd_sel_encoder ( - .priority_vector (retire_id_uses_rd), - .encoded_result (retire_with_rd_sel) - ); + //retire_next packets + assign wb_retire_next = '{ + id : retire_ids_next[retire_with_rd_sel], + valid : retire_with_rd_found + }; + assign store_retire_next = '{ + id : retire_ids_next[retire_with_store_sel], + valid : retire_with_store_found + }; - assign wb_retire_next.id = retire_ids_next[retire_with_rd_sel]; - assign wb_retire_next.valid = retire_with_rd_found; - always_comb begin retire_count_next = 0; for (int i = 0; i < RETIRE_PORTS; i++) begin @@ -346,42 +375,27 @@ module instruction_metadata_and_id_management end always_ff @ (posedge clk) begin - wb_retire.valid <= wb_retire_next.valid; - wb_retire.id <= wb_retire_next.id; + wb_retire <= wb_retire_next; + store_retire <= store_retire_next; retire_count <= gc.writeback_supress ? '0 : retire_count_next; for (int i = 0; i < RETIRE_PORTS; i++) retire_port_valid[i] <= retire_port_valid_next[i] & ~gc.writeback_supress; end - priority_encoder #(.WIDTH(RETIRE_PORTS)) - retire_with_store_sel_encoder ( - .priority_vector (retire_id_is_store), - .encoded_result (retire_with_store_sel) - ); - - assign store_retire_next.id = retire_ids_next[retire_with_store_sel]; - assign store_retire_next.valid = retire_with_store_found; - - always_ff @ (posedge clk) begin - store_retire <= store_retire_next; - end //////////////////////////////////////////////////// //Outputs assign pc_id_available = ~inflight_count[LOG2_MAX_IDS]; //Decode - assign decode.id = decode_id; - assign decode.valid = fetched_count_neg[LOG2_MAX_IDS]; - assign decode.pc = pc_table[decode_id]; - assign decode.instruction = instruction_table[decode_id]; - assign decode.fetch_metadata = CONFIG.INCLUDE_M_MODE ? fetch_metadata_table[decode_id] : '{ok : 1, error_code : INST_ACCESS_FAULT}; - - //Exception Support - generate if (CONFIG.INCLUDE_M_MODE) begin : gen_id_exception_support - assign oldest_pc = pc_table[retire_ids_next[0]]; - assign current_exception_unit = exception_unit_table[retire_ids_next[0]]; - end endgenerate + localparam fetch_metadata_t ADDR_OK = '{ok : 1, error_code : INST_ADDR_MISSALIGNED}; + assign decode = '{ + id : decode_id, + valid : fetched_count_neg[LOG2_MAX_IDS], + pc : decode_pc, + instruction : decode_instruction, + fetch_metadata : CONFIG.INCLUDE_M_MODE ? decode_fetch_metadata : ADDR_OK + }; //////////////////////////////////////////////////// //End of Implementation diff --git a/core/avalon_master.sv b/core/memory_sub_units/avalon_master.sv similarity index 100% rename from core/avalon_master.sv rename to core/memory_sub_units/avalon_master.sv diff --git a/core/axi_master.sv b/core/memory_sub_units/axi_master.sv similarity index 100% rename from core/axi_master.sv rename to core/memory_sub_units/axi_master.sv diff --git a/core/local_mem_sub_unit.sv b/core/memory_sub_units/local_mem_sub_unit.sv similarity index 100% rename from core/local_mem_sub_unit.sv rename to core/memory_sub_units/local_mem_sub_unit.sv diff --git a/core/wishbone_master.sv b/core/memory_sub_units/wishbone_master.sv similarity index 100% rename from core/wishbone_master.sv rename to core/memory_sub_units/wishbone_master.sv diff --git a/core/one_hot_occupancy.sv b/core/one_hot_occupancy.sv deleted file mode 100755 index f38d04b..0000000 --- a/core/one_hot_occupancy.sv +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright © 2017-2019 Eric Matthews, Lesley Shannon - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Initial code developed under the supervision of Dr. Lesley Shannon, - * Reconfigurable Computing Lab, Simon Fraser University. - * - * Author(s): - * Eric Matthews - */ - -module one_hot_occupancy - #(parameter DEPTH = 4) - ( - input logic clk, - input logic rst, - input logic push, - input logic pop, - output logic almost_full, - output logic full, - output logic empty, - output logic almost_empty, - output logic valid - ); - - logic [DEPTH:0] valid_chain; - - //Occupancy Tracking - always_ff @ (posedge clk) begin - if (rst) begin - valid_chain[0] <= 1; - valid_chain[DEPTH:1] <= 0; - end - else begin - case({push,pop}) - 2'b10 : valid_chain <= {valid_chain[DEPTH-1:0], 1'b0}; - 2'b01 : valid_chain <= {1'b0, valid_chain[DEPTH:1]}; - default : valid_chain <= valid_chain; - endcase - end - end - - assign empty = valid_chain[0]; - assign almost_empty = valid_chain[1]; - - assign valid = ~valid_chain[0]; - assign full = valid_chain[DEPTH]; - - assign almost_full = valid_chain[DEPTH-1]; - - //////////////////////////////////////////////////// - //Assertions - always_ff @ (posedge clk) begin - assert (!(~rst & valid_chain[DEPTH] & push)) else $error("overflow"); - assert (!(~rst & valid_chain[0] & pop)) else $error("underflow"); - end - -endmodule diff --git a/core/placer_randomizer.sv b/core/placer_randomizer.sv deleted file mode 100644 index 842b6da..0000000 --- a/core/placer_randomizer.sv +++ /dev/null @@ -1,16 +0,0 @@ -module placer_randomizer # ( - parameter logic [7:0] PLACER_SEED = 8'h2B - ) - ( - input logic clk, - input logic [7:0] samples, - output logic result - ); - - always_ff @(posedge clk) begin - result <= |(samples & PLACER_SEED); - end - -endmodule - - diff --git a/core/register_file.sv b/core/register_file.sv index 0447676..233df5e 100755 --- a/core/register_file.sv +++ b/core/register_file.sv @@ -108,7 +108,7 @@ module register_file //LUTRAM implementation //Read in decode stage, writeback groups muxed and output registered per regfile read port generate for (genvar i = 0; i < CONFIG.NUM_WB_GROUPS; i++) begin : register_file_gen - lutram_1w_mr #(.WIDTH(32), .DEPTH(64), .NUM_READ_PORTS(REGFILE_READ_PORTS)) + lutram_1w_mr #(.DATA_TYPE(logic[31:0]), .DEPTH(64), .NUM_READ_PORTS(REGFILE_READ_PORTS)) register_file_bank ( .clk, .waddr(wb_phys_addr[i]), diff --git a/core/register_free_list.sv b/core/register_free_list.sv index 9f6193b..ea3acf2 100644 --- a/core/register_free_list.sv +++ b/core/register_free_list.sv @@ -32,7 +32,7 @@ module register_free_list import cva5_types::*; #( - parameter DATA_WIDTH = 70, + parameter type DATA_TYPE = logic, parameter FIFO_DEPTH = 4 ) ( @@ -45,7 +45,7 @@ module register_free_list localparam LOG2_FIFO_DEPTH = $clog2(FIFO_DEPTH); //Force FIFO depth to next power of 2 - (* ramstyle = "MLAB, no_rw_check" *) logic [DATA_WIDTH-1:0] lut_ram [(2**LOG2_FIFO_DEPTH)]; + (* ramstyle = "MLAB, no_rw_check" *) logic [$bits(DATA_TYPE)-1:0] lut_ram [(2**LOG2_FIFO_DEPTH)]; logic [LOG2_FIFO_DEPTH-1:0] write_index; logic [LOG2_FIFO_DEPTH-1:0] read_index; logic [LOG2_FIFO_DEPTH:0] inflight_count; diff --git a/core/renamer.sv b/core/renamer.sv index 34e0117..df27b9e 100644 --- a/core/renamer.sv +++ b/core/renamer.sv @@ -58,7 +58,7 @@ module renamer logic [5:0] clear_index; - fifo_interface #(.DATA_WIDTH($bits(phys_addr_t))) free_list (); + fifo_interface #(.DATA_TYPE(phys_addr_t)) free_list (); logic rename_valid; logic rollback; @@ -83,7 +83,7 @@ module renamer //////////////////////////////////////////////////// //Free list FIFO - register_free_list #(.DATA_WIDTH($bits(phys_addr_t)), .FIFO_DEPTH(32)) free_list_fifo ( + register_free_list #(.DATA_TYPE(phys_addr_t), .FIFO_DEPTH(32)) free_list_fifo ( .clk (clk), .rst (rst), .fifo (free_list), @@ -106,7 +106,7 @@ module renamer previous_wb_group : spec_table_previous_r.wb_group }; - lutram_1w_1r #(.WIDTH($bits(renamer_metadata_t)), .DEPTH(MAX_IDS)) + lutram_1w_1r #(.DATA_TYPE(renamer_metadata_t), .DEPTH(MAX_IDS)) inuse_table ( .clk (clk), .waddr (issue.id), @@ -168,7 +168,7 @@ module renamer assign spec_table_read_addr[1+:REGFILE_READ_PORTS] = decode.rs_addr; lutram_1w_mr #( - .WIDTH($bits(spec_table_t)), + .DATA_TYPE(spec_table_t), .DEPTH(32), .NUM_READ_PORTS(REGFILE_READ_PORTS+1) ) diff --git a/core/shift_counter.sv b/core/shift_counter.sv deleted file mode 100644 index 079d64f..0000000 --- a/core/shift_counter.sv +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright © 2019 Eric Matthews, Lesley Shannon - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Initial code developed under the supervision of Dr. Lesley Shannon, - * Reconfigurable Computing Lab, Simon Fraser University. - * - * Author(s): - * Eric Matthews - */ - -module shift_counter - - import cva5_config::*; - import cva5_types::*; - - #(parameter DEPTH = 16) - ( - input logic clk, - input logic rst, - input logic start, - output logic done - ); - - logic [DEPTH-1:0] counter; - //////////////////////////////////////////////////// - //Implementation - - //TLB_CLEAR state shift reg - always_ff @ (posedge clk) begin - counter[0] <= start; - counter[DEPTH-1:1] <= counter[DEPTH-2:0]; - end - assign done = counter[DEPTH-1]; - -endmodule diff --git a/core/tlb_lut_ram.sv b/core/tlb_lut_ram.sv index a2893cd..db21485 100755 --- a/core/tlb_lut_ram.sv +++ b/core/tlb_lut_ram.sv @@ -91,7 +91,7 @@ module tlb_lut_ram genvar i; generate for (i=0; i