File tree Expand file tree Collapse file tree 2 files changed +37
-6
lines changed Expand file tree Collapse file tree 2 files changed +37
-6
lines changed Original file line number Diff line number Diff line change
1
+
2
+ module test001 (a, b, c, y);
3
+ input a;
4
+ input [31 :0 ] b, c;
5
+ input [31 :0 ] y;
6
+
7
+ aoi12 p [31 :0 ] (a, b, c, y);
8
+ endmodule
9
+
10
+ module aoi12 (a, b, c, y);
11
+ input a, b, c;
12
+ output y;
13
+ assign y = ~ ((a & b) | c);
14
+ endmodule
15
+
Original file line number Diff line number Diff line change 1
- module test001 (output [63 :0 ] y);
1
+ module test001 (input [5 :0 ] a, output [7 :0 ] y, output [31 :0 ] x );
2
+
2
3
function [7 :0 ] mylog2;
3
4
input [31 :0 ] value;
4
5
begin
@@ -10,11 +11,26 @@ module test001(output [63:0] y);
10
11
end
11
12
endfunction
12
13
13
- genvar i;
14
- generate
14
+ function [31 :0 ] myexp2;
15
+ input [7 :0 ] value;
16
+ begin
17
+ myexp2 = 1 ;
18
+ repeat (value)
19
+ myexp2 = myexp2 << 1 ;
20
+ end
21
+ endfunction
22
+
23
+ reg [7 :0 ] y_table [63 :0 ];
24
+ reg [31 :0 ] x_table [63 :0 ];
25
+
26
+ integer i;
27
+ initial begin
15
28
for (i = 0 ; i < 64 ; i = i+ 1 ) begin
16
- localparam tmp = mylog2(i);
17
- assign y [i] = tmp ;
29
+ y_table[i] < = mylog2(i);
30
+ x_table [i] <= myexp2(i) ;
18
31
end
19
- endgenerate
32
+ end
33
+
34
+ assign y = y_table[a];
35
+ assign x = x_table[a];
20
36
endmodule
You can’t perform that action at this time.
0 commit comments