How can I fix VHDL errors related to declaration and array types?

  • Thread starter hong de
  • Start date
Also, you need to declare the "std_logic_vector" type somewhere before using it, if that's possible in VHDL.
  • #1
hong de
3
0
library ieee;
use ieee.std_logic_1164.all;
entity miniproject is
port (dg1, dg2 : in std_logic_vector (3 downto 0);
led1, led2 : out std_logic_vector ( 6 downto 0);
output :eek:ut std_logic(6 downto 0));
end miniproject;
architecture arc of miniproject is
begin
with dg1 select
led1 <= "0010010" when "0010",
"1001100" when "0100",
"1111111" WHEN others;
with dg2 select
led2<= "0010010" when "0010",
"1001100" when "0100",
"1111111" WHEN others;


process( dg1,dg2 )
begin
if (dg1 = "0010" and dg2 = "0000") then
led1 <= '0' ; led2 <= '0' ;
elsif (dg1 = "0100" and dg2 = "0000") then
led1 <= '0' ; led2 <= '0' ;
else
led1 <= '1'; led2 <= '1';
end if;
end process;
end arc;

Error (10380): VHDL error at miniproject.vhd(6): std_logic type is used but not declared as an array type
Error: Quartus II Analysis & Synthesis was unsuccessful. 1 error, 0 warnings
Error: Processing ended: Tue Jul 26 09:21:14 2011
Error: Elapsed time: 00:00:02
 
Physics news on Phys.org
  • #2
The programme I want to do is using 8 inputs which represent 2 digits from 00 -99. Using 7- segments displays and Led1 and Led2 will light up when the values are "20" and "40". Hope you can help me.
 
  • #3
Need help with my lab!

Question: 8 inputs are used to represent 2 digits from 00 to 99. Show the value on the 7-segment displays and the Led1 and Led2 will light up when the values are “20” and “40” respectively.

My answer:
library ieee;
use ieee.std_logic_1164.all;
entity miniproject is
port (dg1, dg2 : in std_logic_vector (3 downto 0);
led1, led2 : out std_logic_vector ( 6 downto 0);
output :eek:ut std_logic(6 downto 0));
end miniproject;
architecture arc of miniproject is
begin
with dg1 select
led1 <= "0010010" when "0010",
"1001100" when "0100",
"1111111" WHEN others;
with dg2 select
led2<= "0010010" when "0010",
"1001100" when "0100",
"1111111" WHEN others;


process( dg1,dg2 )
begin
if (dg1 = "0010" and dg2 = "0000") then
led1 <= '0' ; led2 <= '0' ;
elsif (dg1 = "0100" and dg2 = "0000") then
led1 <= '0' ; led2 <= '0' ;
else
led1 <= '1'; led2 <= '1';
end if;
end process;
end arc;

Error (10380): VHDL error at miniproject.vhd(6): std_logic type is used but not declared as an array type
Error: Quartus II Analysis & Synthesis was unsuccessful. 1 error, 0 warnings
Error: Processing ended: Tue Jul 26 09:21:14 2011
Error: Elapsed time: 00:00:02




What is wrong? can anyone help me?? THX in advance. (If possible Help me edit)
 
  • #4
Just out of curiosity, what language is this? I don't recognize it.

[added] OK, I see from the error message that it's VHDL. Carry on...
 
  • #5


Perhaps you need to use "std_logic_vector" instead of "std_logic" in line 6 as you did in lines 4 and 5.
 

FAQ: How can I fix VHDL errors related to declaration and array types?

What does it mean to "need help with declaration"?

Needing help with declaration typically refers to needing assistance with declaring variables or data types in computer programming or scientific research. It involves assigning a name and data type to a value or variable for use in a program or experiment.

Why is it important to properly declare variables in programming or research?

Properly declaring variables is important because it allows for accurate and efficient processing of data. It also helps prevent errors and ensures that the data is being used and interpreted correctly.

What are some common mistakes made when declaring variables?

Some common mistakes include using incorrect syntax, not properly defining the data type, and not providing a value for the variable. These mistakes can lead to errors or incorrect results in the program or research.

What are some tips for effectively declaring variables?

Some tips include using descriptive and meaningful variable names, ensuring the data type matches the intended value, and declaring variables in the appropriate scope. It is also important to double check for any errors or typos before running the program or experiment.

How can I get help with declaration if I am struggling?

If you are struggling with declaring variables, you can seek help from a programming tutor or a colleague with experience in the field. Online resources and tutorials can also be helpful in understanding the basics of declaring variables. Additionally, debugging tools can assist in identifying and fixing any errors in your code.

Similar threads

Replies
1
Views
2K
Replies
3
Views
4K
Replies
1
Views
2K
Replies
2
Views
11K
Replies
5
Views
5K
Back
Top