USER_DEFS_PKG.vhd File Reference

Overview

USER_DEFS_PKG.vhd is one of (4) auto-generated files that SpeakHDL creates or updates inside the top directory when the 'ok' command is given. The USER_DEFS_PKG.vhd file contains all necessary compile time constants that are necessary for simulation and synthesis. Before compile time, SpeakHDL analyses the config_file and application module files and generates the USER_DEFS_PKG.vhd file based on the consolidation of input parameters of each API call. The primary purpose of the file is to:

1) Setup the compile time constants that are needed in the SPEAKHDL_API_PKG.vhdp library.
2) Define the module_index for each application module.
3) Constrain the maximum range of integers values in order to achieve an efficient synthesis result.

It is important to note that the SPEAKHDL_API_PKG.vhdp library file has a dependency on the constants defined in USER_DEFS_PKG.vhd. The subtle implications are that if changes are made to an application module in a text editor without the USER_DEFS_PKG.vhd being updated, it is likely that an error is generated by the library file inside the simulation/synthesis tool. Thus, the user is required to run the 'ok' command within an application module as the last step before simulation/synthesis. This is to ensures that the constants defined in USER_DEFS_PKG.vhd file are up to date.

Example USER_DEFS_PKG.vhd File

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package user_defs_pkg is
-------------------------------------------------------------------------
----------------USER APPLICATION CONSTANTS-------------------------------
-------------------------------------------------------------------------
constant SYS_CLK : natural := 100E6;
constant RESET_POLARITY : std_logic := '1';
constant NUM_RESOURCES : natural := 2;
constant NUM_DATA_BITS : natural := 16;
constant NUM_CONTROL_BITS : natural := 16;
constant NUM_EVENTS : natural := 0;
constant NUM_CONDITIONAL_TRANSITIONS : integer := 0;
constant DEFAULT_SHARED_REGISTER_POLARITY : std_logic := '0';
constant FIXED_PORT_WIDTH : integer := -1;
-------------------------------------------------------------------------
----------------FRAMEWORK CLOCK DOMAIN CONSTANTS-------------------------
-------------------------------------------------------------------------
constant NUM_CLOCK_DOMAINS : natural := 1;
type CLOCK_ARRAY_TYPE is array (0 to NUM_CLOCK_DOMAINS -1) of natural;
constant SM_CLOCK_ARRAY : CLOCK_ARRAY_TYPE := (100000000, others => 0);
-------------------------------------------------------------------------
------------ENABLED MODULES ENUMERATION CONSTANTS------------------------
-------------------------------------------------------------------------
constant app_module_2 : natural := 0;
constant app_module_1 : natural := 1;
-------------------------------------------------------------------------
-----------DISABLED MODULES ENUMERATION CONSTANTS------------------------
-------------------------------------------------------------------------
-- (None)
-------------------------------------------------------------------------
---------SUBTYPE FOR FRAMEWORK COUNTER MAXIMUM RANGE---------------------
-------------------------------------------------------------------------
subtype COUNT_INTEGER is natural range 0 to 0;
subtype DIVIDE_INTEGER is integer range -1 to 0;
subtype DELAY_INTEGER is integer range -1 to 0;
-------------------------------------------------------------------------
-------------FRAMEWORK RESOURCE RECORD TYPE------------------------------
-------------------------------------------------------------------------
type SM_RESOURCE_REC is record
WIDTH_INPUT : integer;
WIDTH_OUTPUT : integer;
WIDTH_INPUT_OUTPUT : integer;
FIFO_WIDTH : integer;
FIFO_LENGTH : integer;
NUM_TRANSITION_COUNTERS : integer;
NUM_RISING_EDGE_DETECTS : integer;
NUM_FALLING_EDGE_DETECTS : integer;
end record;
type SM_RESOURCE_REC_ARRAY is array (0 to NUM_RESOURCES - 1) of SM_RESOURCE_REC;
-------------------------------------------------------------------------
-------------FRAMEWORK RESOURCE COUNT SUMMARY----------------------------
-------------------------------------------------------------------------
constant SM_SETUP_ARRAY : SM_RESOURCE_REC_ARRAY :=(
--this is setup array. param array is calculated
--input, output, inout, fifo_width, fifo_depth, num_gp_counters, num_REDs, num_FEDs
(
app_module_2 => (6, 1, 8, 0, 0, 0, 0, 0),
app_module_1 => (2, 4, 0, 0, 0, 0, 0, 0),
others => (others => 0)
));
-------------------------------------------------------------------------
--------------GENERAL PURPOSE COUNTER UTILIZATION------------------------
-------------------------------------------------------------------------
type COUNTER_RESOURCE_REC is record
SM_INDEX : integer;
COUNTER_INDEX : integer;
TERMINAL_COUNT : integer;
end record;
type COUNTER_RESOURCE_ARRAY is array (natural range <>) of COUNTER_RESOURCE_REC;
constant COUNTER_RANGE_ARRAY : COUNTER_RESOURCE_ARRAY := (
(
0 => (0, 0, 0)
));
-------------------------------------------------------------------------
-----------------DELAY AND DIVIDE COUNTER UTILIZATION---------------------------
-------------------------------------------------------------------------
type DELAY_COUNTER_RESOURCE_REC is record
SM_INDEX : integer;
DELAY_TERMINAL_COUNT : integer;
DIVIDE_TERMINAL_COUNT : integer;
end record;
type DELAY_COUNTER_RESOURCE_ARRAY is array (0 to NUM_RESOURCES) of DELAY_COUNTER_RESOURCE_REC;
constant DELAY_COUNTER_RANGE_ARRAY : DELAY_COUNTER_RESOURCE_ARRAY := (
(
others => (0, 0, 0)
));
end USER_DEFS_PKG;
-------------------------------------------------------------------------
--------------------PACKAGE BODY (N/A)-----------------------------------
-------------------------------------------------------------------------
--package body USER_DEFS_PKG is
--end package body USER_DEFS_PKG;
See also
TOP.vhd
TESTBENCH.vhd
IO_CONFIG.cfg
PINOUT.xdc
SPEAKHDL_API_PKG.vhd
DISABLE_FILE