Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflow_metadata/pr_hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d9abbfb7fa4110a207664c33be7b56f2eac2c766ce8aba86ab71109229badb8f2d13f8e0572d57483a5c7bec2e43edb8
8d43690ab7a4de0f0599ae51b4c9f217f69afe782ad4ea9e9e4835fdf2c673f8820e60e352335e3c3ccc496d4807f7d4
2 changes: 1 addition & 1 deletion .github/workflow_metadata/pr_timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1796052024
1796261242
2 changes: 1 addition & 1 deletion docs/CaliptraHardwareSpecification.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ The Caliptra VeeR EL2 configuration provides several fault-injection (FI) harden

The RISC-V core is instantiated in a dual-core lockstep (DCLS) configuration. A redundant *shadow* core is driven with the same input stream as the main core, offset by a fixed number of pipeline stages. The main core's outputs are delayed by the same offset and compared cycle-by-cycle against the shadow core's outputs; any divergence indicates a fault in one of the cores. Tying `dcls_en` low may allow synthesis to remove the shadow core and comparison logic. The shadow core is not architecturally visible and drives no system state; it exists solely for comparison.

The `dcls_en` input enables DCLS in both passive and subsystem profiles (`1` = enabled, `0` = disabled), controlling normal mismatch reporting. Integrators may tie it low or high, or drive it from a synchronous SoC register. The sampled enable is reflected read-only to firmware and the SoC in [CPTRA_HW_CONFIG](https://chipsalliance.github.io/caliptra-rtl/main/internal-regs/?p=clp.soc_ifc_reg.CPTRA_HW_CONFIG)`.DCLS_en`. The comparison logic fails safe: an invalid multi-bit encoding on the internal disable control is treated as a detected corruption.
The `dcls_en` input enables DCLS in both passive and subsystem profiles (`1` = enabled, `0` = disabled), controlling normal mismatch reporting. It is sampled once after each noncore reset release, independently of `CPTRA_FUSE_WR_DONE`, and held until the next noncore reset. The input must be stable before `cptra_rst_b` deassertion and through capture. Later input changes are ignored, and a CPU-only firmware-update reset does not resample it. The captured enable is reflected read-only to firmware and the SoC in [CPTRA_HW_CONFIG](https://chipsalliance.github.io/caliptra-rtl/main/internal-regs/?p=clp.soc_ifc_reg.CPTRA_HW_CONFIG)`.DCLS_en`. The comparison logic fails safe: an invalid multi-bit encoding on the internal disable control is treated as a detected corruption.

In scan mode (`scan_mode` = 1), the shadow core's resets are driven directly by the reset inputs so that they are controllable for scan test. The shadow core is then no longer aligned to the main core. Corruption detection is therefore suspended while `scan_mode` is set, and remains suspended until the next Caliptra reset after `scan_mode` is cleared.

Expand Down
2 changes: 1 addition & 1 deletion docs/CaliptraIntegrationSpecification.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ The mux only re-sources these observation-only ports; it does not affect functio

| Signal name | Width | Driver | Synchronous (as viewed from Caliptra’s boundary) | Description |
| :--------- | :--------- | :--------- | :--------- | :--------- |
| dcls_en | 1 | Input | Synchronous to clk | Enables RISC-V dual-core lockstep (DCLS) in both Passive and Subsystem modes (1 = enabled, 0 = disabled), controlling normal mismatch reporting. May be tied low, tied high, or driven by a synchronous SoC register. The sampled requested enable is reflected read-only in `CPTRA_HW_CONFIG.DCLS_en`. |
| dcls_en | 1 | Input Strap | Synchronous to clk | Sampled on noncore reset release. Used in both Passive and Subsystem modes. Enables normal RISC-V dual-core lockstep (DCLS) mismatch reporting (1 = enabled, 0 = disabled). Must be stable before `cptra_rst_b` deassertion and through capture. The sampled value is held until the next noncore reset and reflected read-only in `CPTRA_HW_CONFIG.DCLS_en`. |
| cptra_obf_key | 256 | Input Strap | Asynchronous | Obfuscation key is driven by SoC at integration time. Ideally this occurs just before tape-in and the knowledge of this key must be protected unless PUF is driving this. The key is latched by Caliptra upon first deassertion of the warm reset following caliptra powergood assertion. It is not resampled during subsequent warm resets, therefore the value is only captured upon a cold boot. It is cleared after its use and can only re-latched on a power cycle (powergood deassertion to assertion). |
| cptra_csr_hmac_key | 512 | Input Strap | Asynchronous | CSR HMAC key is driven by SoC at integration time. Ideally this occurs just before tape-in and the knowledge of this key must be protected. The key is latched by Caliptra following deassertion of the noncore warm reset during DEVICE_MANUFACTURING lifecycle state. This key input is ignored in all other lifecycle states.|
| cptra_obf_field_entropy_vld | 1 | Input | Synchronous to clk | Used in Subsystem mode only. In Passive mode, integrators shall tie this input to 0. Valid signal used to sample cptra_obf_field_entropy if it is driven by wires from the fuse controller. |
Expand Down
4 changes: 3 additions & 1 deletion src/integration/asserts/caliptra_top_sva.sv
Original file line number Diff line number Diff line change
Expand Up @@ -1796,9 +1796,11 @@ module caliptra_top_sva

`ifdef RV_LOCKSTEP_ENABLE
`define DCLS_ASSERT_PATH `CPTRA_TOP_PATH.rvtop.lockstep
// disable iff is unsampled; require sampled reset high before checking capture.
DCLS_enable_sampled: assert property (
@(posedge `SVA_RDC_CLK) disable iff (!`SOC_IFC_TOP_PATH.cptra_noncore_rst_b)
`SOC_IFC_TOP_PATH.cptra_noncore_rst_b |=> `SOC_IFC_TOP_PATH.soc_ifc_reg_hwif_out.CPTRA_HW_CONFIG.DCLS_en.value ==
(`SOC_IFC_TOP_PATH.cptra_noncore_rst_b && `SOC_IFC_TOP_PATH.strap_we) |=>
`SOC_IFC_TOP_PATH.soc_ifc_reg_hwif_out.CPTRA_HW_CONFIG.DCLS_en.value ==
$past(`CPTRA_TOP_PATH.dcls_en))
else $error("SVA ERROR: DCLS input was not sampled into read-only HW_CONFIG");

Expand Down
2 changes: 1 addition & 1 deletion src/integration/rtl/caliptra_top.sv
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ module caliptra_top
input logic itrng1_valid,
input logic itrng1_en,

// DCLS enable in both profiles; synchronous to clk.
// DCLS enable strap, captured after each noncore reset
input logic dcls_en,

// Subsystem mode straps
Expand Down
40 changes: 30 additions & 10 deletions src/integration/tb/caliptra_top_tb_dcls.svh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ endtask
task automatic dcls_check_config(input bit enabled);
logic [31:0] data;
dcls_read(`CLP_SOC_IFC_REG_CPTRA_HW_CONFIG, data);
if (((data & `SOC_IFC_REG_CPTRA_HW_CONFIG_DCLS_EN_MASK) != 0) != enabled)
if (((data & `SOC_IFC_REG_CPTRA_HW_CONFIG_DCLS_EN_MASK) != 0) !== enabled)
$fatal(1, "DCLS: enable readback mismatch: %h expected %0d", data, enabled);
`ifdef CALIPTRA_MODE_SUBSYSTEM
if (!(data & `SOC_IFC_REG_CPTRA_HW_CONFIG_SUBSYSTEM_MODE_EN_MASK))
Expand All @@ -99,12 +99,23 @@ task automatic dcls_check_config(input bit enabled);
`endif
endtask

task automatic dcls_set_enable(input bit enabled);
task automatic dcls_drive_enable(input bit enabled, input bit captured_enable);
@(negedge core_clk);
dcls_en = enabled;
repeat (8) @(negedge core_clk);
dcls_check_config(captured_enable);
endtask

task automatic dcls_set_enable(input bit enabled);
logic [31:0] config_data;
dcls_read(`CLP_SOC_IFC_REG_CPTRA_HW_CONFIG, config_data);
dcls_drive_enable(enabled, (config_data & `SOC_IFC_REG_CPTRA_HW_CONFIG_DCLS_EN_MASK) != 0);
if (((config_data & `SOC_IFC_REG_CPTRA_HW_CONFIG_DCLS_EN_MASK) != 0) != enabled) begin
dcls_check_status(0, 0);
dcls_warm_reset(0);
end
dcls_check_config(enabled);
$display("DCLS: reporting enable=%0d", enabled);
$display("DCLS: captured reporting enable=%0d", enabled);
endtask

