Skip to content

Commit 8587c3b

Browse files
committed
hw: fix undriven signals in default user_domain
1 parent 4d322a3 commit 8587c3b

File tree

3 files changed

+79
-52
lines changed

3 files changed

+79
-52
lines changed

rtl/croc_domain.sv

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,16 @@ module croc_domain import croc_pkg::*; #(
335335
.rst_ni,
336336
.testmode_i,
337337

338-
.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
338+
// connections between managers and crossbar
339+
.sbr_ports_req_i ( {core_instr_obi_req, core_data_obi_req, dbg_req_obi_req, user_mgr_obi_req_i } ),
339340
.sbr_ports_rsp_o ( {core_instr_obi_rsp, core_data_obi_rsp, dbg_req_obi_rsp, user_mgr_obi_rsp_o } ),
340-
.mgr_ports_req_o ( all_sbr_obi_req ), // connections to subordinates
341+
// connections between crossbar and subordinates
342+
.mgr_ports_req_o ( all_sbr_obi_req ),
341343
.mgr_ports_rsp_i ( all_sbr_obi_rsp ),
342344

343-
.addr_map_i ( croc_addr_map ),
344-
.en_default_idx_i ( 4'b1111 ),
345-
.default_idx_i ( '0 )
345+
.addr_map_i ( croc_addr_map ),
346+
.en_default_idx_i ( '1 ),
347+
.default_idx_i ( XbarError )
346348
);
347349

348350
// -----------------
@@ -435,13 +437,13 @@ module croc_domain import croc_pkg::*; #(
435437
.rule_t ( addr_map_rule_t ),
436438
.Napot ( 1'b0 )
437439
) i_addr_decode_periphs (
438-
.addr_i ( xbar_periph_obi_req.a.addr ),
439-
.addr_map_i ( periph_addr_map ),
440-
.idx_o ( periph_idx ),
441-
.dec_valid_o (),
442-
.dec_error_o (),
443-
.en_default_idx_i ( 1'b1 ),
444-
.default_idx_i ( '0 )
440+
.addr_i ( xbar_periph_obi_req.a.addr ),
441+
.addr_map_i ( periph_addr_map ),
442+
.idx_o ( periph_idx ),
443+
.dec_valid_o ( ),
444+
.dec_error_o ( ),
445+
.en_default_idx_i ( 1'b1 ),
446+
.default_idx_i ( PeriphError )
445447
);
446448

447449
obi_demux #(
@@ -462,21 +464,6 @@ module croc_domain import croc_pkg::*; #(
462464
.mgr_ports_rsp_i ( all_periph_obi_rsp )
463465
);
464466

465-
// Peripheral space error subordinate
466-
obi_err_sbr #(
467-
.ObiCfg ( SbrObiCfg ),
468-
.obi_req_t ( sbr_obi_req_t ),
469-
.obi_rsp_t ( sbr_obi_rsp_t ),
470-
.NumMaxTrans ( 1 ),
471-
.RspData ( 32'hBADCAB1E )
472-
) i_periph_err (
473-
.clk_i,
474-
.rst_ni,
475-
.testmode_i,
476-
.obi_req_i ( error_obi_req ),
477-
.obi_rsp_o ( error_obi_rsp )
478-
);
479-
480467
// SoC Control
481468
logic fetch_en_reg;
482469
assign fetch_enable = fetch_en_i | fetch_en_reg;
@@ -568,4 +555,19 @@ module croc_domain import croc_pkg::*; #(
568555
.overflow_o ( ) // Not connected
569556
);
570557

558+
// Peripheral space error subordinate
559+
obi_err_sbr #(
560+
.ObiCfg ( SbrObiCfg ),
561+
.obi_req_t ( sbr_obi_req_t ),
562+
.obi_rsp_t ( sbr_obi_rsp_t ),
563+
.NumMaxTrans ( 1 ),
564+
.RspData ( 32'hBADCAB1E )
565+
) i_periph_err (
566+
.clk_i,
567+
.rst_ni,
568+
.testmode_i,
569+
.obi_req_i ( error_obi_req ),
570+
.obi_rsp_o ( error_obi_rsp )
571+
);
572+
571573
endmodule

rtl/user_domain.sv

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,15 @@ module user_domain import user_pkg::*; import croc_pkg::*; #(
5151
sbr_obi_req_t user_error_obi_req;
5252
sbr_obi_rsp_t user_error_obi_rsp;
5353

54+
// OBI bus to your design
55+
sbr_obi_req_t user_design_obi_req;
56+
sbr_obi_rsp_t user_design_obi_rsp;
57+
5458
// Fanout into more readable signals
55-
assign user_error_obi_req = all_user_sbr_obi_req[UserError];
56-
assign all_user_sbr_obi_rsp[UserError] = user_error_obi_rsp;
59+
assign user_error_obi_req = all_user_sbr_obi_req[UserError];
60+
assign all_user_sbr_obi_rsp[UserError] = user_error_obi_rsp;
61+
assign user_error_obi_req = all_user_sbr_obi_req[UserDesign];
62+
assign all_user_sbr_obi_rsp[UserDesign] = user_error_obi_rsp;
5763

5864

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

6571
addr_decode #(
6672
.NoIndices ( NumDemuxSbr ),
67-
.NoRules ( NumDemuxSbrRules ),
73+
.NoRules ( $size(user_addr_map) ),
6874
.addr_t ( logic[SbrObiCfg.DataWidth-1:0] ),
6975
.rule_t ( addr_map_rule_t ),
7076
.Napot ( 1'b0 )
7177
) i_addr_decode_periphs (
7278
.addr_i ( user_sbr_obi_req_i.a.addr ),
7379
.addr_map_i ( user_addr_map ),
7480
.idx_o ( user_idx ),
75-
.dec_valid_o (),
76-
.dec_error_o (),
77-
.en_default_idx_i ( 1'b1 ),
78-
.default_idx_i ( '0 )
81+
.dec_valid_o ( ),
82+
.dec_error_o ( ),
83+
.en_default_idx_i ( 1'b1 ),
84+
.default_idx_i ( UserError )
7985
);
8086

8187
obi_demux #(
@@ -101,6 +107,23 @@ module user_domain import user_pkg::*; import croc_pkg::*; #(
101107
// User Subordinates
102108
//-------------------------------------------------------------------------------------------------
103109

110+
///////////////////////////////////
111+
// Replace this with your Design //
112+
///////////////////////////////////
113+
obi_err_sbr #(
114+
.ObiCfg ( SbrObiCfg ),
115+
.obi_req_t ( sbr_obi_req_t ),
116+
.obi_rsp_t ( sbr_obi_rsp_t ),
117+
.NumMaxTrans ( 1 ),
118+
.RspData ( 32'hBADCAB1E )
119+
) i_your_design_goes_here (
120+
.clk_i,
121+
.rst_ni,
122+
.testmode_i ( testmode_i ),
123+
.obi_req_i ( user_design_obi_req ),
124+
.obi_rsp_o ( user_design_obi_rsp )
125+
);
126+
104127
// Error Subordinate
105128
obi_err_sbr #(
106129
.ObiCfg ( SbrObiCfg ),
@@ -111,7 +134,7 @@ module user_domain import user_pkg::*; import croc_pkg::*; #(
111134
) i_user_err (
112135
.clk_i,
113136
.rst_ni,
114-
.testmode_i ( testmode_i ),
137+
.testmode_i ( testmode_i ),
115138
.obi_req_i ( user_error_obi_req ),
116139
.obi_rsp_o ( user_error_obi_rsp )
117140
);

rtl/user_pkg.sv

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,33 @@
99

1010
package user_pkg;
1111

12-
////////////////////////////////
13-
// User Manager Address maps //
14-
///////////////////////////////
12+
//////////////////
13+
// User Manager //
14+
//////////////////
1515

1616
// None
1717

1818

19-
/////////////////////////////////////
20-
// User Subordinate Address maps ////
21-
/////////////////////////////////////
19+
///////////////////////
20+
// User Subordinates //
21+
///////////////////////
2222

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

25-
localparam bit [31:0] UserRomAddrOffset = croc_pkg::UserBaseAddr; // 32'h2000_0000;
26-
localparam bit [31:0] UserRomAddrRange = 32'h0000_1000; // every subordinate has at least 4KB
27-
28-
localparam int unsigned NumDemuxSbrRules = (NumUserDomainSubordinates > 0) ? NumUserDomainSubordinates : 1; // number of address rules in the decoder
29-
localparam int unsigned NumDemuxSbr = NumDemuxSbrRules + 1; // additional OBI error, used for signal arrays
30-
31-
// Enum for bus indices
26+
/// Enum with user domain demultiplexer subordinate idxs
3227
typedef enum int {
33-
UserError = 0
28+
UserError = 0,
29+
UserDesign = 1
3430
} user_demux_outputs_e;
3531

36-
// Address rules given to address decoder
37-
localparam croc_pkg::addr_map_rule_t [NumDemuxSbrRules-1:0] user_addr_map = '0;
32+
/// Address rules given to user domain demultiplexer (see croc_pkg.sv for examples)
33+
localparam croc_pkg::addr_map_rule_t [0:0] user_addr_map = '{
34+
'{ idx: UserDesign, start_addr: croc_pkg::UserBaseAddr, end_addr: (croc_pkg::UserBaseAddr + 32'h1000_0000) },
35+
};
36+
// All addresses outside the defined address rules go to the error subordinate
37+
38+
// +1 for additional OBI error
39+
localparam int unsigned NumDemuxSbr = $size(user_addr_map) + 1;
3840

3941
endpackage

0 commit comments

Comments
 (0)