OpenCores
URL https://opencores.org/ocsvn/open_hitter/open_hitter/trunk

Subversion Repositories open_hitter

[/] [open_hitter/] [trunk/] [bench/] [vhdl/] [hitter_wrapper.vhd] - Blame information for rev 20

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 stvhawes
--////////////////////////////////////////////////////////////////////
2
--//                                                              ////
3
--// hitter_wrapper.vhd                                           ////
4
--//                                                              ////
5
--// This file is part of the open_hitter opencores effort.       ////
6
--// <http://www.opencores.org/cores/open_hitter/>                ////
7
--//                                                              ////
8
--// Module Description:                                          ////
9
--// Simulation program (non-synthesizable)                       ////
10
--// Drives auto regression tests via NSEW button actions and     ////
11
--// NSEW LED reporting                                           ////
12
--// target env: ghdl <attrib required>                           ////
13
--//                                                              ////
14
--// To Do:                                                       ////
15
--//    #LOTS                                                     ////
16
--//                                                              ////
17
--// Author(s):                                                   ////
18
--// - Stephen Hawes                                              ////
19
--//                                                              ////
20
--////////////////////////////////////////////////////////////////////
21
--//                                                              ////
22
--// Copyright (C) 2015 Stephen Hawes and OPENCORES.ORG           ////
23
--//                                                              ////
24
--// This source file may be used and distributed without         ////
25
--// restriction provided that this copyright statement is not    ////
26
--// removed from the file and that any derivative work contains  ////
27
--// the original copyright notice and the associated disclaimer. ////
28
--//                                                              ////
29
--// This source file is free software; you can redistribute it   ////
30
--// and/or modify it under the terms of the GNU Lesser General   ////
31
--// Public License as published by the Free Software Foundation; ////
32
--// either version 2.1 of the License, or (at your option) any   ////
33
--// later version.                                               ////
34
--//                                                              ////
35
--// This source is distributed in the hope that it will be       ////
36
--// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
37
--// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
38
--// PURPOSE. See the GNU Lesser General Public License for more  ////
39
--// details.                                                     ////
40
--//                                                              ////
41
--// You should have received a copy of the GNU Lesser General    ////
42
--// Public License along with this source; if not, download it   ////
43
--// from <http://www.opencores.org/lgpl.shtml>                   ////
44
--//                                                              ////
45
--////////////////////////////////////////////////////////////////////
46
--//
47
--// \$Id\$  TAKE OUT THE \'s and this comment in order to get this to work
48
--//
49
--// CVS Revision History
50
--//
51
--// \$Log\$  TAKE OUT THE \'s and this comment in order to get this to work
52
--//
53 2 stvhawes
library ieee;
54 3 stvhawes
use ieee.std_logic_1164.all;
55
use std.textio.all; --  Imports the standard textio package.
56 2 stvhawes
 
57 3 stvhawes
     entity hitter_wrapper is
58
     end hitter_wrapper;
59
 
60
     architecture behaviour of hitter_wrapper is
61
        component hitter_sim
62
           port( RX_CLK: in std_logic;
63
                 PUSH_BUTTONS_5BITS_TRI_I: in std_logic_vector(4 downto 0);
64
                 LEDS_POSITIONS_TRI_O: out std_logic_vector(4 downto 0)
65
           );
66
        end component;
67
        for hitter_sim_0: hitter_sim use entity work.hitter_sim;
68
        signal RX_CLK: std_logic;
69
        signal PUSH_BUTTONS_5BITS_TRI_I: std_logic_vector(4 downto 0);
70
        signal LEDS_POSITIONS_TRI_O: std_logic_vector(4 downto 0);
71
     begin
72
        hitter_sim_0: hitter_sim port map (
73
                         RX_CLK => RX_CLK,
74
                         PUSH_BUTTONS_5BITS_TRI_I => PUSH_BUTTONS_5BITS_TRI_I,
75
                         LEDS_POSITIONS_TRI_O => LEDS_POSITIONS_TRI_O );
76
        process
77
           variable l : line;
78
           variable counted : integer;
79
        begin
80
           write (l, String'("Exercising hitter_sim"));
81
           writeline (output, l);
82 20 stvhawes
           PUSH_BUTTONS_5BITS_TRI_I <= std_logic_vector'("00000");
83 2 stvhawes
 
84 3 stvhawes
           RX_CLK <= '0';
85
           wait for 1 ns;
86 2 stvhawes
 
87 20 stvhawes
           for counted in 0 to 100 loop
88 3 stvhawes
              -- Instruct:
89 2 stvhawes
 
90 3 stvhawes
              if (counted = 2) then
91 20 stvhawes
                 PUSH_BUTTONS_5BITS_TRI_I <= std_logic_vector'("00001");
92 3 stvhawes
              else
93
                 PUSH_BUTTONS_5BITS_TRI_I <= std_logic_vector'("00000");
94
              end if;
95 2 stvhawes
 
96 3 stvhawes
              RX_CLK <= '1';
97
              wait for 1 ns;
98 2 stvhawes
 
99 3 stvhawes
              -- Report:
100
              write (l, String'("Count:"));
101
              write(l, counted);
102
              write (l, String'(" LEDs: "));
103
              for i in LEDS_POSITIONS_TRI_O'range loop
104
                 case LEDS_POSITIONS_TRI_O(i) is
105
                    when '1' => write(l, character'('1'));
106
                    when others => write(l, character'('0'));
107
                 end case;
108
              end loop;
109 20 stvhawes
--               writeline(output, l);
110
              write (l, String'("  "));
111
 
112
              -- led key: 
113
              -- LEDS_POSITIONS_TRI_O(0) <= alight;           -- C
114
              -- LEDS_POSITIONS_TRI_O(1) <= processing;       -- W
115
              -- LEDS_POSITIONS_TRI_O(2) <= result_one;       -- S
116
              -- LEDS_POSITIONS_TRI_O(3) <= result_two;       -- N
117
              -- LEDS_POSITIONS_TRI_O(4) <= result_all_ok;    -- E
118
              write (l, String'(" Active: "));
119
              write(l, std_logic'image(LEDS_POSITIONS_TRI_O(1)) );
120
              write (l, String'(" Processing: "));
121
              write(l, std_logic'image(LEDS_POSITIONS_TRI_O(0)) );
122
              write (l, String'(" Result_one: "));
123
              write(l, std_logic'image(LEDS_POSITIONS_TRI_O(2)) );
124
              write (l, String'(" Result_two: "));
125
              write(l, std_logic'image(LEDS_POSITIONS_TRI_O(3)) );
126
              write (l, String'("All_OK: "));
127
              write(l, std_logic'image(LEDS_POSITIONS_TRI_O(4)) );
128 3 stvhawes
              writeline(output, l);
129
 
130
              -- Reset:
131
              RX_CLK <= '0';
132
              wait for 1 ns;
133
           end loop;
134
 
135
           write (l, String'("Done hitter_sim"));
136
           writeline (output, l);
137
           wait;
138
        end process;
139
     end behaviour;
140
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.