-
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
3 changed files
with
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ fn main() { | |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
use logic_o3::logic::{Circuit, LogicCircuit}; | ||
|
||
fn main() { | ||
// Create new Logic Gate | ||
let or1 = LogicCircuit::new(logic_o3::logic::LogicGate::OR); | ||
let not1 = LogicCircuit::new(logic_o3::logic::LogicGate::NOT); | ||
|
||
// Create Empty Circuit | ||
let mut nor = Circuit::new(); | ||
|
||
// Add Two Logic Gate AKA Component | ||
nor.add_logic_gate(or1); | ||
nor.add_logic_gate(not1); | ||
|
||
// Connect wire between two component (from_comp_id, to_comp_id, to_comp_input_index) | ||
nor.connection_scheme((0, 1, 0)); | ||
|
||
// Add Two Input Signal | ||
nor.add_input_connection((false, vec![(0, 0)])); | ||
nor.add_input_connection((false, vec![(0, 1)])); | ||
|
||
// Add One Output Signal | ||
nor.add_output_connection(1); | ||
|
||
// Refreshing for change | ||
nor.update(); | ||
|
||
// And Done | ||
println!("{:?}", nor.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