Skip to content

Commit

Permalink
add wip simulator code
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed Nov 21, 2023
1 parent 45ab3ae commit 717abfd
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions examples/sim.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2023 The Regents of the University of California
// released under BSD 3-Clause License
// author: Kevin Laeufer <[email protected]>

use clap::Parser;
use libpatron::ir::*;
use libpatron::*;
use std::io::BufRead;

#[derive(Parser, Debug)]
#[command(name = "sim")]
#[command(author = "Kevin Laeufer <[email protected]>")]
#[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!();
}
}

0 comments on commit 717abfd

Please sign in to comment.