Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 29 additions & 27 deletions rtl/croc_domain.sv
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,16 @@ module croc_domain import croc_pkg::*; #(
.rst_ni,
.testmode_i,

.sbr_ports_req_i ( {core_instr_obi_req, core_data_obi_req, dbg_req_obi_req, user_mgr_obi_req_i } ), // from managers towards subordinates
// connections between managers and crossbar
.sbr_ports_req_i ( {core_instr_obi_req, core_data_obi_req, dbg_req_obi_req, user_mgr_obi_req_i } ),
.sbr_ports_rsp_o ( {core_instr_obi_rsp, core_data_obi_rsp, dbg_req_obi_rsp, user_mgr_obi_rsp_o } ),
.mgr_ports_req_o ( all_sbr_obi_req ), // connections to subordinates
// connections between crossbar and subordinates
.mgr_ports_req_o ( all_sbr_obi_req ),
.mgr_ports_rsp_i ( all_sbr_obi_rsp ),

.addr_map_i ( croc_addr_map ),
.en_default_idx_i ( 4'b1111 ),
.default_idx_i ( '0 )
.addr_map_i ( croc_addr_map ),
.en_default_idx_i ( '1 ),
.default_idx_i ( XbarError )
);

// -----------------
Expand Down Expand Up @@ -435,13 +437,13 @@ module croc_domain import croc_pkg::*; #(
.rule_t ( addr_map_rule_t ),
.Napot ( 1'b0 )
) i_addr_decode_periphs (
.addr_i ( xbar_periph_obi_req.a.addr ),
.addr_map_i ( periph_addr_map ),
.idx_o ( periph_idx ),
.dec_valid_o (),
.dec_error_o (),
.en_default_idx_i ( 1'b1 ),
.default_idx_i ( '0 )
.addr_i ( xbar_periph_obi_req.a.addr ),
.addr_map_i ( periph_addr_map ),
.idx_o ( periph_idx ),
.dec_valid_o ( ),
.dec_error_o ( ),
.en_default_idx_i ( 1'b1 ),
.default_idx_i ( PeriphError )
);

obi_demux #(
Expand All @@ -462,21 +464,6 @@ module croc_domain import croc_pkg::*; #(
.mgr_ports_rsp_i ( all_periph_obi_rsp )
);

// Peripheral space error subordinate
obi_err_sbr #(
.ObiCfg ( SbrObiCfg ),
.obi_req_t ( sbr_obi_req_t ),
.obi_rsp_t ( sbr_obi_rsp_t ),
.NumMaxTrans ( 1 ),
.RspData ( 32'hBADCAB1E )
) i_periph_err (
.clk_i,
.rst_ni,
.testmode_i,
.obi_req_i ( error_obi_req ),
.obi_rsp_o ( error_obi_rsp )
);

// SoC Control
logic fetch_en_reg;
assign fetch_enable = fetch_en_i | fetch_en_reg;
Expand Down Expand Up @@ -568,4 +555,19 @@ module croc_domain import croc_pkg::*; #(
.overflow_o ( ) // Not connected
);

// Peripheral space error subordinate
obi_err_sbr #(
.ObiCfg ( SbrObiCfg ),
.obi_req_t ( sbr_obi_req_t ),
.obi_rsp_t ( sbr_obi_rsp_t ),
.NumMaxTrans ( 1 ),
.RspData ( 32'hBADCAB1E )
) i_periph_err (
.clk_i,
.rst_ni,
.testmode_i,
.obi_req_i ( error_obi_req ),
.obi_rsp_o ( error_obi_rsp )
);

endmodule
39 changes: 31 additions & 8 deletions rtl/user_domain.sv
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,15 @@ module user_domain import user_pkg::*; import croc_pkg::*; #(
sbr_obi_req_t user_error_obi_req;
sbr_obi_rsp_t user_error_obi_rsp;

// OBI bus to your design
sbr_obi_req_t user_design_obi_req;
sbr_obi_rsp_t user_design_obi_rsp;

// Fanout into more readable signals
assign user_error_obi_req = all_user_sbr_obi_req[UserError];
assign all_user_sbr_obi_rsp[UserError] = user_error_obi_rsp;
assign user_error_obi_req = all_user_sbr_obi_req[UserError];
assign all_user_sbr_obi_rsp[UserError] = user_error_obi_rsp;
assign user_error_obi_req = all_user_sbr_obi_req[UserDesign];
assign all_user_sbr_obi_rsp[UserDesign] = user_error_obi_rsp;


//-----------------------------------------------------------------------------------------------
Expand All @@ -64,18 +70,18 @@ module user_domain import user_pkg::*; import croc_pkg::*; #(

addr_decode #(
.NoIndices ( NumDemuxSbr ),
.NoRules ( NumDemuxSbrRules ),
.NoRules ( $size(user_addr_map) ),
.addr_t ( logic[SbrObiCfg.DataWidth-1:0] ),
.rule_t ( addr_map_rule_t ),
.Napot ( 1'b0 )
) i_addr_decode_periphs (
.addr_i ( user_sbr_obi_req_i.a.addr ),
.addr_map_i ( user_addr_map ),
.idx_o ( user_idx ),
.dec_valid_o (),
.dec_error_o (),
.en_default_idx_i ( 1'b1 ),
.default_idx_i ( '0 )
.dec_valid_o ( ),
.dec_error_o ( ),
.en_default_idx_i ( 1'b1 ),
.default_idx_i ( UserError )
);

obi_demux #(
Expand All @@ -101,6 +107,23 @@ module user_domain import user_pkg::*; import croc_pkg::*; #(
// User Subordinates
//-------------------------------------------------------------------------------------------------

///////////////////////////////////
// Replace this with your Design //
///////////////////////////////////
obi_err_sbr #(
.ObiCfg ( SbrObiCfg ),
.obi_req_t ( sbr_obi_req_t ),
.obi_rsp_t ( sbr_obi_rsp_t ),
.NumMaxTrans ( 1 ),
.RspData ( 32'hBADCAB1E )
) i_your_design_goes_here (
.clk_i,
.rst_ni,
.testmode_i ( testmode_i ),
.obi_req_i ( user_design_obi_req ),
.obi_rsp_o ( user_design_obi_rsp )
);

// Error Subordinate
obi_err_sbr #(
.ObiCfg ( SbrObiCfg ),
Expand All @@ -111,7 +134,7 @@ module user_domain import user_pkg::*; import croc_pkg::*; #(
) i_user_err (
.clk_i,
.rst_ni,
.testmode_i ( testmode_i ),
.testmode_i ( testmode_i ),
.obi_req_i ( user_error_obi_req ),
.obi_rsp_o ( user_error_obi_rsp )
);
Expand Down
36 changes: 19 additions & 17 deletions rtl/user_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,33 @@

package user_pkg;

////////////////////////////////
// User Manager Address maps //
///////////////////////////////
//////////////////
// User Manager //
//////////////////

// None


/////////////////////////////////////
// User Subordinate Address maps ////
/////////////////////////////////////
///////////////////////
// User Subordinates //
///////////////////////

localparam int unsigned NumUserDomainSubordinates = 0;
// The base address of the user domain can be retrived from `croc_pkg::UserBaseAddr`
// Recommended: place subordinates at 4KB boundaries (32'hXXXX_X000)

localparam bit [31:0] UserRomAddrOffset = croc_pkg::UserBaseAddr; // 32'h2000_0000;
localparam bit [31:0] UserRomAddrRange = 32'h0000_1000; // every subordinate has at least 4KB

localparam int unsigned NumDemuxSbrRules = (NumUserDomainSubordinates > 0) ? NumUserDomainSubordinates : 1; // number of address rules in the decoder
localparam int unsigned NumDemuxSbr = NumDemuxSbrRules + 1; // additional OBI error, used for signal arrays

// Enum for bus indices
/// Enum with user domain demultiplexer subordinate idxs
typedef enum int {
UserError = 0
UserError = 0,
UserDesign = 1
} user_demux_outputs_e;

// Address rules given to address decoder
localparam croc_pkg::addr_map_rule_t [NumDemuxSbrRules-1:0] user_addr_map = '0;
/// Address rules given to user domain demultiplexer (see croc_pkg.sv for examples)
localparam croc_pkg::addr_map_rule_t [0:0] user_addr_map = '{
'{ idx: UserDesign, start_addr: croc_pkg::UserBaseAddr, end_addr: (croc_pkg::UserBaseAddr + 32'h1000_0000) }
};
// All addresses outside the defined address rules go to the error subordinate

// +1 for additional OBI error
localparam int unsigned NumDemuxSbr = $size(user_addr_map) + 1;

endpackage
Loading