Skip to content

Commit 9ab7f40

Browse files
committed
[rtl] Expose lockstep and shadow bus interface core signals to ibex_top
This enables users of Ibex to conduct additional security checks on integration-specific bus protocol conversion modules. Signed-off-by: Pascal Nasahl <nasahlpa@lowrisc.org>
1 parent 7d2d60c commit 9ab7f40

8 files changed

Lines changed: 151 additions & 12 deletions

File tree

doc/02_user/integration.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,21 @@ Instantiation Template
163163
.alert_minor_o (),
164164
.alert_major_internal_o (),
165165
.alert_major_bus_o (),
166-
.core_sleep_o ()
166+
.core_sleep_o (),
167+
168+
// Lockstep signals
169+
.lockstep_cmp_en_o (),
170+
171+
// Shadow core data interface outputs
172+
.data_req_shadow_o (),
173+
.data_we_shadow_o (),
174+
.data_be_shadow_o (),
175+
.data_addr_shadow_o (),
176+
.data_wdata_shadow_o (),
177+
178+
// Shadow core instruction interface outputs
179+
.instr_req_shadow_o (),
180+
.instr_addr_shadow_o ()
167181
);
168182
169183
Parameters

dv/formal/check/top.sv

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,21 @@ module top import ibex_pkg::*; #(
110110

111111

112112
// DFT bypass controls
113-
input logic scan_rst_ni
113+
input logic scan_rst_ni,
114+
115+
// Lockstep signals
116+
output ibex_mubi_t lockstep_cmp_en_o,
117+
118+
// Shadow core data interface outputs
119+
output logic data_req_shadow_o,
120+
output logic data_we_shadow_o,
121+
output logic [3:0] data_be_shadow_o,
122+
output logic [31:0] data_addr_shadow_o,
123+
output logic [31:0] data_wdata_shadow_o,
124+
125+
// Shadow core instruction interface outputs
126+
output logic instr_req_shadow_o,
127+
output logic [31:0] instr_addr_shadow_o
114128
);
115129

116130
// Yosys based tools have no inherent understanding of a reset signal (unlike jasper, which has the

dv/riscv_compliance/rtl/ibex_riscv_compliance.sv

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,18 @@ module ibex_riscv_compliance (
215215
.alert_minor_o ( ),
216216
.alert_major_internal_o ( ),
217217
.alert_major_bus_o ( ),
218-
.core_sleep_o ( )
218+
.core_sleep_o ( ),
219+
220+
.lockstep_cmp_en_o ( ),
221+
222+
.data_req_shadow_o ( ),
223+
.data_we_shadow_o ( ),
224+
.data_be_shadow_o ( ),
225+
.data_addr_shadow_o ( ),
226+
.data_wdata_shadow_o ( ),
227+
228+
.instr_req_shadow_o ( ),
229+
.instr_addr_shadow_o ( )
219230
);
220231

221232
// SRAM block for instruction and data storage

dv/uvm/core_ibex/tb/core_ibex_tb_top.sv

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,17 @@ module core_ibex_tb_top;
168168
.alert_minor_o (dut_if.alert_minor ),
169169
.alert_major_internal_o (dut_if.alert_major_internal),
170170
.alert_major_bus_o (dut_if.alert_major_bus ),
171-
.core_sleep_o (dut_if.core_sleep )
171+
.core_sleep_o (dut_if.core_sleep ),
172+
173+
.lockstep_cmp_en_o ( ),
174+
.data_req_shadow_o ( ),
175+
.data_we_shadow_o ( ),
176+
.data_be_shadow_o ( ),
177+
.data_addr_shadow_o ( ),
178+
.data_wdata_shadow_o ( ),
179+
180+
.instr_req_shadow_o ( ),
181+
.instr_addr_shadow_o ( )
172182
);
173183

