Forum Discussion
Altera_Forum
Honored Contributor
14 years agoproblems: object "std_logic" is not declared
Hi;
I try write a code for convert integer to ufixed: package my_data_types is type vector is array (natural range <>) of integer; type ufixed is array (natural range <>) of std_logic; end my_data_types; library ieee; library ieee_proposed; use ieee_proposed.fixed_pkg.all; use work.my_data_types.all; entity fix is port (clk: in bit; nprev: in vector (0 to 7); ip1: out ufixed (3 downto -4)); end fix; architecture fix of fix is signal n1: ufixed (3 downto -4); begin process(clk) begin if (clk'event and clk='1') then for i in 0 to 7 loop ip1(i) <= to_ufixed (nprev(i),n1); end loop; end if; end process; end fix; I get this error: Error (10482): VHDL error at fix.vhd(3): object "std_logic" is used but not declared. How to declare the "std_logic" in package?..16 Replies
- Altera_Forum
Honored Contributor
Sorry Tricky, I don't get what you say. How to declare an array of ufixed values? Thanks for reply
- Altera_Forum
Honored Contributor
ip1(i) is a single bit. You cannot assign an entire array (the ufixed) to a single bit.
You need to decalre an array of ufixed values. - Altera_Forum
Honored Contributor
Now I get this error:
Error (10511): VHDL Qualified Expression error at fix.vhd(23): to_ufixed type specified in Qualified Expression must match std_ulogic type that is implied for expression by context. At this line: ip1(i) <= to_ufixed (nprev(i),n1); Why?..thanks for reply - Altera_Forum
Honored Contributor
you dont need this
type ufixed is array (natural range <>) of std_logic; It is already declared in the fixed_pkg. - Altera_Forum
Honored Contributor
What the right way to declare ufixed as an array?..thanks for reply
- Altera_Forum
Honored Contributor
First of all. DO NOT declare your own version of ufixed, it is in the fixed_pkg library. You are going to have problems if you do this.
Secondly, you need to include the line: library ieee; use ieee.std_logic_1164.all;