-
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.
fix(macros): Support visibility modifiers on model
struct
s (#46)
- Loading branch information
1 parent
8a6b0dc
commit f34c554
Showing
4 changed files
with
55 additions
and
1 deletion.
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
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,47 @@ | ||
// Copyright (C) 2024 Ethan Uppal. | ||
// | ||
// This program is free software: you can redistribute it and/or modify it under | ||
// the terms of the GNU General Public License as published by the Free Software | ||
// Foundation, version 3 of the License only. | ||
// | ||
// This program is distributed in the hope that it will be useful, but WITHOUT | ||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
// details. | ||
// | ||
// You should have received a copy of the GNU General Public License along with | ||
// this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
use snafu::Whatever; | ||
use verilog::{VerilatorRuntime, VerilatorRuntimeOptions}; | ||
|
||
mod enclosed { | ||
use verilog::verilog; | ||
|
||
#[verilog(src = "src/main.sv", name = "main")] | ||
pub struct Main; | ||
} | ||
|
||
#[snafu::report] | ||
fn main() -> Result<(), Whatever> { | ||
colog::init(); | ||
|
||
let mut runtime = VerilatorRuntime::new( | ||
"artifacts3".into(), | ||
&["src/main.sv".as_ref()], | ||
[], | ||
VerilatorRuntimeOptions::default(), | ||
true, | ||
)?; | ||
|
||
let mut main = runtime.create_model::<enclosed::Main>()?; | ||
|
||
main.medium_input = u32::MAX; | ||
println!("{}", main.medium_output); | ||
assert_eq!(main.medium_output, 0); | ||
main.eval(); | ||
println!("{}", main.medium_output); | ||
assert_eq!(main.medium_output, u32::MAX); | ||
|
||
Ok(()) | ||
} |
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