-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBEE425XOR.qpf
39 lines (31 loc) · 918 Bytes
/
BEE425XOR.qpf
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
// BEE425
// Lab 0 XOR demonstration
// AASHIMA MEHTA, 4/4/20
// XOR module
// XOR testbench module
module BEE425XOR(
input logic a, b, c,
output logic out);
assign out=a^b^c;
endmodule
module xor_testbench();
logic a, b, c, out, clk;
parameter CLOCK_PERIOD = 100; // simulating a toggling clock
initial clk <= 0;
always begin
#(CLOCK_PERIOD/2);
clk = ~clk; // clock toggle
end
BEE425XOR dut (a,b,c,out); // reference the device under test
initial begin // embed the test vector
a <= 0; b <= 0; c <= 0; @(posedge clk);
a <= 1; b <= 0; c <= 0; @(posedge clk);
a <= 0; b <= 1; c <= 0; @(posedge clk);
a <= 1; b <= 1; c <= 0; @(posedge clk);
a <= 0; b <= 0; c <= 1; @(posedge clk);
a <= 1; b <= 0; c <= 1; @(posedge clk);
a <= 0; b <= 1; c <= 1; @(posedge clk);
a <= 1; b <= 1; c <= 1; @(posedge clk);
$stop;
end
endmodule