Skip to content

Commit 77233b3

Browse files
authored
Merge pull request #505 from OpenVADL/feature/cosim-ringbuf
iss: Migrated cosimulation lockstep to using a ringbuffer
2 parents 0806e05 + f77a6ff commit 77233b3

File tree

13 files changed

+452
-531
lines changed

13 files changed

+452
-531
lines changed

vadl-cosim/broker/src/main.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ use figment::{
88
};
99
use tracing::{Level, info};
1010

11-
use cosim_lib::{
12-
config::Config, cosim::Broker, db::setup_database, diff::Report, trace::connect,
13-
};
11+
use cosim_lib::{config::Config, cosim::Broker, db::setup_database, diff::Report, trace::connect};
1412

1513
#[derive(Parser, Debug)]
1614
#[command(version, about, long_about = None)]
@@ -58,6 +56,10 @@ fn main() -> Result<()> {
5856
setup_database(&mut conn).context("failed to setup database")?;
5957
}
6058

59+
run(config)
60+
}
61+
62+
fn run(config: Config) -> Result<()> {
6163
let mut broker = Broker::create(&config)?;
6264
let report_data = broker.run(&config)?;
6365
let passed = report_data.passed;
@@ -82,9 +84,7 @@ fn main() -> Result<()> {
8284
None => println!("{report}"),
8385
}
8486

85-
broker.finish(passed, &config)?;
86-
87-
Ok(())
87+
broker.finish(passed, &config)
8888
}
8989

9090
fn add_plain_report_summary(buf: &mut String, report: &Report) {
@@ -112,13 +112,14 @@ fn add_plain_report_summary(buf: &mut String, report: &Report) {
112112
.diff_context
113113
.iter()
114114
.map(|ctx| &ctx.error_instruction.0)
115-
.min_by_key(|insns| insns.len())
116-
.unwrap();
117-
118-
for insn in min_insns {
119-
let pc = insn.pc;
120-
let disas = &insn.disas;
121-
let insn_data = &insn.insn_data;
122-
buf.push_str(&format!("- (pc={pc}): {disas} ({insn_data})\n"));
115+
.min_by_key(|insns| insns.len());
116+
117+
if let Some(min_insns) = min_insns {
118+
for insn in min_insns {
119+
let pc = insn.pc;
120+
let disas = &insn.disas;
121+
let insn_data = &insn.insn_data;
122+
buf.push_str(&format!("- (pc={pc}): {disas} ({insn_data})\n"));
123+
}
123124
}
124125
}

vadl-cosim/config.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ignore_unset_registers = true
2727

2828
# Ignore specific registers
2929
# Filters in conjunction with `ignore_unset_registers`
30-
ignore_registers = [ "s0", "x0" ]
30+
ignore_registers = [ "s0", "x0", "pc" ]
3131

3232

3333
# Defines a list of clients to test against
@@ -168,10 +168,11 @@ layer = "tb"
168168
mode = "lockstep"
169169

170170
# Execute all remaining instructions (overrides `stop_after_n_instructions` if set to true)
171-
execute_all_remaining_instructions = true
171+
execute_all_remaining_instructions = false
172172

173173
# Execute the next (after skipped) n instructions
174-
stop_after_n_instructions = 10000
174+
stop_after_n_instructions = 100000
175+
# stop_after_n_instructions = 1
175176

176177
# Where the test result should be saved and in which format
177178
[testing.protocol.out]
@@ -183,7 +184,7 @@ verbosity = "short"
183184
[logging]
184185
enable = true
185186
# tracing log-levels as defined here: https://docs.rs/tracing/latest/tracing/struct.Level.html#implementations
186-
level = "info"
187+
level = "debug"
187188

188189
# The directory will also contain files for the stdout and stderr of each client
189190
dir = "./cosim-run/log"
@@ -209,7 +210,7 @@ clear_on_rerun = true
209210
# (-): Tracing data is only available at the end of the cosimulation-process.
210211
# => This mode is probably most useful when manually running a test where the test-result is not known beforehand. In most cases using a combination of "none" and "sync" is probably preferred.
211212
[tracing]
212-
mode = "sync"
213+
mode = "none"
213214
# NOTE: If no db-file is found at the given path then one will be automatically created.
214215
dir = "./cosim-run/trace"
215216
file = "trace.sqlite3"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)