Logic Gates
Trying to simulate logic gates in rust programming language.
Todo:
- 4 bit adder (completed)
- Change the project to a rust lib (completed)
- Negative number support (completed)
- Substract (completed)
- 1 Bit alu (completed)
- 8 bit (uncompleted)
- 8 bit adder (uncompleted)
Usage:
You need to import theese if you want to use the features.
use Signal;
use *;
use FourByte;
Examples:
// Importing essentials... (You can check them in usage part)
: FourBit = "0100".parse?;
let byte2: FourBit = "0010".parse?;
let carry = Zero;
let = send_signal;
Ok
}
In this example you can add two four bytes together. You need to send carry signal as Signal::Zero carry signal is usefull if you want to implement 8bit adder.
If you want to display the added four bit you can implement a display function like this.
If you use this function to display. You will get a result like this.
Input 1 : 0100 = 4
Input 2 : 0010 = 2
Output : 00110 = 6
Extra fifth bit is carry bit it is not a necessary bit do display we are working with 4 bits not with 5 bits. But carry bit is usefull in the future when I develop 8BitAdder.