Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package vhdl_pkg is
.
constant x: std_logic_vector ( 4 downto 0 ) := "10011" ;
.
end vhdl_pkg;
-- If package body is required
package body vhdl_pkg is
.
.
.
end package body;
Follow-up question,
Is it possible to declare 2 (or more) constants of the same name in different packages ?
And be able to access both (somewhat like structures in C) ?
if package_1.x = some_value ...
if package_2.x = some_value ...
signal a : ieee.numeric_sd.unsigned(7 downto 0);
signal b : ieee.std_logic_arith.unsigned(7 downto 0);
my_output0 <= a ieee.std_logic_unsigned."+" b;
my_output2 <= a ieee.std_logic_signed."+" b;
You can do this with libraries if you are willing to deal with the "work" library weirdness. Not sure about packages as I've never had a need for this.
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 library ieee; use ieee.std_logic_1164.all; package vhdl_pkg is constant CHIPID2: std_logic_vector(4 downto 0):= "00001"; end vhdl_pkg; library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library work; use work.vhdl_pkg.all; entity test; -- .....