-
Notifications
You must be signed in to change notification settings - Fork 14
/
FpxxDemoSim.v
93 lines (73 loc) · 2.61 KB
/
FpxxDemoSim.v
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
module tb;
reg osc_clk;
reg [31:0] op_a;
reg [31:0] op_b;
wire [31:0] op_a_p_op_b;
reg [22:0] lz_in;
wire [4:0] lz;
FpxxDemo u_dut (
.osc_clk(osc_clk),
.op_a(op_a),
.op_b(op_b),
.op_a_p_op_b(op_a_p_op_b),
.lz_in(lz_in),
.lz(lz));
initial begin
osc_clk = 0;
forever begin
#5 osc_clk = ~osc_clk;
end
end
initial begin
$display("%t: Start of simulation!", $time);
$dumpfile("waves.vcd");
$dumpvars(0, tb);
repeat(1000) @(posedge osc_clk);
$display("%t: Simulation complete...", $time);
$finish;
end
initial begin
lz_in = 23'h000000;
repeat(6) @(posedge osc_clk);
$display(lz);
@(posedge osc_clk);
lz_in = 23'h400000;
repeat(6) @(posedge osc_clk);
$display(lz);
@(posedge osc_clk);
lz_in = 23'h000100;
repeat(6) @(posedge osc_clk);
$display(lz);
@(posedge osc_clk);
op_a = 32'b0_00000000_00000000000000000000000;
op_b = 32'b0_00000000_00000000000000000000000;
repeat(6) @(posedge osc_clk);
$display("%b_%b_%b", op_a_p_op_b[31], op_a_p_op_b[30:23], op_a_p_op_b[22:0]);
@(posedge osc_clk);
op_a = 32'b0_00000000_00000000000000000000000;
op_b = 32'b0_01111111_00000000000000000000000;
repeat(6) @(posedge osc_clk);
$display("%b_%b_%b", op_a_p_op_b[31], op_a_p_op_b[30:23], op_a_p_op_b[22:0]);
@(posedge osc_clk);
op_a = 32'b0_01111111_00000000000000000000000;
op_b = 32'b0_00000000_00000000000000000000000;
repeat(6) @(posedge osc_clk);
$display("%b_%b_%b", op_a_p_op_b[31], op_a_p_op_b[30:23], op_a_p_op_b[22:0]);
@(posedge osc_clk);
op_a = 32'b0_01111111_00000000000000000000000;
op_b = 32'b0_01111111_00000000000000000000000;
repeat(6) @(posedge osc_clk);
$display("%b_%b_%b", op_a_p_op_b[31], op_a_p_op_b[30:23], op_a_p_op_b[22:0]);
@(posedge osc_clk);
op_a = 32'b0_10000000_10000000000000000000000;
op_b = 32'b0_01111111_10000000000000000000000;
repeat(6) @(posedge osc_clk);
$display("%b_%b_%b", op_a_p_op_b[31], op_a_p_op_b[30:23], op_a_p_op_b[22:0]);
@(posedge osc_clk);
op_a = 32'b0_01111111_10000000000000000000000;
op_b = 32'b0_10000000_10000000000000000000000;
repeat(6) @(posedge osc_clk);
$display("%b_%b_%b", op_a_p_op_b[31], op_a_p_op_b[30:23], op_a_p_op_b[22:0]);
@(posedge osc_clk);
end
endmodule