Problem with case-statement

V

Volker

Hi,

I have a VHDL Design containing a case statement. If I compile this design
with QuartusII 9.0 I get no error; compiling this design in ModelSim Altera
Starter Edition I get some errors like "Array type case expression must be
of a locally static subtype" and "Case choice must be a locally static
expression".

I Think the reason is that I use a "generic expression" in the
case-statement. Why did Quartus compile that without errors and ModelSim do
not? The synthesized Design will work, but I will do the simulation as well.

Any ideas to solve the problem?

The code:


library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;

entity VERSION_REGISTER is
generic(CPLD_VER: NATURAL:= 0;
HW_VER : NATURAL:= 2;
HW_TYPE : NATURAL:= 3;
MAX_CS_LINES: POSITIVE:= 16;-- max generated CS-Lines in complete design
START_CS_NR : NATURAL:= 0);-- CS-Line number of first version-register
port(CS : in BIT_VECTOR((MAX_CS_LINES-1) downto 0);
nRD : in STD_LOGIC;
DATA : out STD_LOGIC_VECTOR(7 downto 0));
end VERSION_REGISTER;

architecture BEHAVIOR of VERSION_REGISTER is
begin

process(CS, nRD)
variable ZERO : BIT_VECTOR((MAX_CS_LINES-1) downto 0):=(others=>'0');--
zero vector of length MAX_CS_LINES
variable SHIFT_PATTERN : BIT_VECTOR((MAX_CS_LINES-1) downto
0):=(0=>'1',others=>'0');-- pattern of length MAX_CS_LINES all zero but
Bit0=1
begin

if (CS = ZERO) then -- if no CS for CPLD active, set Databus to high Z
DATA <= (others =>'Z');
elsif (nRD'EVENT and nRD='0') then
case CS is
when (SHIFT_PATTERN sll START_CS_NR) => DATA <=
CONV_STD_LOGIC_VECTOR(CPLD_VER, 8);--CPLD version register
when (SHIFT_PATTERN sll (START_CS_NR +1))=> DATA <=
CONV_STD_LOGIC_VECTOR(HW_VER, 8);--HW version register
when (SHIFT_PATTERN sll (START_CS_NR +2))=> DATA <=
CONV_STD_LOGIC_VECTOR(HW_TYPE, 8);--HW type register
when others => DATA <= (others =>'Z');
end case;
end if;

end process;

end BEHAVIOR;



Thanks for help!
 
V

Volker

Thanks for telling this, but I use the ModelSim Altera Starter Edition and
in the modelsim.ini file there is no such entry :-(
Can I add these commands?
 
M

Mike Treseler

Volker said:
Thanks for telling this, but I use the ModelSim Altera Starter Edition and
in the modelsim.ini file there is no such entry :-(
Can I add these commands?

89 Wed May 06 tmp> mkdir foo
90 Fri May 08 tmp> cd foo
91 Fri May 08 tmp/foo> ls

92 Fri May 08 tmp/foo> vlib work
93 Fri May 08 tmp/foo> ls
work
94 Fri May 08 tmp/foo> vmap work work
Copying /flip/usr1/modeltech/linux/../modelsim.ini to modelsim.ini
Modifying modelsim.ini
95 Fri May 08 tmp/foo> ls
modelsim.ini work


-- Mike Treseler
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top