-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConFFLogic.v
64 lines (35 loc) · 929 Bytes
/
ConFFLogic.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
module ConFFLogic (
input ConIn,
input [31:0]IRout,
input [31:0]BusMuxOut,
output wire ConFFOut
);
parameter zero = 2'b00, nonZero = 2'b01, positive = 2'b10, negative = 2'b11;
reg [1:0]C2;
reg Q;
reg [31:0]Ra;
initial begin
C2 = 2'b00;
Q = 1'b0; // Initializing q
Ra = 32'b0;
end
always @ (*) begin // NOTE: Check if this is the right input for FF
C2 <= IRout[20:19];
Ra <= BusMuxOut;
if (ConIn) begin
case (C2)
//00 - Branches if BusMuxOut is = 0
zero: Q <= (~|Ra); // reduction NOR
//01 - Branches if BusMuxOut is != 0
nonZero: Q <= (|Ra); // reduction OR
//10 - Branches if BusMuxOut is >= 0
positive: Q <= ~Ra[31];
//11 - Branches if BusMuxOut is < 0
negative: Q <= Ra[31];
default: Q <= 0;
endcase
end
end
// NOTE: Update outputs for branching cases
assign ConFFOut = Q;
endmodule