c7685d822770e92f0f9acf35326bfdb99a68504b
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

1) LIBRARY ieee;
2) USE ieee.std_logic_1164.all;
3) USE ieee.numeric_std.all;
4) USE std.textio.all;
5) 
6) ENTITY e_testbed IS
7) END ENTITY e_testbed;
8) 
9) ARCHITECTURE a_testbed OF e_testbed IS
10) 
11)     COMPONENT e_system IS
12)         PORT (
13)             rst:          IN  std_logic;
14)             clk:          IN  std_logic;
15)             i_core_stall: IN  std_logic;
16)             i_prg_addr:   IN  std_logic_vector(31 DOWNTO 0);
17)             i_prg_data:   IN  std_logic_vector(31 DOWNTO 0);
18)             i_prg_en:     IN  std_logic;
19)             o_dummy:      OUT std_logic_vector(31 DOWNTO 0)
20)         );
21)     END COMPONENT e_system;
22) 
23)     SIGNAL s_rst:        std_logic;
24)     SIGNAL s_clk:        std_logic;
25)     SIGNAL s_core_stall: std_logic;
26)     SIGNAL s_prg_addr:   std_logic_vector(31 DOWNTO 0);
27)     SIGNAL s_prg_data:   std_logic_vector(31 DOWNTO 0);
28)     SIGNAL s_prg_en:     std_logic;
29)     SIGNAL s_dummy:      std_logic_vector(31 DOWNTO 0);
30) 
31) BEGIN
32) 
33)     system: e_system
34)         PORT MAP (
35)             clk          => s_clk,
36)             rst          => s_rst,
37)             i_core_stall => s_core_stall,
38)             i_prg_addr   => s_prg_addr,
39)             i_prg_data   => s_prg_data,
40)             i_prg_en     => s_prg_en,
41)             o_dummy      => s_dummy
42)         );
43) 
44)     p_rst_clk: PROCESS
Stefan Schuermans fix input of program in tesbed

Stefan Schuermans authored 12 years ago

45)         FILE     f_data:  text IS "fw/fw.dat";
46)         VARIABLE v_line:  line;
47)         VARIABLE v_addr:  integer;
48)         VARIABLE v_data1: integer;
49)         VARIABLE v_data2: integer;
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

50)     BEGIN
51)         s_rst        <= '0';
52)         s_clk        <= '0';
53)         s_core_stall <= '1';
54)         s_prg_addr   <= (OTHERS => '0');
55)         s_prg_data   <= (OTHERS => '0');
56)         s_prg_en     <= '0';
57) 
58)         WAIT FOR 1 ps;
59)         s_rst <= '1';
60)         WAIT FOR 1 ps;
61)         s_rst <= '0';
62) 
63)         s_prg_en <= '1';
64)         v_addr   := 0;
65)         WHILE NOT endfile(f_data) LOOP
66)             readline(f_data, v_line);
Stefan Schuermans fix input of program in tesbed

Stefan Schuermans authored 12 years ago

67)             read(v_line, v_data1);
68)             read(v_line, v_data2);
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

69)             s_prg_addr <= std_logic_vector(to_unsigned(v_addr, 32));
Stefan Schuermans fix input of program in tesbed

Stefan Schuermans authored 12 years ago

70)             s_prg_data <= std_logic_vector(to_unsigned(v_data2, 16)) &
71)                           std_logic_vector(to_unsigned(v_data1, 16));