mirror of
https://github.com/retroSoC/retroSoC.git
synced 2026-11-04 22:32:36 +00:00
- Replaced instances of nmi_if with rib_if in sysctrl_fault_tb.sv, test_dma.py, test_gpio_user_mux.py, test_memory_map.py, test_performance_log.py, test_script_tools.py, test_sdram.py, test_soc_topology.py, test_sta_constraints.py, and test_user_extensions.py. - Updated test cases to reflect changes from NMI to RIB, ensuring all references and assertions are consistent with the new interface. - Adjusted memory map and performance log tests to validate RIB-specific configurations and behaviors. - Ensured that all relevant file paths and definitions are updated to maintain functionality and correctness across the test suite.
137 lines
3.6 KiB
Systemverilog
137 lines
3.6 KiB
Systemverilog
// Copyright (c) 2023-2026 Yuchi Miao <miaoyuchi@ict.ac.cn>
|
|
// retroSoC is licensed under Mulan PSL v2.
|
|
// You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
// You may obtain a copy of Mulan PSL v2 at:
|
|
// http://license.coscl.org.cn/MulanPSL2
|
|
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
// See the Mulan PSL v2 for more details.
|
|
|
|
module rib_regslice (
|
|
// verilog_format: off
|
|
input logic clk_i,
|
|
input logic rst_n_i,
|
|
rib_if.slave rib_slv,
|
|
rib_if.master rib_mst
|
|
// verilog_format: on
|
|
);
|
|
|
|
localparam FSM_IDLE = 2'd0;
|
|
localparam FSM_REQ = 2'd1;
|
|
localparam FSM_RESP = 2'd2;
|
|
|
|
logic [1:0] s_fsm_d, s_fsm_q;
|
|
logic s_rib_mst_valid_d, s_rib_mst_valid_q;
|
|
logic [31:0] s_rib_mst_addr_d, s_rib_mst_addr_q;
|
|
logic [31:0] s_rib_mst_wdata_d, s_rib_mst_wdata_q;
|
|
logic [3:0] s_rib_mst_wstrb_d, s_rib_mst_wstrb_q;
|
|
logic [31:0] s_rib_mst_rdata_d, s_rib_mst_rdata_q;
|
|
logic s_rib_mst_ready_d, s_rib_mst_ready_q;
|
|
// rib mst if
|
|
assign rib_mst.valid = s_rib_mst_valid_q;
|
|
assign rib_mst.addr = s_rib_mst_addr_q;
|
|
assign rib_mst.wdata = s_rib_mst_wdata_q;
|
|
assign rib_mst.wstrb = s_rib_mst_wstrb_q;
|
|
|
|
|
|
always_comb begin
|
|
s_fsm_d = s_fsm_q;
|
|
s_rib_mst_valid_d = s_rib_mst_valid_q;
|
|
s_rib_mst_addr_d = s_rib_mst_addr_q;
|
|
s_rib_mst_wdata_d = s_rib_mst_wdata_q;
|
|
s_rib_mst_wstrb_d = s_rib_mst_wstrb_q;
|
|
s_rib_mst_ready_d = s_rib_mst_ready_q;
|
|
s_rib_mst_rdata_d = s_rib_mst_rdata_q;
|
|
rib_slv.ready = '0;
|
|
rib_slv.rdata = '0;
|
|
unique case (s_fsm_q)
|
|
FSM_IDLE: begin
|
|
if (rib_slv.valid) begin
|
|
s_fsm_d = FSM_REQ;
|
|
s_rib_mst_valid_d = rib_slv.valid;
|
|
s_rib_mst_addr_d = rib_slv.addr;
|
|
s_rib_mst_wdata_d = rib_slv.wdata;
|
|
s_rib_mst_wstrb_d = rib_slv.wstrb;
|
|
end
|
|
end
|
|
FSM_REQ: begin
|
|
if (rib_mst.ready) begin
|
|
s_fsm_d = FSM_RESP;
|
|
s_rib_mst_valid_d = 1'b0;
|
|
s_rib_mst_ready_d = rib_mst.ready;
|
|
s_rib_mst_rdata_d = rib_mst.rdata;
|
|
end
|
|
end
|
|
FSM_RESP: begin
|
|
s_fsm_d = FSM_IDLE;
|
|
rib_slv.ready = s_rib_mst_ready_q;
|
|
rib_slv.rdata = s_rib_mst_rdata_q;
|
|
end
|
|
default: begin
|
|
s_fsm_d = s_fsm_q;
|
|
s_rib_mst_valid_d = s_rib_mst_valid_q;
|
|
s_rib_mst_addr_d = s_rib_mst_addr_q;
|
|
s_rib_mst_wdata_d = s_rib_mst_wdata_q;
|
|
s_rib_mst_wstrb_d = s_rib_mst_wstrb_q;
|
|
s_rib_mst_ready_d = s_rib_mst_ready_q;
|
|
s_rib_mst_rdata_d = s_rib_mst_rdata_q;
|
|
rib_slv.ready = '0;
|
|
rib_slv.rdata = '0;
|
|
end
|
|
endcase
|
|
end
|
|
dffr #(2) u_fsm_dffr (
|
|
clk_i,
|
|
rst_n_i,
|
|
s_fsm_d,
|
|
s_fsm_q
|
|
);
|
|
|
|
dffr #(1) u_rib_mstr_valid_dffr (
|
|
clk_i,
|
|
rst_n_i,
|
|
s_rib_mst_valid_d,
|
|
s_rib_mst_valid_q
|
|
);
|
|
|
|
|
|
dffr #(32) u_rib_mst_addr_dffr (
|
|
clk_i,
|
|
rst_n_i,
|
|
s_rib_mst_addr_d,
|
|
s_rib_mst_addr_q
|
|
);
|
|
|
|
|
|
dffr #(32) u_rib_mst_wdata_dffr (
|
|
clk_i,
|
|
rst_n_i,
|
|
s_rib_mst_wdata_d,
|
|
s_rib_mst_wdata_q
|
|
);
|
|
|
|
|
|
dffr #(4) u_rib_mst_wstrb_dffr (
|
|
clk_i,
|
|
rst_n_i,
|
|
s_rib_mst_wstrb_d,
|
|
s_rib_mst_wstrb_q
|
|
);
|
|
|
|
dffr #(32) u_rib_mst_rdata_dffr (
|
|
clk_i,
|
|
rst_n_i,
|
|
s_rib_mst_rdata_d,
|
|
s_rib_mst_rdata_q
|
|
);
|
|
|
|
dffr #(1) u_rib_mst_ready_dffr (
|
|
clk_i,
|
|
rst_n_i,
|
|
s_rib_mst_ready_d,
|
|
s_rib_mst_ready_q
|
|
);
|
|
|
|
endmodule
|