Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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
 

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 .
 

    davyzhu

    Points: 2
    Helpful Answer Positive Rating

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
 

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
 

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.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top