原创 generate语句的使用

2010-4-22 22:42 2340 4 4 分类: FPGA/CPLD

在XILINX DDR IP核看到generate的语句,觉得很有用,尤其是在参数化IP核时,简洁了测试程序的编写。将其中语句摘出如下:


 


genvar i;                                         
//  generate
//      if (DEVICE_WIDTH == 16)
//      begin
//      // if memory part is x16
//           if ( REG_ENABLE )
//           begin
//           end
//           else
//           begin
                   
//               for(i = 0; i < `DATA_STROBE_WIDTH/2; i = i+1)
//               begin : GEN
//                
//                   ddr_model U_mem0
//                     (
//                      .Dq    (ddr_dq_sdram[(16*(i+1))-1 : i*16]),
//                      .Dqs   (ddr_dqs_sdram[(2*(i+1))-1 : i*2]),
//                      .Addr  (ddr_address_sdram),
//                      .Ba    (ddr_ba_sdram),
//                      .Clk   (ddr_clk_sdram),
//                      .Clk_n (ddr_clk_n_sdram),
//                      .Cke   (ddr_cke_sdram),
//                      .Cs_n  (ddr_cs_l_sdram[0]),
//                      .Ras_n (ddr_ras_l_sdram),
//                      .Cas_n (ddr_cas_l_sdram),
//                      .We_n  (ddr_we_l_sdram),
//                      .Dm    (ddr_dm_sdram[(2*(i+1))-1 : i*2])
//                      );
//               end
//           end
//      end
//          
//  endgenerate

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
4
关闭 站长推荐上一条 /3 下一条