-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
40,376 additions
and
42 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/.vscode | ||
/logs | ||
/dependencies/elf | ||
Cargo.lock |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use std::path::Path; | ||
use std::path::PathBuf; | ||
use std::{env, fs}; | ||
use verilator::gen::{Standard, Verilator}; | ||
use verilator::module::ModuleGenerator; | ||
|
||
macro_rules! t { | ||
($e:expr) => { | ||
match $e { | ||
Ok(e) => e, | ||
Err(e) => panic!("{} failed with {}", stringify!($e), e), | ||
} | ||
}; | ||
} | ||
|
||
fn main() { | ||
let out_dir = env::var("OUT_DIR").unwrap(); | ||
let out_dir = PathBuf::from(out_dir); | ||
let _ = fs::remove_dir_all(&out_dir); | ||
t!(fs::create_dir_all(&out_dir)); | ||
|
||
// Generate CPP shim from RUST | ||
let mut module = ModuleGenerator::default(); | ||
module.generate("src/dut/top.rs"); | ||
|
||
// Generate CPP from Verilog | ||
let mut verilator = Verilator::default(); | ||
|
||
let dir = Path::new("myCPU"); | ||
let files: Vec<_> = fs::read_dir(dir) | ||
.expect("Directory not found") | ||
.filter_map(|entry| entry.ok().and_then(|e| e.path().to_str().map(|s| String::from(s)))) | ||
.collect(); | ||
|
||
println!("Files: {:?}", files); | ||
|
||
verilator.with_coverage(true).with_trace(true); | ||
|
||
for file in &files { | ||
verilator.file_with_standard(file, Standard::Verilog2005); | ||
} | ||
|
||
verilator.file(out_dir.join("mycpu_top.cpp")).build("mycpu_top"); | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.