Xilinx XST 9.1, Verilog 2-D arrays, always @* : verilog

This is a discussion on Xilinx XST 9.1, Verilog 2-D arrays, always @* within the verilog forums in Programming Languages category; I noticed XST 9.1 still doesn't support multi-dim arrays in an always @* block. Here's a (perhaps poor) example: reg signed [15:0] table [0:255]; reg signed [23:0] sum; integer i; always @* begin sum = 0; for ( i =0; i < 256; i = i + 1 ) sum = sum + table[i]; // yes, I know this will synthesize a suboptimal imbalanced adder-tree! end...

Go Back   ObjectMix Forum > Programming Languages > verilog

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 03-17-2007, 01:28 AM
Ulsk
Guest
 
Default Xilinx XST 9.1, Verilog 2-D arrays, always @*

I noticed XST 9.1 still doesn't support multi-dim arrays in an always @*
block.
Here's a (perhaps poor) example:

reg signed [15:0] table [0:255];
reg signed [23:0] sum;

integer i;
always @*
begin
sum = 0;
for ( i =0; i < 256; i = i + 1 )
sum = sum + table[i]; // yes, I know this will synthesize a suboptimal
imbalanced adder-tree!
end


Reply With Quote
  #2  
Old 03-17-2007, 03:53 AM
Homuncilus
Guest
 
Default Re: Xilinx XST 9.1, Verilog 2-D arrays, always @*

On 3月17日, 下午2时28分, "Ulsk" <a...@ljs.com> wrote:
> I noticed XST 9.1 still doesn't support multi-dim arrays in an always @*
> block.
> Here's a (perhaps poor) example:
>
> reg signed [15:0] table [0:255];
> reg signed [23:0] sum;
>
> integer i;
> always @*
> begin
> sum = 0;
> for ( i =0; i < 256; i = i + 1 )
> sum = sum + table[i]; // yes, I know this will synthesize a suboptimal
> imbalanced adder-tree!
> end


I think the code can not be synthesize correctly by any tool not only
ISE!

Reply With Quote
  #3  
Old 03-17-2007, 05:17 PM
Ulsk
Guest
 
Default Re: Xilinx XST 9.1, Verilog 2-D arrays, always @*

> "Homuncilus" <Sha.Craig@gmail.com> wrote in message
> news:1174121624.193180.150560@n59g2000hsh.googlegr oups.com...
> On 3??17è?, ????2ê±28·?, "Ulsk" <a...@ljs.com> wrote:
> I noticed XST 9.1 still doesn't support multi-dim arrays in an always @*
> > block.
> > Here's a (perhaps poor) example:
> >
> > reg signed [15:0] table [0:255];
> > reg signed [23:0] sum;
> >
> > integer i;
> > always @*
> > begin
> > sum = 0;
> > for ( i =0; i < 256; i = i + 1 )
> > sum = sum + table[i]; // yes, I know this will synthesize a
> > suboptimal
> > imbalanced adder-tree!
> > end

>
> I think the code can not be synthesize correctly by any tool not only
> ISE!


ASIC synthesis tools (like Synopsys Design Compiler, Cadence RTL
Compiler, etc.) have no difficulty synthesizing the above example.


Reply With Quote
  #4  
Old 03-18-2007, 01:00 AM
Homuncilus
Guest
 
Default Re: Xilinx XST 9.1, Verilog 2-D arrays, always @*

On 3鏈18鏃, 涓婂崍6鏃17鍒, "Ulsk" <a...@ljs.com> wrote:
> > "Homuncilus" <Sha.Cr...@gmail.com> wrote in message
> >news:1174121624.193180.150560@n59g2000hsh.googleg roups.com...
> > On 3??17篓篓?, ????2篓潞隆脌28隆陇?, "Ulsk" <a...@ljs.com> wrote:
> > I noticed XST 9.1 still doesn't support multi-dim arrays in an always @*
> > > block.
> > > Here's a (perhaps poor) example:

>
> > > reg *signed [15:0] table [0:255];
> > > reg *signed [23:0] sum;

>
> > > integer i;
> > > always @*
> > > begin
> > > * sum = 0;
> > > * for ( i =0; i < 256; i = i + 1 )
> > > * * sum = sum + table[i]; *// yes, I know this will synthesize a
> > > suboptimal
> > > imbalanced adder-tree!
> > > end

>
> > I think the code can not be synthesize correctly by any tool not only
> > ISE!

>
> ASIC synthesis tools (like Synopsys Design Compiler, Cadence RTL
> Compiler, etc.) have no difficulty synthesizing the above example.- 闅愯棌琚紩鐢ㄦ枃* -
>
> - 鏄剧ず寮曠敤鐨勬枃* -


