Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Artifact with missing changes for hardware generation #123

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4206ccb
benches: small fixes and adding the --smoke option
achreto Oct 16, 2024
2ac7a7e
velosicodegen: handle a bug in the code generation
achreto Oct 16, 2024
021b44e
tests: adding a test for artifact code generation
achreto Oct 16, 2024
319bedb
tests: adding building of the Arm FastModels platforms
achreto Nov 27, 2024
931882a
more work on getting the fast models tests automated
achreto Nov 29, 2024
6b185c6
bump the arm-fastmodels-boot submodule
achreto Nov 29, 2024
11512f6
One-command run hw on docker
mlechu Oct 15, 2023
2eced66
Pass tests into arm-fastmodels-boot
mlechu Nov 17, 2023
2dbfd5b
Add topological unit sort and temp functions
mlechu Jan 25, 2024
03616df
Fix translate (default return false) and OOB call to add_slice
mlechu Feb 19, 2024
51fab1f
Bump submodule, update x86 test, tweaks
mlechu Feb 20, 2024
f6d7d0e
Separate cpp and hpp for unit files
mlechu Feb 20, 2024
caebf9d
Fix base addr of next unit not being generated
mlechu Feb 21, 2024
4de5416
Update framework and hwgen to take more state parameters
mlechu Feb 22, 2024
4d319e3
hwgen tweaks
mlechu Feb 22, 2024
436c2d8
temp commit: hwgen x86_64 tested, but with undesired vrs clause
mlechu Feb 23, 2024
6041334
Generate offset mask
mlechu Feb 23, 2024
d0da0c9
framework: adding register and memory state field classes
achreto Feb 23, 2024
4b9a638
lib/velosihwgen: getting back support for the registers
achreto Feb 23, 2024
ddd6138
lib/velosicomposition: apply clippy suggestion
achreto Feb 23, 2024
bb9511c
tests: fix a thing or two in the tests
achreto Feb 23, 2024
bd5f765
benches: appllying formatter
achreto Nov 29, 2024
3aa00eb
lib/velosihwgen: adding missing type to make it compile standalone
achreto Nov 29, 2024
6440f72
applying formatter
achreto Nov 29, 2024
cda49e7
lib/velosiraptor-parser: bump submodule version
achreto Dec 4, 2024
b1c42af
lib/codegen: bump submodule
achreto Dec 4, 2024
ab92ba8
lib/crustal: bump submodule
achreto Dec 4, 2024
e61aed4
lib/smtlib2: bump submodule
achreto Dec 4, 2024
81255a7
lib/velosiast: limit debug print output
achreto Dec 4, 2024
496a91a
lib/velosihwgen: apply clippy suggestions
achreto Dec 4, 2024
be355bc
lib/velosisynth: applying clippy suggestions
achreto Dec 4, 2024
fd47a65
upgrade rust toolchain
achreto Dec 4, 2024
6d4cc1c
lib/velosiast: fixing adding registers to symboltable
achreto Dec 4, 2024
a76090d
tests: some cleanup
achreto Dec 4, 2024
935b840
support/fast-models-boot: update submodule
achreto Dec 5, 2024
7fa32e8
lib/crustal: bump submodule
achreto Dec 5, 2024
cc52c9c
lib/velosiast: adding information on register state to the ast
achreto Dec 5, 2024
2d2cbf7
fastmodels/framework: make some functions overwritable and change log…
achreto Dec 5, 2024
fc3fcc5
lib/velosihwgen: don't emit registers classes for abstract units
achreto Dec 6, 2024
8af0778
lib/velosihwgen: handle staticmaps with registers
achreto Dec 6, 2024
d0d5785
examples: some fixes in the specifications
achreto Dec 6, 2024
9a24f8d
support/arm-fastmodels-boot: bump submodule
achreto Dec 7, 2024
56b394a
tests: make the remaning fastmodels boot tests run automated
achreto Dec 7, 2024
deeeaa4
tests: applying formatter
achreto Dec 7, 2024
0596b97
make the submodules use https instead of ssh
achreto Jan 31, 2025
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
16 changes: 8 additions & 8 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[submodule "lib/codegen"]
path = lib/codegen
url = git@github.com:achreto/codegen-rs.git
url = https://github.com/achreto/codegen-rs.git
[submodule "lib/crustal"]
path = lib/crustal
url = git@github.com:achreto/crustal.git
url = https://github.com/achreto/crustal.git
[submodule "lib/smtlib2"]
path = lib/smtlib2
url = git@github.com:achreto/rust-smtlib2.git
url = https://github.com/achreto/rust-smtlib2.git
[submodule "lib/srcspan"]
path = lib/srcspan
url = git@github.com:achreto/rust-srcspan.git
url = https://github.com/achreto/rust-srcspan.git
[submodule "lib/tokstream"]
path = lib/tokstream
url = git@github.com:achreto/rust-tokstream.git
url = https://github.com/achreto/rust-tokstream.git
[submodule "lib/z3"]
path = lib/z3
url = git@github.com:achreto/z3.rs.git
url = https://github.com/achreto/z3.rs.git
[submodule "support/arm-fastmodels-boot"]
path = support/arm-fastmodels-boot
url = git@github.com:achreto/arm-fastmodels-boot.git
url = https://github.com/achreto/arm-fastmodels-boot.git
[submodule "lib/velosiraptor-parser"]
path = lib/velosiraptor-parser
url = git@github.com:ubc-systopia/velosiraptor-parser.git
url = https://github.com/ubc-systopia/velosiraptor-parser.git
12 changes: 6 additions & 6 deletions benches/runtime/bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ int main() {

x8664pml4__t vroot;
x8664pml4_alloc(&vroot);
run_benchmark("Arbutus-x86_64-Map", velosiraptor_map_one, &vroot, vaddr, paddr);
run_benchmark("Arbutus-x86_64-Protect", velosiraptor_protect_one, &vroot, vaddr, paddr);
run_benchmark("Arbutus-x86_64-Unmap", velosiraptor_unmap_one, &vroot, vaddr, paddr);
run_benchmark("Velosiraptor-x86_64-Map", velosiraptor_map_one, &vroot, vaddr, paddr);
run_benchmark("Velosiraptor-x86_64-Protect", velosiraptor_protect_one, &vroot, vaddr, paddr);
run_benchmark("Velosiraptor-x86_64-Unmap", velosiraptor_unmap_one, &vroot, vaddr, paddr);


void *st = barrelfish_init();
Expand All @@ -134,8 +134,8 @@ int main() {

x8664pagetable__t pt;
x8664pagetable_alloc(&pt);
run_benchmark("Arbutus-PTable-Map", velosiraptor_pte_map, &pt, vaddr, paddr);
run_benchmark("Arbutus-PTable-Protect", velosiraptor_pte_protect, &pt, vaddr, paddr);
run_benchmark("Arbutus-PTable-Unmap", velosiraptor_pte_unmap, &pt, vaddr, paddr);
run_benchmark("Velosiraptor-PTable-Map", velosiraptor_pte_map, &pt, vaddr, paddr);
run_benchmark("Velosiraptor-PTable-Protect", velosiraptor_pte_protect, &pt, vaddr, paddr);
run_benchmark("Velosiraptor-PTable-Unmap", velosiraptor_pte_unmap, &pt, vaddr, paddr);

}
4 changes: 2 additions & 2 deletions benches/runtime/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ use bench::*;

const ROWS: [&str; 4] = [
"Linux-x86_64",
"Arbutus-x86_64",
"Velosiraptor-x86_64",
"Barrelfish-PTable",
"Arbutus-PTable",
"Velosiraptor-PTable",
];

const COLS: [&str; 3] = ["Map", "Protect", "Unmap"];
Expand Down
2 changes: 1 addition & 1 deletion benches/synth/bench.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub const NUM_WORKERS: usize = 13; // give one core to the main program...
pub const NUM_WORKERS: usize = 23; // give one core to the main program...
pub const ITERATIONS: usize = 100;

pub struct Stats {
Expand Down
23 changes: 11 additions & 12 deletions benches/synth/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ const LINUX_GIT_URL: &str =
"https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/noble";
const LINUX_GIT_SHA: &str = "74134bfb6b720ca18a73931662cbcc8170ef1bed";

fn compile_linux(nworkers: usize) -> Option<Stats> {
fn compile_linux(nworkers: usize, iterations: usize) -> Option<Stats> {
println!("Running Linux Compilation Benchmark");

let config_file = Path::new(file!()).parent().unwrap().join("ubuntu.config");
Expand Down Expand Up @@ -290,7 +290,7 @@ fn compile_linux(nworkers: usize) -> Option<Stats> {
.output()
.expect("failed to execute process");

let bar = ProgressBar::new(ITERATIONS.try_into().unwrap());
let bar = ProgressBar::new(iterations.try_into().unwrap());
bar.set_style(
ProgressStyle::with_template(
"{spinner:.dim.bold} [{bar:40.cyan/blue}] {pos}/{len} - {msg:20}",
Expand All @@ -300,8 +300,8 @@ fn compile_linux(nworkers: usize) -> Option<Stats> {
);

let parallelism = format!("-j{}", nworkers);
let mut measurements = Vec::with_capacity(ITERATIONS);
for _ in 0..ITERATIONS {
let mut measurements = Vec::with_capacity(iterations);
for _ in 0..iterations {
bar.set_message("make clean");
// println!(" - Running make clean");
Command::new("make")
Expand Down Expand Up @@ -346,6 +346,7 @@ fn main() {
let is_dirty = !output.stdout.is_empty();
let build_dirty = env!("VERGEN_GIT_DIRTY") == "true";
let allow_dirty = args.iter().any(|e| e.as_str() == "--allow-dirty");
let is_smoke = args.iter().any(|e| e.as_str() == "--smoke");

if is_dirty && !allow_dirty {
println!("ERROR. Git repository is dirty. Terminating.");
Expand All @@ -362,10 +363,8 @@ fn main() {
let mut latex_results = String::new();
let mut latex_results_no_tree = String::new();

let nworkers = std::cmp::max(
if nthreads > 1 { (nthreads / 2) - 1 } else { 1 },
NUM_WORKERS,
);
let nworkers = if nthreads > 1 { (nthreads / 2) - 1 } else { 1 };
let iterations = if is_smoke { 5 } else { ITERATIONS };
for (spec, name) in SPECS.iter() {
println!(" @ Spec: {spec}");

Expand All @@ -387,7 +386,7 @@ fn main() {
let mut results = BenchResults::new(name.to_string());
let mut had_errors = false;
print!(" ");
let bar = ProgressBar::new(ITERATIONS.try_into().unwrap());
let bar = ProgressBar::new(iterations.try_into().unwrap());
bar.set_style(
ProgressStyle::with_template(
"{spinner:.dim.bold} [{bar:40.cyan/blue}] {pos}/{len} - {msg:20}",
Expand All @@ -396,7 +395,7 @@ fn main() {
.tick_chars("/|\\- "),
);

for _ in 0..ITERATIONS {
for _ in 0..iterations {
// create synth factory and run synthesis on the segments
let mut z3_workers = Z3WorkerPool::with_num_workers(nworkers, None);
if let Some(res) = run_synthesis(
Expand Down Expand Up @@ -445,7 +444,7 @@ fn main() {
}
latex_results.push_str(" \\hline % ---------------------------------------------------------------------------------");

let linux_times = compile_linux(nthreads);
let linux_times = compile_linux(nthreads, iterations);

println!("# Completed\n\n");

Expand All @@ -468,7 +467,7 @@ fn main() {
println!("% Date: {}", Local::now());
println!("% Threads: {}", nthreads);
println!("% Workers: {}", nworkers);
println!("% Iterations: {}", ITERATIONS);
println!("% Iterations: {}", iterations);
println!(
"% =========================================================================================="
);
Expand Down
2 changes: 1 addition & 1 deletion examples/assoc_segment.vrs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ segment AssocSegment(base : addr) {
mmio dst [ base, 0, 8 ],
mmio src [ base, 8, 8 ],
mmio length [ base, 16, 8 ],
mmio perms [ base, 16, 8 ],
mmio perms [ base, 24, 8 ],
}

// add the valid bit
Expand Down
36 changes: 18 additions & 18 deletions examples/mpu.vrs
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,24 @@ segment MPU(base: addr) {
// 4 .. 5 _res, // reserved
5 .. 32 limit // limit
},
reg rbar_a1 [ 4 ] {
0..32 _res,
},
reg rlar_a1 [ 4 ] {
0..32 _res,
},
reg rbar_a2 [ 4 ] {
0..32 _res,
},
reg rlar_a2 [ 4 ] {
0..32 _res,
},
reg rbar_a3 [ 4 ] {
0..32 _res,
},
reg rlar_a3 [ 4 ] {
0..32 _res,
},
// reg rbar_a1 [ 4 ] {
// 0..32 _res,
// },
// reg rlar_a1 [ 4 ] {
// 0..32 _res,
// },
// reg rbar_a2 [ 4 ] {
// 0..32 _res,
// },
// reg rlar_a2 [ 4 ] {
// 0..32 _res,
// },
// reg rbar_a3 [ 4 ] {
// 0..32 _res,
// },
// reg rlar_a3 [ 4 ] {
// 0..32 _res,
// },
reg mair0 [ 4 ] {
0 .. 8 attr0,
8 .. 16 attr1,
Expand Down
4 changes: 2 additions & 2 deletions examples/multisegment.vrs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ segment SingleSegment(base : addr) {
fn translate(va: vaddr) -> paddr
requires va < PAGE_SIZE
{
va + state.seg.address << 4
va + (state.seg.address << 4)
}

synth fn map(va: vaddr, sz: size, flgs: flags, pa : paddr)
Expand All @@ -83,6 +83,6 @@ segment SingleSegment(base : addr) {


// represents an x86 page directory entry
staticmap X8632PageDirectory(base : paddr) {
staticmap MultiSegment(base : paddr) {
maps [ SingleSegment(base + i * 8) for i in 0..NUM_REGIONS ]
}
2 changes: 1 addition & 1 deletion examples/simple_translation_table.vrs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ segment X86_MMU(base: paddr) {
fn translate(va: vaddr) -> paddr
requires va < VSPACE_ADDR_MAX
{
va + (state.ttbr.address << 12)
(state.ttbr.address << 12)
}

synth fn map(va: vaddr, sz: size, flgs: flags, pa : PageTable)
Expand Down
4 changes: 2 additions & 2 deletions examples/x86_32_pagetable.vrs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ segment X8632PageDirectoryEntryTable(base : paddr) {
fn translate(va: vaddr) -> paddr
requires state.entry.pagesize == 0
{
va + (state.entry.address << 12)
(state.entry.address << 12)
}

// unmapping an entry
Expand Down Expand Up @@ -372,7 +372,7 @@ segment X86MMU(base: paddr) {
fn translate(va: vaddr) -> paddr
{
if state.cr4.enabled == 1 {
va + (state.cr3.address << 12)
(state.cr3.address << 12)
} else {
va
}
Expand Down
4 changes: 2 additions & 2 deletions examples/x86_64_pagetable.vrs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ abstract segment X8664PTableDescriptor(base: paddr) {
fn translate(va: vaddr) -> paddr
requires state.entry.ps == 0
{
(state.entry.address << 12)
state.entry.address << BASE_PAGE_BITS
}
}

Expand Down Expand Up @@ -461,7 +461,7 @@ segment X86MMU(base: paddr) {
requires va < VSPACE_SIZE
{
if state.cr4.enabled == 1 {
va + (state.cr3.address << 12)
state.cr3.address << BASE_PAGE_BITS
} else {
va
}
Expand Down
8 changes: 4 additions & 4 deletions examples/x86_segmentation.vrs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ abstract segment SegmentDescriptorBase(base: addr) {


state(base: addr) {
mem entry_lo [ base, 0, 4 ] {
reg entry_lo [ 4 ] {
0 .. 16 limit0, // segment limit [15:0]
16 .. 32 base0, // base[15:0]
},
mem entry_hi [ base, 4, 4 ] {
reg entry_hi [ 4 ] {
0 .. 8 base1, // base[16:23]
8 .. 9 typ_code,
9 .. 10 typ_ec,
Expand All @@ -59,8 +59,8 @@ abstract segment SegmentDescriptorBase(base: addr) {
}

interface(base: addr) {
mem entry_lo [ base, 0, 4 ],
mem entry_hi [ base, 4, 4 ],
mmio entry_lo [ base, 0, 4 ],
mmio entry_hi [ base, 4, 4 ],
}

#[remap]
Expand Down
2 changes: 1 addition & 1 deletion lib/codegen
Submodule codegen updated 2 files
+1 −1 src/formatter.rs
+0 −3 src/module.rs
2 changes: 1 addition & 1 deletion lib/crustal
2 changes: 1 addition & 1 deletion lib/smtlib2
Submodule smtlib2 updated 2 files
+1 −16 src/formatter.rs
+0 −2 src/lib.rs
9 changes: 9 additions & 0 deletions lib/velosiast/src/ast/interface/fields/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ impl VelosiAstInterfaceField {
}
}

pub fn offset(&self) -> u64 {
match self {
VelosiAstInterfaceField::Memory(field) => field.offset,
VelosiAstInterfaceField::Register(_field) => 0,
VelosiAstInterfaceField::Mmio(field) => field.offset,
VelosiAstInterfaceField::Instruction(_field) => 0,
}
}

pub fn nbits(&self) -> u64 {
match self {
VelosiAstInterfaceField::Memory(field) => field.nbits(),
Expand Down
8 changes: 8 additions & 0 deletions lib/velosiast/src/ast/interface/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,14 @@ impl VelosiAstInterface {
.collect::<HashSet<Rc<String>>>()
}

pub fn register_region_size(&self) -> u64 {
self.fields
.iter()
.map(|f| f.offset() + f.size())
.max()
.unwrap_or(0)
}

pub fn bit_slice_idents(&self) -> HashSet<Rc<String>> {
self.fields
.iter()
Expand Down
Loading
Loading