FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-08-2007, 01:31 PM
Uwe Bonnes
Guest
 
Posts: n/a
Default Inferring a pipelined multiplexer

Hallo,

for one design I have 64 8 bit counters, where I need to read out one
counter pointed to by input 'sel' to output 'data'. Multiplexing should be
down in a two stage process, first 8 pieces 8-bit 8-to-1 multiplexer and in
the second stage a single 8-bit 8-to-1 multiplexer. The module boils down
to:

module pipeline_mux
#(parameter N_BITS = 6,N_CHANNEL = 64)
(
input clk,
input [ N_CHANNEL -1:0] cnt,
input [ N_BITS -1 :0 ] sel,
output reg [N_BITS -1+2 :0 ] data
);
reg [N_BITS-1+2:0] counter[0:N_CHANNEL-1];
reg [N_BITS-1+2:0] counter_p[0:7];
reg [ N_BITS -3 :0 ] j;
integer i;

always @(posedge clk)
begin
for (i=0; i<N_CHANNEL; i = i+1)
if(cnt[i])
counter[i] <= counter[i] + 1'b1;
/* First stage pileline */
for (j=0; j<8; j = j+1)
counter_p[j]<= counter[{sel[N_BITS-1:3], j[2:0]}];
/* Second stage pileline */
data <= counter_p[sel[2:0]];
end
endmodule // pipeline_mux

Simulation shows expected behaviour. Running with ISE 9.1 however HDL
synthesis reports:
....
Found 8-bit 64-to-1 multiplexer for signal <$varindex0000> created at line 55.
Found 8-bit 64-to-1 multiplexer for signal <$varindex0001> created at line 55.
Found 8-bit 64-to-1 multiplexer for signal <$varindex0002> created at line 55.
Found 8-bit 64-to-1 multiplexer for signal <$varindex0003> created at line 55.
Found 8-bit 64-to-1 multiplexer for signal <$varindex0004> created at line 55.
Found 8-bit 64-to-1 multiplexer for signal <$varindex0005> created at line 55.
Found 8-bit 64-to-1 multiplexer for signal <$varindex0006> created at line 55.
Found 8-bit 64-to-1 multiplexer for signal <$varindex0007> created at line 55.
....
Found 8-bit 8-to-1 multiplexer for signal <data$varindex0000> created at line 56.
....

8 64-to-1 multiplexers are inferred, despite the 8-to-1 multiplexers I hoped for

Later Low Level synthesis reports lots of unconnected nodes, where probably
the 64-to-1 multiplexers get pruned to 8-to-1.

Is there a better way to code the problem?

Thanks

--
Uwe Bonnes [email protected]

Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Reply With Quote
  #2 (permalink)  
Old 03-08-2007, 01:52 PM
Uwe Bonnes
Guest
 
Posts: n/a
Default Re: Inferring a pipelined multiplexer

Uwe Bonnes <[email protected]> wrote:
> Hallo,


> for one design I have 64 8 bit counters, where I need to read out one
> counter pointed to by input 'sel' to output 'data'. Multiplexing should be
> down in a two stage process, first 8 pieces 8-bit 8-to-1 multiplexer and in
> the second stage a single 8-bit 8-to-1 multiplexer. The module boils down
> to:

....
to partially answer my own question:
The unconnected nodes were caused by the mismatch in width of the counters
and data .

Coding
for (j=0; j<8; j = j+1)
case (sel[N_BITS-1:3])
3'h0: counter_p[j]<= counter[{3'h0, j[2:0]}];
3'h1: counter_p[j]<= counter[{3'h1, j[2:0]}];
3'h2: counter_p[j]<= counter[{3'h2, j[2:0]}];
3'h3: counter_p[j]<= counter[{3'h3, j[2:0]}];
3'h4: counter_p[j]<= counter[{3'h4, j[2:0]}];
3'h5: counter_p[j]<= counter[{3'h5, j[2:0]}];
3'h6: counter_p[j]<= counter[{3'h6, j[2:0]}];
3'h7: counter_p[j]<= counter[{3'h7, j[2:0]}];
endcase // case (sel[N_BITS-1:3])

makes the HDL analysis infer the 8 8-to-1 multiplexes as expected. Is the
HDL analysis at fault or my coding style?

--
Uwe Bonnes [email protected]

Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Reply With Quote
  #3 (permalink)  
Old 03-08-2007, 08:14 PM
glen herrmannsfeldt
Guest
 
Posts: n/a
Default Re: Inferring a pipelined multiplexer

Uwe Bonnes wrote:

> Hallo,
>
> for one design I have 64 8 bit counters, where I need to read out one
> counter pointed to by input 'sel' to output 'data'. Multiplexing should be
> down in a two stage process, first 8 pieces 8-bit 8-to-1 multiplexer and in
> the second stage a single 8-bit 8-to-1 multiplexer. The module boils down
> to:


(snip)

If you want to pipeline it you will need a register in between.

Otherwise it is up to the synthesis software to find the best logic,
which may be a 64 to 1 multiplexer. If you put a register in between,
that should fix it.

-- glen

Reply With Quote
  #4 (permalink)  
Old 03-08-2007, 10:03 PM
Uwe Bonnes
Guest
 
Posts: n/a
Default Re: Inferring a pipelined multiplexer

glen herrmannsfeldt <[email protected]> wrote:
....
> (snip)


> If you want to pipeline it you will need a register in between.


Isn't counter_p[] the register in between?

> Otherwise it is up to the synthesis software to find the best logic,
> which may be a 64 to 1 multiplexer. If you put a register in between,
> that should fix it.


I still wonder where the difference between
for (j=0; j<8; j = j+1)
counter_p[j]<= counter[{sel[N_BITS-1:3], j[2:0]}];
and
for (j=0; j<8; j = j+1)
case (sel[N_BITS-1:3])
3'h0: counter_p[j]<= counter[{3'h0, j[2:0]}];
3'h1: counter_p[j]<= counter[{3'h1, j[2:0]}];
3'h2: counter_p[j]<= counter[{3'h2, j[2:0]}];
3'h3: counter_p[j]<= counter[{3'h3, j[2:0]}];
3'h4: counter_p[j]<= counter[{3'h4, j[2:0]}];
3'h5: counter_p[j]<= counter[{3'h5, j[2:0]}];
3'h6: counter_p[j]<= counter[{3'h6, j[2:0]}];
3'h7: counter_p[j]<= counter[{3'h7, j[2:0]}];
endcase // case (sel[N_BITS-1:3])

is....
--
Uwe Bonnes [email protected]

Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inferring dual port two output sram [email protected] Verilog 6 08-15-2006 06:38 PM
Describing pipelined hardware Jonathan Bromley Verilog 50 06-22-2006 04:23 PM
Inferring Xilinx synthesis results - Help required! srini Verilog 4 06-01-2006 12:24 PM
Multiplexer... Julian Verilog 4 09-10-2004 10:53 AM
multiplexer from slice / paremeter on with Rolf Kemper Verilog 2 08-10-2004 04:52 PM


All times are GMT +1. The time now is 03:19 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved