File: opt_expr_alu.ys

package info (click to toggle)
yosys 0.52-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 69,796 kB
  • sloc: ansic: 696,955; cpp: 239,736; python: 14,617; yacc: 3,529; sh: 2,175; makefile: 1,945; lex: 697; perl: 445; javascript: 323; tcl: 162; vhdl: 115
file content (168 lines) | stat: -rw-r--r-- 3,257 bytes parent folder | download | duplicates (2)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
read_verilog <<EOT
module test(input a, output [1:0] y);
assign y = {a,1'b0} + 1'b1;
endmodule
EOT

alumacc
equiv_opt -assert opt_expr -fine
design -load postopt
select -assert-count 1 t:$pos
select -assert-none t:$pos t:* %D


design -reset
read_verilog <<EOT
module test(input a, output [1:0] y);
assign y = {a,1'b1} + 1'b1;
endmodule
EOT

alumacc
select -assert-count 1 t:$alu
select -assert-none t:$alu t:* %D


design -reset
read_verilog <<EOT
module test(input a, output [1:0] y);
assign y = {a,1'b1} - 1'b1;
endmodule
EOT

equiv_opt -assert opt_expr -fine
design -load postopt
select -assert-count 1 t:$pos
select -assert-none t:$pos t:* %D


design -reset
read_verilog <<EOT
module test(input a, output [3:0] y);
assign y = {a,3'b101} - 1'b1;
endmodule
EOT

equiv_opt -assert opt_expr -fine
design -load postopt
select -assert-count 1 t:$pos
select -assert-none t:$pos t:* %D


design -reset
read_verilog <<EOT
module test(input a, output [3:0] y);
assign y = {a,3'b101} - 1'b1;
endmodule
EOT

alumacc
equiv_opt -assert opt_expr -fine
design -load postopt
select -assert-count 1 t:$not
select -assert-none t:$not %% t:* %D


design -reset
read_verilog <<EOT
module test(input [1:0] a, output [3:0] y);
assign y = -{a[1], 2'b10, a[0]};
endmodule
EOT

alumacc
equiv_opt -assert opt -fine
design -load postopt
select -assert-count 1 t:$alu
select -assert-count 1 t:$alu r:Y_WIDTH=3 %i
select -assert-count 1 t:$not
select -assert-none t:$alu t:$not t:* %D %D


design -reset
read_verilog <<EOT
module test(input [3:0] a, input [2:0] b, output [5:0] y);
assign y = {a[3:2], 1'b1, a[1:0]} + {b[2], 2'b11, b[1:0]};
endmodule
EOT

alumacc
equiv_opt -assert opt -fine
design -load postopt
dump
select -assert-count 2 t:$alu
select -assert-count 1 t:$alu r:Y_WIDTH=2 %i
select -assert-count 1 t:$alu r:Y_WIDTH=3 %i
select -assert-none t:$alu t:* %D


design -reset
read_verilog <<EOT
module test(input [3:0] a, input [3:0] b, output [5:0] y);
assign y = {a[3:2], 1'b0, a[1:0]} + {b[3:2], 1'b0, b[1:0]};
endmodule
EOT

alumacc
equiv_opt -assert opt -fine
design -load postopt
select -assert-count 2 t:$alu
select -assert-count 2 t:$alu r:Y_WIDTH=3 %i
select -assert-none t:$alu t:* %D


design -reset
read_verilog -icells <<EOT
module test(input [3:0] a, output [3:0] y, output [3:0] x, output [3:0] co);
$alu #(
	.A_WIDTH(4), .B_WIDTH(4), .Y_WIDTH(4),
	.A_SIGNED(0), .B_SIGNED(0),
) alu (
	.A(a), .B(4'h0),
	.BI(1'b0), .CI(1'b0),
	.Y(y), .X(x), .CO(co),
);
endmodule
EOT

equiv_opt -assert opt
design -load postopt
select -assert-none t:$alu


design -reset
read_verilog -icells <<EOT
module test(input [3:0] a, output [3:0] y, output [3:0] x, output [3:0] co);
$alu #(
	.A_WIDTH(4), .B_WIDTH(4), .Y_WIDTH(4),
	.A_SIGNED(0), .B_SIGNED(0),
) alu (
	.A(a), .B(4'h0),
	.BI(1'b1), .CI(1'b1),
	.Y(y), .X(x), .CO(co),
);
endmodule
EOT

equiv_opt -assert opt
design -load postopt
select -assert-none t:$alu


design -reset
read_verilog -icells <<EOT
module test(input [3:0] a, output [3:0] y, output [3:0] x, output [3:0] co);
$alu #(
	.A_WIDTH(4), .B_WIDTH(4), .Y_WIDTH(4),
	.A_SIGNED(0), .B_SIGNED(0),
) alu (
	.A(4'h0), .B(a),
	.BI(1'b0), .CI(1'b0),
	.Y(y), .X(x), .CO(co),
);
endmodule
EOT

equiv_opt -assert opt
design -load postopt
select -assert-none t:$alu