1.代码如下
`timescale 1ns/1ns
module state(clk,en,rst_n,cnt);
input clk;
input rst_n;
input en;
output cnt;
reg cnt;
always@(posedge clk or negedge rst_n)
if(!rst_n)
cnt <= 1'd0;
else if(en)
cnt <= cnt+1'b1;
endmodule
-
综合后的网表中LUT2的对应关系为:
I0 | I1 | 0 |
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 1 |
1 | 1 | 0 |
2.改变代码再重新查看网表:
`timescale 1ns/1ns
module state(clk,en,rst_n,cnt);
input clk;
input rst_n;
input en;
output[1:0] cnt;
reg[1:0] cnt;
always@(posedge clk or negedge rst_n)
if(!rst_n)
cnt <= 2'd0;
else if(en)
cnt <= cnt+1'b1;
endmodule
综合后的网表中LUT2的对应关系为:
I1 | I0 | O |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
LUT1的对应关系为:
I0 | O |
0 | 1 |
1 | 0 |