task automatic dcls_check_status(input bit status, input bit fatal_output);
Expand Down Expand Up @@ -301,6 +312,8 @@ endtask
task automatic dcls_core_reset(input bit status, input bit fatal_output);
int unsigned previous_boot = dcls_boot_count;
bit reset_seen = 0;
logic [31:0] config_data;
dcls_read(`CLP_SOC_IFC_REG_CPTRA_HW_CONFIG, config_data);
dcls_release_faults();
@(negedge core_clk);
force `CPTRA_TOP_PATH.soc_ifc_top1.i_soc_ifc_boot_fsm.fw_update_rst = 1'b1;
Expand All @@ -313,6 +326,7 @@ task automatic dcls_core_reset(input bit status, input bit fatal_output);
release `CPTRA_TOP_PATH.soc_ifc_top1.i_soc_ifc_boot_fsm.fw_update_rst;
dcls_check_status(status, fatal_output);
dcls_wait_boot(previous_boot);
dcls_check_config((config_data & `SOC_IFC_REG_CPTRA_HW_CONFIG_DCLS_EN_MASK) != 0);
if (`DCLS_LS.dbg_detected !== el2_mubi_pkg::El2MuBiFalse)
$fatal(1, "DCLS: core reset did not clear debug history");
dcls_check_status(status, fatal_output);
Expand Down Expand Up @@ -383,8 +397,8 @@ endtask

task automatic dcls_outputs_scenario;
dcls_comparator_case(0);
dcls_set_enable(0);
dcls_check_status(1, 1); // Disable never clears a latched fatal.
dcls_drive_enable(0, 1);
dcls_check_status(1, 1); // A strap change cannot clear a latched fatal.
dcls_core_reset(1, 1);
dcls_warm_reset(1);
dcls_clear_status(0);
Expand Down Expand Up @@ -413,16 +427,23 @@ task automatic dcls_control_scenario;
dcls_observe_fault(0);
dcls_quiet();
dcls_release_faults();
dcls_drive_enable(1, 0);
dcls_core_reset(0, 0);
dcls_set_enable(1);
dcls_quiet();
dcls_drive_enable(0, 1);
dcls_core_reset(0, 0);
dcls_set_enable(0);
dcls_start_fault(0);
dcls_observe_fault(0);
dcls_quiet();
dcls_set_enable(1); // A mismatch still present when enabling must report.
dcls_release_faults();
dcls_set_enable(1);
dcls_start_fault(0);
dcls_observe_fault(0);
dcls_wait_fatal();
dcls_release_faults();
dcls_set_enable(0);
dcls_drive_enable(0, 1);
dcls_check_status(1, 1);
dcls_clear_status(1);
dcls_power_reset();
Expand All @@ -439,7 +460,7 @@ task automatic dcls_qualifications_scenario;
dcls_start_fault(0); dcls_observe_fault(0); dcls_quiet(); dcls_release_faults();
dcls_debug_exit();
dcls_start_fault(0); dcls_observe_fault(0); dcls_quiet(); dcls_release_faults();
dcls_set_enable(0); dcls_set_enable(1);
dcls_drive_enable(0, 1); dcls_drive_enable(1, 1);
dcls_start_fault(0); dcls_observe_fault(0); dcls_quiet(); dcls_release_faults();
dcls_core_reset(0, 0);
dcls_start_fault(0); dcls_observe_fault(0); dcls_wait_fatal();
Expand All @@ -448,9 +469,8 @@ task automatic dcls_qualifications_scenario;
// Invalid MuBi bypasses enable and debug suppression.
dcls_set_enable(0);
dcls_invalid_disable(); dcls_wait_fatal(); dcls_power_reset();
dcls_set_enable(1);
dcls_debug_enter(); dcls_debug_exit();
dcls_set_enable(0);
dcls_debug_enter(); dcls_debug_exit();
dcls_invalid_disable(); dcls_wait_fatal(); dcls_power_reset();

// Keep reporting enabled to isolate reset qualification.
Expand Down
6 changes: 4 additions & 2 deletions src/soc_ifc/rtl/soc_ifc_top.sv
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ module soc_ifc_top
output kv_read_t kv_read,
input kv_rd_resp_t kv_rd_resp,

// DCLS enable in both profiles; synchronous to clk.
// DCLS enable strap, captured after each noncore reset
input logic dcls_en,

// Subsystem mode straps
Expand Down Expand Up @@ -583,7 +583,9 @@ always_comb soc_ifc_reg_hwif_in.CPTRA_HW_CONFIG.LMS_acc_en.next = 1'b1;
always_comb soc_ifc_reg_hwif_in.CPTRA_HW_CONFIG.OCP_LOCK_MODE_en.next = 1'b0;
always_comb soc_ifc_reg_hwif_in.CPTRA_HW_CONFIG.dual_iTRNG_en.next = 1'b0;
`endif
always_comb soc_ifc_reg_hwif_in.CPTRA_HW_CONFIG.DCLS_en.next = dcls_en;
// Capture on every noncore reset
always_comb soc_ifc_reg_hwif_in.CPTRA_HW_CONFIG.DCLS_en.next =
strap_we ? dcls_en : soc_ifc_reg_hwif_out.CPTRA_HW_CONFIG.DCLS_en.value;
Comment thread
Nitsirks marked this conversation as resolved.
Resolved
// dual_iTRNG_en stored value exported to drive the entropy combiner's combine_en
// (0 unless subsystem mode + internal TRNG).
always_comb dual_itrng_en_o = soc_ifc_reg_hwif_out.CPTRA_HW_CONFIG.dual_iTRNG_en.value;
Expand Down
17 changes: 13 additions & 4 deletions src/soc_ifc/tb/dcls_hw_config_test.svh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Check DCLS enable transitions in soc_ifc_tb and soc_ifc_tb_ss.
// Check DCLS reset capture and hold in soc_ifc_tb and soc_ifc_tb_ss.
task dcls_hw_config_test;
strq_t reglist;
dword_t predicted;
Expand All @@ -30,10 +30,12 @@ task dcls_hw_config_test;
expected_config.update_byname("CPTRA_HW_CONFIG", get_initval("CPTRA_HW_CONFIG"), 1);
sb.record_entry(expected_config, SET_DIRECT);
for (int ocp = 0; ocp < 2; ocp++) begin
for (int step = 0; step < 4; step++) begin
for (int step = 0; step < 2; step++) begin
@(negedge clk_tb);
ocp_lock_en_tb = 1'(ocp);
dcls_en_tb = 1'(step % 2);
warm_reset_dut();
simulate_caliptra_boot();
predicted = update_CPTRA_HW_CONFIG();
expected_fields = dcls_en_tb ? dword_t'(`SOC_IFC_REG_CPTRA_HW_CONFIG_DCLS_EN_MASK) : '0;
if (subsystem_mode_tb) begin
Expand All @@ -53,8 +55,15 @@ task dcls_hw_config_test;
tc_ctr++;
read_regs(GET_AXI, reglist, -1, 1);
read_regs(GET_AHB, reglist, -1, 1);
$display("DCLS HW_CONFIG profile=%0b OCP=%0b DCLS=%0b verified",
subsystem_mode_tb, ocp_lock_en_tb, dcls_en_tb);
// Keep the captured prediction when the input changes after boot.
@(negedge clk_tb);
dcls_en_tb = ~dcls_en_tb;
repeat (3) @(posedge clk_tb);
tc_ctr++;
read_regs(GET_AXI, reglist, -1, 1);
read_regs(GET_AHB, reglist, -1, 1);
$display("DCLS HW_CONFIG profile=%0b OCP=%0b captured DCLS=%0b held across pin change",
subsystem_mode_tb, ocp_lock_en_tb, 1'(step % 2));
end
end
error_ctr += sb.err_count;
Expand Down
Loading