if(rst)
begin
ram[0] <=10'b0 ;
ram[1] <=10'b0 ;
.........................
ram[156] <=10'b0 ;
end
实际上这两种方式都是一样的,资源占用的结果如下(xilinx芯片):
Selected Device : 2v2000ff896-4
Number of Slices: 2663 out of 10752 24%
Number of Slice Flip Flops: 3170 out of 21504 14%
Number of 4 input LUTs: 2056 out of 21504 9%
Number of IOs: 51
Number of bonded IOBs: 51 out of 624 8%
Number of GCLKs: 1 out of 16 6%
Selected Device : 2v2000ff896-4
Number of Slices: 17 out of 10752 0%
Number of Slice Flip Flops: 10 out of 21504 0%
Number of 4 input LUTs: 34 out of 21504 0%
Number of IOs: 51
Number of bonded IOBs: 51 out of 624 8%
Number of BRAMs: 2 out of 56 3%
Number of GCLKs: 1 out of 16 6%