-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hw-model-verilator: Set SRAM to random PUF state on start. (#1064)
To simulate the worst-case power-on behavior of real SRAM, this will trigger ECC errors if firmware tries to read from uninitialized memory. Addresses #1041
- Loading branch information
Showing
16 changed files
with
274 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ verilator = [] | |
itrng = [] | ||
|
||
[dependencies] | ||
rand.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Licensed under the Apache-2.0 license | ||
|
||
#![no_main] | ||
#![no_std] | ||
|
||
use caliptra_registers::{self, mbox::MboxCsr, soc_ifc::SocIfcReg}; | ||
|
||
// Needed to bring in startup code | ||
#[allow(unused)] | ||
use caliptra_test_harness; | ||
|
||
#[panic_handler] | ||
pub fn panic(_info: &core::panic::PanicInfo) -> ! { | ||
loop {} | ||
} | ||
|
||
#[no_mangle] | ||
extern "C" fn main() { | ||
let mut mbox = unsafe { MboxCsr::new() }; | ||
let mut soc_ifc = unsafe { SocIfcReg::new() }; | ||
|
||
let ptr = soc_ifc.regs_mut().cptra_rsvd_reg().at(0).read() as *const u32; | ||
let size = soc_ifc.regs_mut().cptra_rsvd_reg().at(1).read() as usize; | ||
|
||
// Lock the mailbox so we can access the mailbox SRAM if necessary | ||
mbox.regs_mut().lock().read(); | ||
|
||
let mut i = 0; | ||
while i < size / 4 { | ||
unsafe { ptr.add(i).read_volatile() }; | ||
i += 1; | ||
} | ||
|
||
// Exit success | ||
soc_ifc | ||
.regs_mut() | ||
.cptra_generic_output_wires() | ||
.at(0) | ||
.write(|_| 0xff); | ||
loop {} | ||
} |
Oops, something went wrong.