Update README.md
This commit is contained in:
@@ -8,31 +8,30 @@ Logic gates are the lowest level point from which this project is implemented. T
|
|||||||
Most of the gates also have a 16-bit version and eventually a n-way version (some even n-way-16-bit).
|
Most of the gates also have a 16-bit version and eventually a n-way version (some even n-way-16-bit).
|
||||||
|
|
||||||
Ex: a 4-way mux gate:
|
Ex: a 4-way mux gate:
|
||||||
|
'''
|
||||||
|
|
||||||
include "mux.v"
|
module mux4way(out, i0, i1, i2, i3, sel0, sel1);
|
||||||
include "or4way.v"
|
input i0, i1, i2, i3;
|
||||||
|
input [3:0]sel;
|
||||||
|
output [3:0]out;
|
||||||
|
wire tmp0, tmp1, tmp2, tmp3;
|
||||||
|
|
||||||
module mux4way(out, i0, i1, i2, i3, sel0, sel1);
|
wire [3:0] [1:0] sel0 = sel;
|
||||||
input i0, i1, i2, i3;
|
wire [0:3] [1:0] sel1 = sel;
|
||||||
input [3:0]sel;
|
|
||||||
output [3:0]out;
|
|
||||||
wire tmp0, tmp1, tmp2, tmp3;
|
|
||||||
|
|
||||||
wire [3:0] [1:0] sel0 = sel;
|
not(notSel0, sel0);
|
||||||
wire [0:3] [1:0] sel1 = sel;
|
not(notSel1, sel1);
|
||||||
|
|
||||||
not(notSel0, sel0);
|
and(tmp0, i0, notSel0);
|
||||||
not(notSel1, sel1);
|
and(tmp1, i1, sel0);
|
||||||
|
and(tmp2, i2, notSel1);
|
||||||
|
and(tmp3, i3, sel1);
|
||||||
|
|
||||||
and(tmp0, i0, notSel0);
|
or4way(out, tmp0, tmp1, tmp2, tmp3);
|
||||||
and(tmp1, i1, sel0);
|
|
||||||
and(tmp2, i2, notSel1);
|
|
||||||
and(tmp3, i3, sel1);
|
|
||||||
|
|
||||||
or4way(out, tmp0, tmp1, tmp2, tmp3);
|
endmodule
|
||||||
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
|
'''
|
||||||
#### Predefined gates (path: /gates/predefined)
|
#### Predefined gates (path: /gates/predefined)
|
||||||
The predefined gates are by default implemented on Verilog/Systemverilog. Thus they are not strictly needed for building more advanced gates or chipset, but I still decided to add them as reference and learning purposes.
|
The predefined gates are by default implemented on Verilog/Systemverilog. Thus they are not strictly needed for building more advanced gates or chipset, but I still decided to add them as reference and learning purposes.
|
||||||
|
|
||||||
@@ -42,6 +41,7 @@ Testbenches are a way to test the implementation of a particular gate using a Ve
|
|||||||
Ex: testbench for a xor gate:
|
Ex: testbench for a xor gate:
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
module xor_tb();
|
module xor_tb();
|
||||||
reg ta, tb;
|
reg ta, tb;
|
||||||
wire ty;
|
wire ty;
|
||||||
@@ -58,6 +58,7 @@ module xor_tb();
|
|||||||
ta=1, tb=1;
|
ta=1, tb=1;
|
||||||
end
|
end
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
### Arithmetic Logic Unit (path: /alu)
|
### Arithmetic Logic Unit (path: /alu)
|
||||||
|
|||||||
Reference in New Issue
Block a user