UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Reply

HI,about the $unsigned usage in generate for coding...

Highlighted
Newbie
Posts: 1
Registered: ‎07-16-2017

HI,about the $unsigned usage in generate for coding...

HI,Buddies:

 

One customer wants to use $unsigned in "generate for "

 

parameter[31:0] BITDEPTH          = 32'd8;

wire  [31:0] i_interleaved_mtree;
reg  [31:0] i_mux_pattern;
reg  [31:0] node_0;
reg  [31:0] node_1;
reg  [31:0] node_2;
reg  [31:0] node_3;

 genvar  i;
 generate for( i = 0; $unsigned(i) < BITDEPTH; i = i + 1) begin : b3
   assign i_interleaved_mtree[i*3+0] = i_mux_pattern[0] ? node_1[i] :
                                                          node_0[i];
   assign i_interleaved_mtree[i*3+1] = i_mux_pattern[1] ? node_2[i] :
                                                          node_1[i];
   assign i_interleaved_mtree[i*3+2] = i_mux_pattern[2] ? node_3[i] :
                                                          node_2[i];
 end
 endgenerate

 

 

but will get "[Synth 8-2722] system function call unsigned is not allowed here." error message.

Is there any option in Vivado will support this syntax ?

 

BR.

thanks

Jeff.

Explorer
Posts: 166
Registered: ‎04-12-2017

Re: HI,about the $unsigned usage in generate for coding...

[ Edited ]

Hi,

 

In my opinion the question is not clear because the generate variable genvar (in this case 'i') is already a natural, positive number. So what would be the need of applying $unsigned typecast to a positive integer?

Avi Chami MSc
FPGA Site
Teacher
Posts: 5,130
Registered: ‎03-31-2012

Re: HI,about the $unsigned usage in generate for coding...

@a_chami 1800-2012 says: "The genvar is used as an integer during elaboration" so it's not a natural number (ie non-negative).

- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.