![]() |
|
|
|||||||
![]() |
VHDL - How to write compact DFF chain? |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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 |
|
|
|
#3 |
|
Posts: n/a
|
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 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
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 |