How to write compact DFF chain?

Status
Not open for further replies.

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,
1. why not using dft eda tools such as dftcompiler ?
2. you can using 1-d array and using for statement .
 

    davyzhu

    Points: 2
    Helpful Answer Positive Rating
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,

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, davyzhu
as to2, you should read a verilog book and then it's clear.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…