Mar 25, 2006 #1 D davyzhu Advanced Member level 1 Joined May 23, 2004 Messages 494 Helped 5 Reputation 10 Reaction score 2 Trophy points 1,298 Location oriental Activity points 4,436 Hi all, Sometimes I have to write long DFF chain like below: //------code-------------- Code: ... reg [7:0] DFF0,DFF1,DFF2,...DFF50; always@(posedge clk) if(rst) begin DFF0 <= 0; ... DFF50 <= 0; end else begin DFF0 <= INPUT; ... DFF50 <= DFF49; end //------code end----------- It's too long, is there any good compact style? Any suggestions will be appreciated! Best regards, Davy
Hi all, Sometimes I have to write long DFF chain like below: //------code-------------- Code: ... reg [7:0] DFF0,DFF1,DFF2,...DFF50; always@(posedge clk) if(rst) begin DFF0 <= 0; ... DFF50 <= 0; end else begin DFF0 <= INPUT; ... DFF50 <= DFF49; end //------code end----------- It's too long, is there any good compact style? Any suggestions will be appreciated! Best regards, Davy
Mar 25, 2006 #2 L linuxluo Full Member level 6 Joined Jul 26, 2002 Messages 331 Helped 7 Reputation 14 Reaction score 3 Trophy points 1,298 Activity points 2,514 hi, 1. why not using dft eda tools such as dftcompiler ? 2. you can using 1-d array and using for statement .
hi, 1. why not using dft eda tools such as dftcompiler ? 2. you can using 1-d array and using for statement .
Mar 25, 2006 #3 D davyzhu Advanced Member level 1 Joined May 23, 2004 Messages 494 Helped 5 Reputation 10 Reaction score 2 Trophy points 1,298 Location oriental Activity points 4,436 Hi linuxluo, Sorry, but I am a newbie. 1. What's dftcompiler for? 2. Can you give me the example of 2? Best regards, Davy
Hi linuxluo, Sorry, but I am a newbie. 1. What's dftcompiler for? 2. Can you give me the example of 2? Best regards, Davy
Mar 25, 2006 #4 L leeenghan Advanced Member level 4 Joined Dec 28, 2004 Messages 118 Helped 16 Reputation 32 Reaction score 8 Trophy points 1,298 Activity points 1,333 Hi, There is nothing long with the code; clarity is more important. However, to make the code compact, I can think of the following: 1. Make them into one array. Then use something similiar to DFF[50:1] = DFF[49:0]; DFF[0] = input 2. Use a for loop 3. Use generate statement Regards, Eng Han www.eda-utilities.com
Hi, There is nothing long with the code; clarity is more important. However, to make the code compact, I can think of the following: 1. Make them into one array. Then use something similiar to DFF[50:1] = DFF[49:0]; DFF[0] = input 2. Use a for loop 3. Use generate statement Regards, Eng Han www.eda-utilities.com
Mar 27, 2006 #5 L linuxluo Full Member level 6 Joined Jul 26, 2002 Messages 331 Helped 7 Reputation 14 Reaction score 3 Trophy points 1,298 Activity points 2,514 hi, davyzhu as to2, you should read a verilog book and then it's clear.