-
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
1 parent
d75f99c
commit 21a5c55
Showing
3 changed files
with
31 additions
and
13 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
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 |
---|---|---|
@@ -1,21 +1,23 @@ | ||
use logic_o3::logic::{Circuit, LogicCircuit}; | ||
|
||
fn main() { | ||
// Add Two Logic Gate | ||
let and1 = LogicCircuit::new(logic_o3::logic::LogicGate::AND); | ||
let not1 = LogicCircuit::new(logic_o3::logic::LogicGate::NOT); | ||
|
||
// Create New Circuit | ||
let mut nand = Circuit::new(); | ||
|
||
// Insert Two Logic Gate | ||
nand.add_logic_gate(and1); | ||
nand.add_logic_gate(not1); | ||
|
||
// Connect wire between Two Gate | ||
nand.connection_scheme((0, 1, 0)); | ||
|
||
// Add Input Signal on Circuit | ||
nand.add_input_connection((true, vec![(0, 0)])); | ||
nand.add_input_connection((false, vec![(0, 1)])); | ||
|
||
// Add Output Signal to know Output of this Circuit | ||
nand.add_output_connection(1); | ||
|
||
// Update Cicuit in According to Input | ||
nand.update(); | ||
// TADA !! | ||
println!("{:?}", nand.know_output()); | ||
} |
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