This repository was archived by the owner on Aug 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathOriginalTesting.t.v
More file actions
128 lines (101 loc) · 4.81 KB
/
OriginalTesting.t.v
File metadata and controls
128 lines (101 loc) · 4.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
module testMultiplexer ();
wire AndNandOut;
reg A, B;
reg[2:0] Command;
//reg S;
wire OneBitFinalOut;
wire AddSubSLTSum, carryout, subtract; //overflow,
reg carryin;
wire OrNorXorOut;
//wire muxout;
//reg S0, S1;
//reg in0, in1, in2, in3;
wire Cmd0Start;
wire Cmd1Start;
wire nB;
wire BornB;
wire AxorB;
wire AandB;
wire CINandAxorB;
wire AnorB;
wire AorB;
wire AnandB;
wire nXor;
wire XorNor;
MiddleAddSubSLT testadd(AddSubSLTSum, carryout, subtract, A, B, Command, carryin);
AndNand newpotato(AndNandOut, A, B, Command);
OrNorXor ortest(OrNorXorOut, A, B, Command);
Bitslice yukongoldpotato(OneBitFinalOut, AddSubSLTSum, carryout, OrNorXorOut, AndNandOut, subtract, A, B, Command, carryin);
//FourInMux arbitrarypotato(muxout, S0, S1, in0, in1, in2, in3);
initial begin
// just the adder - proper behavior
$display("Adder/Subtractor");
$display("A B| Command | Output | Expected Output");
A=1;B=1;Command=3'b000; carryin = 0; #1000
$display("%b %b | %b | %b | 0 | %b", A, B, Command, AddSubSLTSum, carryout);
A=1;B=1;Command=3'b001; carryin = 1; #1000
$display("%b %b | %b | %b | 0 | %b", A, B, Command, AddSubSLTSum, carryout);
// testing subtraction
$display("One Bitslice Adder/Subtractor");
$display("A B| Command |Out|ExOut|Carryout");
A=1;B=1;Command=3'b000; carryin=0; #1000
$display("%b %b | %b | %b | 0 | %b", A, B, Command, OneBitFinalOut, carryout);
A=1;B=0;Command=3'b000; carryin=0; #1000
$display("%b %b | %b | %b | 1 | %b", A, B, Command, OneBitFinalOut, carryout);
A=0;B=0;Command=3'b000; carryin=0; #1000
$display("%b %b | %b | %b | 0 | %b", A, B, Command, OneBitFinalOut, carryout);
A=1;B=1;Command=3'b001; carryin=1; #1000
$display("%b %b | %b | %b | 0 | %b", A, B, Command, OneBitFinalOut, carryout);
A=1;B=0;Command=3'b001; carryin=1; #1000
$display("%b %b | %b | %b | 1 | %b", A, B, Command, OneBitFinalOut, carryout);
A=0;B=0;Command=3'b001; carryin=1; #1000
$display("%b %b | %b | %b | 0 | %b", A, B, Command, OneBitFinalOut, carryout);
//$display("A B| Command | Output | Expected Output- pure sadness");
//S0 = 1; S1 = 0; in0 = 1; in1 = 1; in2 = 0; in3 = 0; #1000
//$display("%b %b | %b %b %b %b | %b | 1", S0, S1, in0, in1, in2, in3, muxout);
// testing addition
$display("A B| Command | Output | Expected Output-sadness|Carryout");
A=1;B=1;Command=3'b000; carryin=0; #1000
$display("%b %b | %b | %b | 0 | %b", A, B, Command, OneBitFinalOut, carryout);
A=1;B=0;Command=3'b000; carryin=0; #1000
$display("%b %b | %b | %b | 1 | %b", A, B, Command, OneBitFinalOut, carryout);
A=0;B=0;Command=3'b000; carryin=0; #1000
$display("%b %b | %b | %b | 0 | %b", A, B, Command, OneBitFinalOut, carryout);
// Exhaustively testing AND/NAND
$display("A B| Command | command0 Output | Expected Output - AND TESTS");
A=1;B=1;Command=3'b000; #1000
$display("%b %b | %b | %b %b | 1", A, B, Command, Command[0], AndNandOut);
A=1;B=1;Command=3'b001; #1000
$display("%b %b | %b | %b %b | 0", A, B, Command, Command[1], AndNandOut);
A=0;B=1;Command=3'b000; #1000
$display("%b %b | %b | %b %b | 0", A, B, Command, Command[0], AndNandOut);
A=1;B=0;Command=3'b001; #1000
$display("%b %b | %b | %b %b | 1", A, B, Command, Command[1], AndNandOut);
// Exhaustively testing OR/NOR/XOR
$display("A B | Command | Output | Expected Output - OR TESTS");
A=1; B=1; Command=3'b111; #1000
$display("%b %b | %b | %b | 1 - OR TEST", A, B, Command, OrNorXorOut);
A=1; B=0; Command=3'b111; #1000
$display("%b %b | %b | %b | 1 - OR TEST", A, B, Command, OrNorXorOut);
A=0; B=1; Command=3'b111; #1000
$display("%b %b | %b | %b | 1 - OR TEST", A, B, Command, OrNorXorOut);
A=0; B=0; Command=3'b111; #1000
$display("%b %b | %b | %b | 0 - OR TEST", A, B, Command, OrNorXorOut);
A=1; B=1; Command=3'b110; #1000
$display("%b %b | %b | %b | 0 - NOR TEST", A, B, Command, OrNorXorOut);
A=1; B=0; Command=3'b110; #1000
$display("%b %b | %b | %b | 0 - NOR TEST", A, B, Command, OrNorXorOut);
A=0; B=1; Command=3'b110; #1000
$display("%b %b | %b | %b | 0 - NOR TEST", A, B, Command, OrNorXorOut);
A=0; B=0; Command=3'b110; #1000
$display("%b %b | %b | %b | 1 - NOR TEST", A, B, Command, OrNorXorOut);
A=1; B=1; Command=3'b010; #1000
$display("%b %b | %b | %b | 0 - XOR TEST", A, B, Command, OrNorXorOut);
A=1; B=0; Command=3'b010; #1000
$display("%b %b | %b | %b | 1 - XOR TEST", A, B, Command, OrNorXorOut);
A=0; B=1; Command=3'b010; #1000
$display("%b %b | %b | %b | 1 - XOR TEST", A, B, Command, OrNorXorOut);
A=0; B=0; Command=3'b010; #1000
$display("%b %b | %b | %b | 0 - XOR TEST", A, B, Command, OrNorXorOut);
end
endmodule