diff --git a/examples/sim.rs b/examples/sim.rs new file mode 100644 index 0000000..080a17f --- /dev/null +++ b/examples/sim.rs @@ -0,0 +1,33 @@ +// Copyright 2023 The Regents of the University of California +// released under BSD 3-Clause License +// author: Kevin Laeufer + +use clap::Parser; +use libpatron::ir::*; +use libpatron::*; +use std::io::BufRead; + +#[derive(Parser, Debug)] +#[command(name = "sim")] +#[command(author = "Kevin Laeufer ")] +#[command(version)] +#[command(about = "Simulates a transitions system from a btor2 file.", long_about = None)] +struct Args { + #[arg(short, long)] + verbose: bool, + #[arg(long, help = "Filename of a testbench.")] + testbench: String, + #[arg(value_name = "BTOR2", index = 1)] + filename: String, +} + +fn main() { + let args = Args::parse(); + let (ctx, sys) = btor2::parse_file(&args.filename).expect("Failed to load btor2 file!"); + if args.verbose { + println!("Loaded: {}", sys.name); + println!("{}", sys.serialize_to_str(&ctx)); + println!(); + println!(); + } +}