06/25/14 03:41:17 ./toolflow/build/condset_src_domain_check.v
1
module
CondSet_Check
(
comparand_a
,
out
,
error
)
;
2
input
[
31
:
0
]
comparand_a
;
3
input
[
31
:
0
]
out
;
4
output
error
;
5
wire
[
31
:
0
]
comparand_b
;
6
wire
[
31
:
0
]
thenset
;
7
wire
[
31
:
0
]
elseset
;
8
9
assign
comparand_b
=
0
;
10
assign
thenset
=
0
;
11
assign
elseset
=
1
;
12
13
CondSet_CheckInt
csc0
(
.comparand_a
(
comparand_a
)
,
.comparand_b
(
comparand_b
)
,
.thenset
(
thenset
)
,
.elseset
(
elseset
)
,
.out
(
out
)
,
.error
(
error
)
)
;
14
15
endmodule
16
17
module
CondSet_CheckInt
(
comparand_a
,
comparand_b
,
thenset
,
elseset
,
out
,
error
)
;
18
input
[
31
:
0
]
comparand_a
;
19
input
[
31
:
0
]
comparand_b
;
20
input
[
31
:
0
]
thenset
;
21
input
[
31
:
0
]
elseset
;
22
input
[
31
:
0
]
out
;
23
output
error
;
24
25
//
Trick ODIN into thinking every port is being used
26
wire
use_all
;
27
assign
use_all
=
comparand_a
^
comparand_b
^
thenset
^
elseset
^
out
;
28
29
wire
sign_a
;
30
wire
sign_b
;
31
assign
sign_a
=
comparand_a
[
31
]
;
32
assign
sign_b
=
comparand_b
[
31
]
;
33
34
wire
[
30
:
0
]
a
;
35
wire
[
30
:
0
]
b
;
36
assign
a
=
comparand_a
[
30
:
0
]
;
37
assign
b
=
comparand_b
[
30
:
0
]
;
38
39
wire
[
30
:
0
]
result
;
40
wire
sign_result
;
41
assign
result
=
out
[
30
:
0
]
;
42
assign
sign_result
=
out
[
31
]
;
43
44
wire
result_or_reduced
;
45
assign
result_or_reduced
=
|
result
;
46
47
wire
result_eq_zero
;
48
assign
result_eq_zero
=
~
sign_result
&
~
result_or_reduced
;
49
50
wire
result_gt_zero
;
51
assign
result_gt_zero
=
~
sign_result
&
result_or_reduced
;
52
53
wire
in_gt_zero
;
54
assign
in_gt_zero
=
~
sign_a
&
|
a
;
55
56
wire
correct_result_category
;
57
assign
correct_result_category
=
(
in_gt_zero
&
result_eq_zero
)
|
(
~
in_gt_zero
&
result_gt_zero
)
;
58
59
assign
error
=
~
correct_result_category
;
60
61
endmodule
62