Could you tell me the result about the above example being synthesized
by the ASIC tools and could you sure that the function runs well?

Reply With Quote
  #5  
Old 03-18-2007, 10:00 PM
John McGrath
Guest
 
Default Re: Xilinx XST 9.1, Verilog 2-D arrays, always @*

On Mar 16, 11:28 pm, "Ulsk" <a...@ljs.com> wrote:
> I noticed XST 9.1 still doesn't support multi-dim arrays in an always @*
> block.
> Here's a (perhaps poor) example:
>
> reg signed [15:0] table [0:255];
> reg signed [23:0] sum;
>
> integer i;
> always @*
> begin
> sum = 0;
> for ( i =0; i < 256; i = i + 1 )
> sum = sum + table[i]; // yes, I know this will synthesize a suboptimal
> imbalanced adder-tree!
> end


Correct me if I'm wrong, but I believe that this is not valid verilog
- you cannot use an array as a term in the always() sensitivity list,
and the always* implies that the array is in the sensitivity list. I
know that the ncverilog simulator warns about this (but does work). It
states that this is non-portable verilog. Synopsys DC does indeed
synthesize this correctly, but it's not a good idea to use non-
standard verilog statements. ISE seems to err on the side of adhering
to the strict rules of the verilog language. I could be wrong about
this, but from the warning given by ncverilog, I believe this to be
the case. Maybe try a verilog linting tool? formality/conformal should
set you straight, if you have them.
Cheers
John

Reply With Quote
  #6  
Old 03-19-2007, 07:59 AM
Homuncilus
Guest
 
Default Re: Xilinx XST 9.1, Verilog 2-D arrays, always @*

On Mar 19, 11:00 am, "John McGrath" <tail...@gmail.com> wrote:
> On Mar 16, 11:28 pm, "Ulsk" <a...@ljs.com> wrote:
>
> > I noticed XST 9.1 still doesn't support multi-dim arrays in an always @*
> > block.
> > Here's a (perhaps poor) example:

>
> > reg signed [15:0] table [0:255];
> > reg signed [23:0] sum;

>
> > integer i;
> > always @*
> > begin
> > sum = 0;
> > for ( i =0; i < 256; i = i + 1 )
> > sum = sum + table[i]; // yes, I know this will synthesize a suboptimal
> > imbalanced adder-tree!
> > end

>
> Correct me if I'm wrong, but I believe that this is not valid verilog
> - you cannot use an array as a term in the always() sensitivity list,
> and the always* implies that the array is in the sensitivity list. I
> know that the ncverilog simulator warns about this (but does work). It
> states that this is non-portable verilog. Synopsys DC does indeed
> synthesize this correctly, but it's not a good idea to use non-
> standard verilog statements. ISE seems to err on the side of adhering
> to the strict rules of the verilog language. I could be wrong about
> this, but from the warning given by ncverilog, I believe this to be
> the case. Maybe try a verilog linting tool? formality/conformal should
> set you straight, if you have them.
> Cheers
> John


I think the wrong isn't due to the sensitivity list. Do you sure the
error in ISE is caused by that?

Reply With Quote
  #7  
Old 03-19-2007, 09:31 AM
John McGrath
Guest
 
Default Re: Xilinx XST 9.1, Verilog 2-D arrays, always @*

On Mar 19, 5:59 am, "Homuncilus" <Sha.Cr...@gmail.com> wrote:
> On Mar 19, 11:00 am, "John McGrath" <tail...@gmail.com> wrote:
>
>
>
> > On Mar 16, 11:28 pm, "Ulsk" <a...@ljs.com> wrote:

>
> > > I noticed XST 9.1 still doesn't support multi-dim arrays in an always @*
> > > block.
> > > Here's a (perhaps poor) example:

>
> > > reg signed [15:0] table [0:255];
> > > reg signed [23:0] sum;

>
> > > integer i;
> > > always @*
> > > begin
> > > sum = 0;
> > > for ( i =0; i < 256; i = i + 1 )
> > > sum = sum + table[i]; // yes, I know this will synthesize a suboptimal
> > > imbalanced adder-tree!
> > > end

>
> > Correct me if I'm wrong, but I believe that this is not valid verilog
> > - you cannot use an array as a term in the always() sensitivity list,
> > and the always* implies that the array is in the sensitivity list. I
> > know that the ncverilog simulator warns about this (but does work). It
> > states that this is non-portable verilog. Synopsys DC does indeed
> > synthesize this correctly, but it's not a good idea to use non-
> > standard verilog statements. ISE seems to err on the side of adhering
> > to the strict rules of the verilog language. I could be wrong about
> > this, but from the warning given by ncverilog, I believe this to be
> > the case. Maybe try a verilog linting tool? formality/conformal should
> > set you straight, if you have them.
> > Cheers
> > John

