Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - How to write compact DFF chain?

 
Thread Tools Search this Thread
Old 03-25-2006, 02:01 AM   #1
Default How to write compact DFF chain?


Hi all,

Sometimes I have to write long DFF chain like below:

//------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



Davy
  Reply With Quote
Old 03-25-2006, 09:01 AM   #2
Michael
 
Posts: n/a
Default Re: How to write compact DFF chain?
You could make another verilog95 way:

reg [8*51-1:0] DFFs;
wire [7:0] DFF0,DFF1,DFF2,...DFF50;
assign {DFF50, DFF49, ..., DFF0} = DFFs;

always @(posedge clk) begin
if(rst) DFFs <= {51{8'h00}};
else begin
DFFs <= DFFs << 8;
DFFs[7:0] <= INPUT;
end
end

Of course you can omit assigning and use only required bits from vector
DFFs.



Michael
  Reply With Quote
Old 03-28-2006, 07:24 AM   #3
Thomas Stanka
 
Posts: n/a
Default Re: How to write compact DFF chain?
Xpost from OP, FUp2 comp.lang.vhdl

Davy schrieb:

> Sometimes I have to write long DFF chain like below:


In VHDL you would write

if reset_active then
DFF <= (others =>'0');
elsif rising_edge(Clk)
DFF <= DFF( xxx downto 0) & input;
end if

If you don't like to change to VHDL than you should avoid posting in
the VHDL-group.

bye Thomas



Thomas Stanka
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Disc is write protected error message o Gunners o Hardware 0 03-02-2008 07:36 PM
Is it Possible to write dat files to dvd ? Levis DVD Video 1 06-11-2007 08:02 AM
Next Problem: Random HDD Write Errors Dave Hardenbrook A+ Certification 3 10-02-2006 05:38 AM
Reducing DVD Write speed with Nero 6 on Sony DVD writer Guido DVD Video 0 11-18-2004 10:23 PM
"Failed To Set Write Parameters!" Bubba Do Wah Ditty DVD Video 0 05-19-2004 09:06 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46