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

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > VHDL

VHDL comp.lang.vhdl newsgroup / Usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-27-2006, 09:38 PM
cathy
Guest
 
Posts: n/a
Default Question about conditional generate

Hello, All.

I have a question about the conditional generate statement.
For my code:

constant C_BankNumBits : Natural :=1;
constant C_BankNum :Natural := 2**(C_BankNumBits);

G_RegBank1 : if(C_BankNumBits=0) generate
G_RegBank : for i in 0 to (C_BankNum-1) generate
RegBank : brb8
port map (
clka => clk, dina => dina(i), addra => addra,
wea => wea, douta => douta(i),
clkb => clk, dinb => dinb(i), addrb => addrb,
web => web, doutb => doutb(i));
end generate G_RegBank;
end generate G_RegBank1;

....... other generate statement......
(here, I want to use different memory size if different bank number is
used)

I defined addra as std_logic_vector(11-C_BankNumBits downto 0).
Addra in the component brb8 is (11 downto 0).
In this case, I think the above generate statement won't work because
it doesn't satisfy the conidtion: if(C_BankNumBits=0). But the ISE give
me the following error when I check the syntax:
"Width mismatch. Expected width 12, Actual width is 11 for dimension 1
of addra."

Can anybody explains this to me?

Thanks a lot,
Cathy

Reply With Quote
  #2 (permalink)  
Old 11-27-2006, 11:06 PM
Andy
Guest
 
Posts: n/a
Default Re: Question about conditional generate

You assume that c_banknumbits is 0 in the first assumption, yet it is
defined as 1.

Even though the generate statement is not elaborated, the width
checking is done at analysis (compile) time, which means that it must
be valid even if the generate statement turns out not to be elaborated.

Andy


cathy wrote:
> Hello, All.
>
> I have a question about the conditional generate statement.
> For my code:
>
> constant C_BankNumBits : Natural :=1;
> constant C_BankNum :Natural := 2**(C_BankNumBits);
>
> G_RegBank1 : if(C_BankNumBits=0) generate
> G_RegBank : for i in 0 to (C_BankNum-1) generate
> RegBank : brb8
> port map (
> clka => clk, dina => dina(i), addra => addra,
> wea => wea, douta => douta(i),
> clkb => clk, dinb => dinb(i), addrb => addrb,
> web => web, doutb => doutb(i));
> end generate G_RegBank;
> end generate G_RegBank1;
>
> ...... other generate statement......
> (here, I want to use different memory size if different bank number is
> used)
>
> I defined addra as std_logic_vector(11-C_BankNumBits downto 0).
> Addra in the component brb8 is (11 downto 0).
> In this case, I think the above generate statement won't work because
> it doesn't satisfy the conidtion: if(C_BankNumBits=0). But the ISE give
> me the following error when I check the syntax:
> "Width mismatch. Expected width 12, Actual width is 11 for dimension 1
> of addra."
>
> Can anybody explains this to me?
>
> Thanks a lot,
> Cathy


Reply With Quote
  #3 (permalink)  
Old 11-28-2006, 03:23 AM
cathy
Guest
 
Posts: n/a
Default Re: Question about conditional generate

Thank you very much for your help,
Cathy

Reply With Quote
Reply

Bookmarks


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
Question about conditional generate cathy VHDL 0 11-27-2006 09:38 PM
Problems with modelsim and conditional generate statement ArAgost VHDL 0 06-21-2006 10:55 AM
How to generate variable labels for same component within a generate loop Weng Tianxiang VHDL 5 02-16-2006 01:45 PM
Re: DDS question. How to generate a square from a sine wave? Austin Lesea FPGA 0 08-04-2003 03:52 PM


All times are GMT +1. The time now is 11:50 AM.


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