>
> I think the wrong isn't due to the sensitivity list. Do you sure the
> error in ISE is caused by that?


I ran the following testcase through ncverilog:

module test;

reg [7:0] array [0:7];
reg [2:0] idx;
reg [7:0] out;

always@*
begin
out = array[idx];
end

endmodule


The logfile gives the following warnings:

always@*
|
ncvlog: *W,STARMR (array.v,8|6): @* containing memory reference not
standard or portable.
out = array[idx];
ncvlog: *W,MRSTAR (array.v,10|11): memory reference that was not
standard in @*.
module worklib.test:v

So clearly always @* when used with an array is non part of the
verilog standard.

Cheers
John

Reply With Quote
  #8  
Old 03-19-2007, 09:35 AM
bluesclues
Guest
 
Default Re: Xilinx XST 9.1, Verilog 2-D arrays, always @*

On Mar 19, 7:31 am, "John McGrath" <tail...@gmail.com> wrote:
> On Mar 19, 5:59 am, "Homuncilus" <Sha.Cr...@gmail.com> wrote:
>
>
>
> > On Mar 19, 11:00 am, "John McGrath" <tail...@gmail.com> wrote:

>
> > > On Mar 16, 11:28 pm, "Ulsk" <a...@ljs.com> wrote:

>
> > > > I noticed XST 9.1 still doesn't support multi-dim arrays in an always @*
> > > > block.
> > > > Here's a (perhaps poor) example:

>
> > > > reg signed [15:0] table [0:255];
> > > > reg signed [23:0] sum;

>
> > > > integer i;
> > > > always @*
> > > > begin
> > > > sum = 0;
> > > > for ( i =0; i < 256; i = i + 1 )
> > > > sum = sum + table[i]; // yes, I know this will synthesize a suboptimal
> > > > imbalanced adder-tree!
> > > > end

>
> > > Correct me if I'm wrong, but I believe that this is not valid verilog
> > > - you cannot use an array as a term in the always() sensitivity list,
> > > and the always* implies that the array is in the sensitivity list. I
> > > know that the ncverilog simulator warns about this (but does work). It
> > > states that this is non-portable verilog. Synopsys DC does indeed
> > > synthesize this correctly, but it's not a good idea to use non-
> > > standard verilog statements. ISE seems to err on the side of adhering
> > > to the strict rules of the verilog language. I could be wrong about
> > > this, but from the warning given by ncverilog, I believe this to be
> > > the case. Maybe try a verilog linting tool? formality/conformal should
> > > set you straight, if you have them.
> > > Cheers
> > > John

>
> > I think the wrong isn't due to the sensitivity list. Do you sure the
> > error in ISE is caused by that?

>
> I ran the following testcase through ncverilog:
>
> module test;
>
> reg [7:0] array [0:7];
> reg [2:0] idx;
> reg [7:0] out;
>
> always@*
> begin
> out = array[idx];
> end
>
> endmodule
>
> The logfile gives the following warnings:
>
> always@*
> |
> ncvlog: *W,STARMR (array.v,8|6): @* containing memory reference not
> standard or portable.
> out = array[idx];
> ncvlog: *W,MRSTAR (array.v,10|11): memory reference that was not
> standard in @*.
> module worklib.test:v
>
> So clearly always @* when used with an array is non part of the
> verilog standard.
>
> Cheers
> John



You could alternately use:

always @(idx) in place of always@*

Reply With Quote
  #9  
Old 03-19-2007, 10:08 AM
John McGrath
Guest
 
Default Re: Xilinx XST 9.1, Verilog 2-D arrays, always @*

On Mar 19, 7:35 am, "bluesclues" <deepak.l...@gmail.com> wrote:
> On Mar 19, 7:31 am, "John McGrath" <tail...@gmail.com> wrote:
>
>
>
> > On Mar 19, 5:59 am, "Homuncilus" <Sha.Cr...@gmail.com> wrote:

>
> > > On Mar 19, 11:00 am, "John McGrath" <tail...@gmail.com> wrote:

>
> > > > On Mar 16, 11:28 pm, "Ulsk" <a...@ljs.com> wrote:

>
> > > > > I noticed XST 9.1 still doesn't support multi-dim arrays in an always @*
> > > > > block.
> > > > > Here's a (perhaps poor) example:

>
> > > > > reg signed [15:0] table [0:255];
> > > > > reg signed [23:0] sum;

>
> > > > > integer i;
> > > > > always @*
> > > > > begin
> > > > > sum = 0;
> > > > > for ( i =0; i < 256; i = i + 1 )
> > > > > sum = sum + table[i]; // yes, I know this will synthesize a suboptimal
> > > > > imbalanced adder-tree!
> > > > > end

