-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCondition_Check.v
More file actions
executable file
·34 lines (30 loc) · 851 Bytes
/
Condition_Check.v
File metadata and controls
executable file
·34 lines (30 loc) · 851 Bytes
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
module Condition_Check
(
input [3:0] condition,
input [3:0] Status_Register,
output reg state
);
wire V = Status_Register[0];
wire N = Status_Register[1];
wire C = Status_Register[2];
wire Z = Status_Register[3];
always @(*) begin
case(condition)
4'd0: state = Z;
4'd1: state = ~Z;
4'd2: state = C;
4'd3: state = ~C;
4'd4: state = N;
4'd5: state = ~N;
4'd6: state = V;
4'd7: state = ~V;
4'd8: state = C & ~Z;
4'd9: state = ~C & Z;
4'd10: state = (N & V) | (~N & ~V);
4'd11: state = (N & ~V) | (~N & V);
4'd12: state = ~Z & ((N & V) | (~N & ~V));
4'd13: state = Z & ((N & ~V) | (~N & V));
4'd14: state = 1'b1;
endcase
end
endmodule