| Author |
Message |
davyzhu
Joined: 23 May 2004 Posts: 521 Helped: 3 Location: oriental
|
25 Mar 2006 3:04 How to write compact DFF chain? |
|
|
|
|
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
|
|
| Back to top |
|
 |
Google AdSense

|
25 Mar 2006 3:04 Ads |
|
|
|
|
|
|
| Back to top |
|
 |
linuxluo
Joined: 26 Jul 2002 Posts: 516 Helped: 4
|
25 Mar 2006 3:15 Re: How to write compact DFF chain? |
|
|
|
|
hi,
1. why not using dft eda tools such as dftcompiler ?
2. you can using 1-d array and using for statement .
|
|
| Back to top |
|
 |
davyzhu
Joined: 23 May 2004 Posts: 521 Helped: 3 Location: oriental
|
25 Mar 2006 6:35 How to write compact DFF chain? |
|
|
|
|
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
|
|
| Back to top |
|
 |
leeenghan
Joined: 28 Dec 2004 Posts: 125 Helped: 7
|
25 Mar 2006 22:14 Re: How to write compact DFF chain? |
|
|
|
|
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
|
|
| Back to top |
|
 |
linuxluo
Joined: 26 Jul 2002 Posts: 516 Helped: 4
|
27 Mar 2006 2:50 Re: How to write compact DFF chain? |
|
|
|
|
hi, davyzhu
as to2, you should read a verilog book and then it's clear.
|
|
| Back to top |
|
 |