1
|
--test bench written by alban bourge @ tima
|
2
|
library ieee;
|
3
|
use ieee.std_logic_1164.all;
|
4
|
use ieee.numeric_std.all;
|
5
|
|
6
|
package pkg_tb is
|
7
|
|
8
|
--fsm state types
|
9
|
type state_t is (Rst,Sig_start,Ack_data,Running,Waitfor,Cp_search,Cp_save,Idle,Rst_uut,Rest_ini0,Rest_ini1,Rest,Stop);
|
10
|
--context descriptor
|
11
|
subtype context_t is std_logic_vector(1 downto 0);
|
12
|
--argument width and type of fsm instruction
|
13
|
constant ARG_WIDTH : integer := 8;
|
14
|
subtype argument_t is unsigned(ARG_WIDTH - 1 downto 0);
|
15
|
|
16
|
type instruction is
|
17
|
record
|
18
|
state : state_t;
|
19
|
context_uut : context_t;
|
20
|
arg : argument_t;
|
21
|
end record;
|
22
|
|
23
|
--reset instruction
|
24
|
constant instr_rst : instruction := (state => Rst, context_uut => (others =>'0'), arg => (others =>'0'));
|
25
|
|
26
|
--ram instruction
|
27
|
type ram_instruction is
|
28
|
record
|
29
|
sel : std_logic;
|
30
|
we : std_logic;
|
31
|
addr_up : std_logic;
|
32
|
addr_z : std_logic;
|
33
|
end record;
|
34
|
|
35
|
constant ram_instr_z : ram_instruction := (sel => '0', we => '0', addr_up => '0', addr_z => '0');
|
36
|
|
37
|
--assert unit instruction
|
38
|
type assert_instruction is
|
39
|
record
|
40
|
en_feed : std_logic;
|
41
|
en_check : std_logic;
|
42
|
end record;
|
43
|
|
44
|
constant assert_instr_z : assert_instruction := (en_feed => '0', en_check => '0');
|
45
|
|
46
|
--size of instruction table defined by PC_SIZE i.e. width of program counter
|
47
|
constant PC_SIZE : integer := 5;
|
48
|
type table_behavior is array (0 to 2**PC_SIZE - 1) of instruction;
|
49
|
|
50
|
--constraint fixed by unit under test (augh dependant)
|
51
|
--##CONSTRAINTS_START##--
|
52
|
subtype stdin_vector is std_logic_vector(31 downto 0);
|
53
|
subtype stdout_vector is std_logic_vector(31 downto 0);
|
54
|
subtype cp_vector is std_logic_vector(63 downto 0);
|
55
|
--##CONSTRAINTS_END##--
|
56
|
|
57
|
--assert_uut vector number counter size
|
58
|
constant VEC_NO_SIZE : integer := 20;
|
59
|
|
60
|
end pkg_tb;
|