Altera_Forum
Honored Contributor
9 years agoType problem? Compiler doesn't help me!
Hi everyone,
My software works for the compilation. But now I had a table 7seg to display my work. But it doesn't compile without error! I'm lost. My two questions are: questions 1): Why this line is not working? type rang0to15 is natural range (0 to 15); --With or without () have the same error message! --Error (10500): VHDL syntax error at LabProfBCD4Bits.vhd(25) near text "natural"; expecting "(", or "access", or "array", or "file", or "range", or "record" questions 2): Why this line is not working? Q7Seg <= Table_Nbres((0 to 15)iCntBCD); --Outgoing: 7SegLED with cast of type --Error (10500): VHDL syntax error at LabProfBCD4Bits.vhd(51) near text ")"; expecting "!", or "=>" Thank you in advance for your help. Part of my soft : --4 bits BCD counter. -- VHDL Language and Board: : ? (not with me right now!) library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity LabProfBCD4BITS is port( Clk: in std_logic; nReset: in std_logic; Q: out std_logic_vector(3 downto 0);--For testing soft in simulation. Q7Seg: out std_logic_vector(7 downto 0) –New version. ); end entity LabProfBCD4BITS; architecture bhv of LabProfBCD4BITS is --CntBCD is signal iCntBCD: natural (3 downto 0);--Signal for internal computing. constant MaxDelay: natural :=50000-1; signal iCntDelay: natural range 0 to MaxDelay; signal CntUpBCD: std_logic;--to increment iCntBCD. --type rang0to15 is natural range (0 to 15); --With or without () have the same error message! --Error (10500): VHDL syntax error at LabProfBCD4Bits.vhd(25) near text "natural"; expecting "(", or "access", or "array", or "file", or "range", or "record" --type tBCD7Seg is array (rang0to15) of std_logic_vector(7 downto 0); --it doesn’t work!?! type tBCD7Seg is array (0 to 15) of std_logic_vector(7 downto 0); --With bit_vector, it looks also working. constant Table_Nbres : tBCD7Seg := ( -- Dpgfedcba "00111111", -- 0 "00000110", -- 1 "01011011", -- 2 {[And so on]} "11111001", -- D --show "E.", means Error. "11111001", -- E "11111001" -- F ); begin Q <= std_logic_vector(iCntBCD);--Used for simulation. Work well. Q7Seg <= Table_Nbres((0 to 15)iCntBCD); --Outgoing: 7SegLED with cast of type --Error (10500): VHDL syntax error at LabProfBCD4Bits.vhd(51) near text ")"; expecting "!", or "=>" --Q7Seg <= Table_Nbres(iCntBCD); --Outgoing: 7SegLED without cast of type --Error (10380): VHDL error at LabProfBCD4Bits.vhd(20): natural type is used but not declared as an array type {[The line 20 is: signal iCntBCD: natural (3 downto 0);-- In this case, the error is that no have a cast. Both type are different.]}