>
> > > > Correct me if I'm wrong, but I believe that this is not valid verilog
> > > > - you cannot use an array as a term in the always() sensitivity list,
> > > > and the always* implies that the array is in the sensitivity list. I
> > > > know that the ncverilog simulator warns about this (but does work). It
> > > > states that this is non-portable verilog. Synopsys DC does indeed
> > > > synthesize this correctly, but it's not a good idea to use non-
> > > > standard verilog statements. ISE seems to err on the side of adhering
> > > > to the strict rules of the verilog language. I could be wrong about
> > > > this, but from the warning given by ncverilog, I believe this to be
> > > > the case. Maybe try a verilog linting tool? formality/conformal should
> > > > set you straight, if you have them.
> > > > Cheers
> > > > John

>
> > > I think the wrong isn't due to the sensitivity list. Do you sure the
> > > error in ISE is caused by that?

>
> > I ran the following testcase through ncverilog:

>
> > module test;

>
> > reg [7:0] array [0:7];
> > reg [2:0] idx;
> > reg [7:0] out;

>
> > always@*
> > begin
> > out = array[idx];
> > end

>
> > endmodule

>
> > The logfile gives the following warnings:

>
> > always@*
> > |
> > ncvlog: *W,STARMR (array.v,8|6): @* containing memory reference not
> > standard or portable.
> > out = array[idx];
> > ncvlog: *W,MRSTAR (array.v,10|11): memory reference that was not
> > standard in @*.
> > module worklib.test:v

>
> > So clearly always @* when used with an array is non part of the
> > verilog standard.

>
> > Cheers
> > John

>
> You could alternately use:
>
> always @(idx) in place of always@*


Maybe, but it would not work if the contents of the array were updated
by a different process, independent of idx.
I'm not sure how this would be syntesized - It may infer latches on
the output, or error out. I'd be interested to see what happens

Personally, for this example (asynch read of array elements) I'd use a
continuous assignment.

But personally I think verilog language should support @* in an array
context, it works in all other contexts, and prevents unintentional
latch inferral.
As we can see from Duth, this will be added to ISE soon, and some
other tools support it too, but they just warn that it is not strictly
part of the standard.

Cheers
John

Reply With Quote
  #10  
Old 03-19-2007, 11:17 AM
gtwrek@pacbell.net
Guest
 
Default Re: Xilinx XST 9.1, Verilog 2-D arrays, always @*

On Mar 16, 11:28 pm, "Ulsk" <a...@ljs.com> wrote:
> I noticed XST 9.1 still doesn't support multi-dim arrays in an always @*
> block.
> Here's a (perhaps poor) example:
>
> reg signed [15:0] table [0:255];
> reg signed [23:0] sum;
>
> integer i;
> always @*
> begin
> sum = 0;
> for ( i =0; i < 256; i = i + 1 )
> sum = sum + table[i]; // yes, I know this will synthesize a suboptimal
> imbalanced adder-tree!
> end


Ulsk,

I've heard that this is a "grey" area of the Verilog standard. It
shouldn't be at
all - the intended behavior is quite clear in your example, and the
tools should do the correct thing. Unfortunetly XST doesn't get it
right yet.
Xilinx promised to fix this is ISE9.x. Now, they've put it off again
until 10.x.

We've used VERY similar constructs - except we used SystemVerilog
packed arrays, instead of your
verilog-2001 "unpacked" array equivalent. This has worked fine for us
in ASIC and FPGA flows.
It works with VCS, modelsim, dc_shell, and Precision. Of course,
you'll need to use the
"Systemverilog" switch of the tools - which Xilinx doesn't have yet
either.

For your example in SystemVerilog, just change the table definition
to:
reg signed [ 255 : 0 ] [ 15 : 0 ] table;

And it would work. I'm thinking in the IEEE Std 1800-2005
(SystemVerilog IEEE standard),
they may have cleaned this up, and you're original example would work.

--Mark







Reply With Quote
Reply


Thread Tools

Similar Threads

Thread Thread Starter Forum Replies Last Post
Verilog 2001 Multidemensional arrays with real RolfK verilog 4 12-11-2007 09:52 PM
Xilinx Webpack 9.1i.03 Verilog synthesis bug? Xilinx user verilog 1 05-14-2007 07:59 AM
Xilinx Webpack 9.1i.03 Verilog synthesis bug? Xilinx user verilog 0 05-13-2007 03:24 PM
verilog multidimentional arrays manusha@millenniumit.com verilog 2 05-08-2006 12:01 PM
Verilog Sythesis using Xilinx IS, help with RTL Coding Style, feedback kyle.hable@gmail.com verilog 0 05-02-2006 11:35 AM


All times are GMT -5. The time now is 07:20 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.