--	Package File Template
--
--	Purpose: This package defines supplemental types, subtypes, 
--		 constants, and functions 
-- Defines types used for "Bus Functional Model" of pulse generation and
-- IPBus cycle generation

library IEEE;
use IEEE.STD_LOGIC_1164.all;
USE ieee.numeric_std.ALL;

package BFMTypes is

	constant c_BUSWIDTH : natural := 32;

	-- List transaction types
	constant NTRANSACTION_TYPES : integer := 4;
	constant IPBUS              : integer := 0;
	constant RESET              : integer := 1;
	constant PAUSE              : integer := 2;
	constant PULSE              : integer := 3;

	constant COMMENT : integer := 777;  -- make it large and easy to remember

	constant WRITE_TO_SLAVE             : integer := 0;
	constant READ_FROM_SLAVE            : integer := 1;
	constant READ_FROM_SLAVE_WITH_CHECK : integer := 2;

	-- map each transaction onto a port with a transactor attached
	constant NTRANSACTORS    : integer         := 2;
	constant IPBUSPORT       : integer         := 0;
	constant PULSEPORT       : integer         := 1;
	type t_transactorMap is array (NTRANSACTION_TYPES - 1 downto 0) of integer;
	constant c_transactorMap : t_transactorMap := (IPBUS => IPBUSPORT,
	                                               RESET => 999,
	                                               PAUSE => 999,
	                                               PULSE => PULSEPORT
	                                              );

	type t_transactorReturnValues is array (NTRANSACTORS - 1 downto 0) of integer;

	constant TIMEUNIT : time := 100 ps; --! Sets units for pulse and sync

	subtype t_wbTransactionReturn is std_logic_vector(c_BUSWIDTH - 1 downto 0);

	type t_wbTransaction is record
		r_read_write : integer;
		r_addr       : t_wbTransactionReturn;
		r_data       : t_wbTransactionReturn;
	end record;

	constant c_wbNullTransactionReturn : t_wbTransactionReturn := (others => '0');

	-- Define the number of channels with pulses on....
	constant c_NPULSE_CHANNELS : integer := 6;

	type t_PULSEDEF is record
		r_delay : integer;
		r_width : integer;
	end record;

	type t_pulseTransaction is array (c_NPULSE_CHANNELS - 1 downto 0) of t_PULSEDEF;
	subtype t_pulseTransactionReturn is integer;

	-- VHDL 2008 has no dynamically sizable strings :-(
	constant c_MAX_COMMAND_LINE_LENGTH : integer := (25 * c_NPULSE_CHANNELS) + 200;

end BFMTypes;