174184
`define IBEX_RF_PATH core_ibex_tb_top.dut.u_ibex_top.gen_regfile_ff.register_file_i

examples/simple_system/rtl/ibex_simple_system.sv

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,18 @@ module ibex_simple_system (
268268
.alert_minor_o (),
269269
.alert_major_internal_o (),
270270
.alert_major_bus_o (),
271-
.core_sleep_o ()
271+
.core_sleep_o (),
272+
273+
.lockstep_cmp_en_o (),
274+
275+
.data_req_shadow_o (),
276+
.data_we_shadow_o (),
277+
.data_be_shadow_o (),
278+
.data_addr_shadow_o (),
279+
.data_wdata_shadow_o (),
280+
281+
.instr_req_shadow_o (),
282+
.instr_addr_shadow_o ()
272283
);
273284

274285
// SRAM block for instruction and data storage

rtl/ibex_lockstep.sv

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,16 @@ module ibex_lockstep import ibex_pkg::*; #(
113113
output logic alert_major_bus_o,
114114
input ibex_mubi_t core_busy_i,
115115
input logic test_en_i,
116-
input logic scan_rst_ni
116+
input logic scan_rst_ni,
117+
118+
output ibex_mubi_t lockstep_cmp_en_o,
119+
output logic data_req_shadow_o,
120+
output logic data_we_shadow_o,
121+
output logic [3:0] data_be_shadow_o,
122+
output logic [31:0] data_addr_shadow_o,
123+
output logic [31:0] data_wdata_shadow_o,
124+
output logic instr_req_shadow_o,
125+
output logic [31:0] instr_addr_shadow_o
117126
);
118127

119128
localparam int unsigned LockstepOffsetW = $clog2(LockstepOffset);
@@ -511,4 +520,13 @@ module ibex_lockstep import ibex_pkg::*; #(
511520
assign alert_major_bus_o = shadow_alert_major_bus;
512521
assign alert_minor_o = shadow_alert_minor;
513522

523+
assign lockstep_cmp_en_o = enable_cmp_q;
524+
525+
assign data_req_shadow_o = shadow_outputs_d.data_req;
526+
assign data_we_shadow_o = shadow_outputs_d.data_we;
527+
assign data_be_shadow_o = shadow_outputs_d.data_be;
528+
assign data_addr_shadow_o = shadow_outputs_d.data_addr;
529+
assign data_wdata_shadow_o = shadow_outputs_d.data_wdata[31:0];
530+
assign instr_req_shadow_o = shadow_outputs_d.instr_req;
531+
assign instr_addr_shadow_o = shadow_outputs_d.instr_addr;
514532
endmodule

rtl/ibex_top.sv

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ module ibex_top import ibex_pkg::*; #(
3434
parameter bit DbgTriggerEn = 1'b0,
3535
parameter int unsigned DbgHwBreakNum = 1,
3636
parameter bit SecureIbex = 1'b0,
37+
parameter bit MemECC = SecureIbex,
38+
parameter int unsigned MemDataWidth = MemECC ? 32 + 7 : 32,
3739
parameter bit ICacheScramble = 1'b0,
3840
parameter int unsigned ICacheScrNumPrinceRoundsHalf = 2,
3941
parameter lfsr_seed_t RndCnstLfsrSeed = RndCnstLfsrSeedDefault,
@@ -162,7 +164,21 @@ module ibex_top import ibex_pkg::*; #(
162164
output logic core_sleep_o,
163165

164166
// DFT bypass controls
165-
input logic scan_rst_ni
167+
input logic scan_rst_ni,
168+
169+
// Lockstep signals
170+
output ibex_mubi_t lockstep_cmp_en_o,
171+
172+
// Shadow core data interface outputs
173+
output logic data_req_shadow_o,
174+
output logic data_we_shadow_o,
175+
output logic [3:0] data_be_shadow_o,
176+
output logic [31:0] data_addr_shadow_o,
177+
output logic [31:0] data_wdata_shadow_o,
178+
179+
// Shadow core instruction interface outputs
180+
output logic instr_req_shadow_o,
181+
output logic [31:0] instr_addr_shadow_o
166182
);
167183

168184
localparam bit Lockstep = SecureIbex;
@@ -172,8 +188,6 @@ module ibex_top import ibex_pkg::*; #(
172188
localparam bit RegFileWrenCheck = SecureIbex;
173189
localparam bit RegFileRdataMuxCheck = SecureIbex;
174190
localparam int unsigned RegFileDataWidth = RegFileECC ? 32 + 7 : 32;
175-
localparam bit MemECC = SecureIbex;
176-
localparam int unsigned MemDataWidth = MemECC ? 32 + 7 : 32;
177191
// Icache parameters
178192
localparam int unsigned BusSizeECC = ICacheECC ? (BUS_SIZE + 7) : BUS_SIZE;
179193
localparam int unsigned LineSizeECC = BusSizeECC * IC_LINE_BEATS;
@@ -1123,7 +1137,16 @@ module ibex_top import ibex_pkg::*; #(
11231137
.alert_major_bus_o (lockstep_alert_major_bus_local),
11241138
.core_busy_i (core_busy_local),
11251139
.test_en_i (test_en_i),
1126-
.scan_rst_ni (scan_rst_ni)
1140+
.scan_rst_ni (scan_rst_ni),
1141+
1142+
.lockstep_cmp_en_o (lockstep_cmp_en_o),
1143+
.data_req_shadow_o (data_req_shadow_o),
1144+
.data_we_shadow_o (data_we_shadow_o),
1145+
.data_be_shadow_o (data_be_shadow_o),
1146+
.data_addr_shadow_o (data_addr_shadow_o),
1147+
.data_wdata_shadow_o (data_wdata_shadow_o),
1148+
.instr_req_shadow_o (instr_req_shadow_o),
1149+
.instr_addr_shadow_o (instr_addr_shadow_o)
11271150
);
11281151

11291152
prim_buf u_prim_buf_alert_minor (
@@ -1145,6 +1168,16 @@ module ibex_top import ibex_pkg::*; #(
11451168
assign lockstep_alert_major_internal = 1'b0;
11461169
assign lockstep_alert_major_bus = 1'b0;
11471170
assign lockstep_alert_minor = 1'b0;
1171+
1172+
assign lockstep_cmp_en_o = IbexMuBiOff;
1173+
assign data_req_shadow_o = 1'b0;
1174+
assign data_we_shadow_o = 1'b0;
1175+
assign data_be_shadow_o = '0;
1176+
assign data_addr_shadow_o = '0;
1177+
assign data_wdata_shadow_o = '0;
1178+
assign instr_req_shadow_o = 1'b0;
1179+
assign instr_addr_shadow_o = '0;
1180+
11481181
logic unused_scan;
11491182
assign unused_scan = scan_rst_ni;
11501183
end

rtl/ibex_top_tracing.sv

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ module ibex_top_tracing import ibex_pkg::*; #(
2525
parameter bit DbgTriggerEn = 1'b0,
2626
parameter int unsigned DbgHwBreakNum = 1,
2727
parameter bit SecureIbex = 1'b0,
28+
parameter bit MemECC = SecureIbex,
29+
parameter int unsigned MemDataWidth = MemECC ? 32 + 7 : 32,
2830
parameter bit ICacheScramble = 1'b0,
2931
parameter lfsr_seed_t RndCnstLfsrSeed = RndCnstLfsrSeedDefault,
3032
parameter lfsr_perm_t RndCnstLfsrPerm = RndCnstLfsrPermDefault,
@@ -95,8 +97,21 @@ module ibex_top_tracing import ibex_pkg::*; #(
9597
output logic alert_minor_o,
9698
output logic alert_major_internal_o,
9799
output logic alert_major_bus_o,
98-
output logic core_sleep_o
100+
output logic core_sleep_o,
99101

102+
// Lockstep signals
103+
output ibex_mubi_t lockstep_cmp_en_o,
104+
105+
// Shadow core data interface outputs
106+
output logic data_req_shadow_o,
107+
output logic data_we_shadow_o,
108+
output logic [3:0] data_be_shadow_o,
109+
output logic [31:0] data_addr_shadow_o,
110+
output logic [31:0] data_wdata_shadow_o,
111+
112+
// Shadow core instruction interface outputs
113+
output logic instr_req_shadow_o,
114+
output logic [31:0] instr_addr_shadow_o
100115
);
101116

102117
// ibex_tracer relies on the signals from the RISC-V Formal Interface
@@ -195,6 +210,8 @@ module ibex_top_tracing import ibex_pkg::*; #(
195210
.DbgHwBreakNum ( DbgHwBreakNum ),
196211
.WritebackStage ( WritebackStage ),
197212
.SecureIbex ( SecureIbex ),
213+
.MemECC ( MemECC ),
214+
.MemDataWidth ( MemDataWidth ),
198215
.ICacheScramble ( ICacheScramble ),
199216
.RndCnstLfsrSeed ( RndCnstLfsrSeed ),
200217
.RndCnstLfsrPerm ( RndCnstLfsrPerm ),
@@ -294,7 +311,18 @@ module ibex_top_tracing import ibex_pkg::*; #(
294311
.alert_minor_o,
295312
.alert_major_internal_o,
296313
.alert_major_bus_o,
297-
.core_sleep_o
314+
.core_sleep_o,
315+
316+
.lockstep_cmp_en_o,
317+
318+
.data_req_shadow_o,
319+
.data_we_shadow_o,
320+
.data_be_shadow_o,
321+
.data_addr_shadow_o,
322+
.data_wdata_shadow_o,
323+
324+
.instr_req_shadow_o,
325+
.instr_addr_shadow_o
298326
);
299327

300328
ibex_tracer

0 commit comments

Comments
 (0)