| 1 |
10 |
stvhawes |
--////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
--// ////
|
| 3 |
|
|
--// hitter_sim.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 |
|
|
--// Synthesizable simulation class for the class 'hitter' ////
|
| 10 |
|
|
--// * translates button actions/results onto NSEW buttons ////
|
| 11 |
|
|
--// and NSEW LEDs ////
|
| 12 |
|
|
--// * target env: Xilinx Virtex 6 / ML605 ////
|
| 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 |
|
|
library ieee;
|
| 54 |
|
|
use ieee.std_logic_1164.all;
|
| 55 |
|
|
|
| 56 |
|
|
entity hitter_sim is
|
| 57 |
|
|
port (
|
| 58 |
|
|
RX_CLK: in std_logic;
|
| 59 |
|
|
PUSH_BUTTONS_5BITS_TRI_I: in std_logic_vector(4 downto 0);
|
| 60 |
|
|
LEDS_POSITIONS_TRI_O: out std_logic_vector(4 downto 0)
|
| 61 |
|
|
);
|
| 62 |
|
|
end hitter_sim;
|
| 63 |
|
|
|
| 64 |
|
|
architecture implementation of hitter_sim is
|
| 65 |
20 |
stvhawes |
component search_control_sim
|
| 66 |
10 |
stvhawes |
port (
|
| 67 |
|
|
RX_CLK: in std_logic;
|
| 68 |
|
|
restart: in std_logic;
|
| 69 |
|
|
processing: out std_logic;
|
| 70 |
20 |
stvhawes |
result_one: out std_logic;
|
| 71 |
|
|
result_two: out std_logic;
|
| 72 |
|
|
result_all_ok: out std_logic
|
| 73 |
10 |
stvhawes |
);
|
| 74 |
|
|
end component;
|
| 75 |
20 |
stvhawes |
for search_control_sim_0: search_control_sim use entity work.search_control_sim;
|
| 76 |
10 |
stvhawes |
--signal RX_CLK: std_logic;
|
| 77 |
|
|
signal restart: std_logic;
|
| 78 |
|
|
signal processing: std_logic;
|
| 79 |
20 |
stvhawes |
signal result_one: std_logic;
|
| 80 |
|
|
signal result_two: std_logic;
|
| 81 |
|
|
signal result_all_ok: std_logic;
|
| 82 |
10 |
stvhawes |
--
|
| 83 |
20 |
stvhawes |
--temporarily commented
|
| 84 |
|
|
--component parse_price_sim
|
| 85 |
|
|
-- port (
|
| 86 |
|
|
-- RX_CLK: in std_logic;
|
| 87 |
|
|
-- restart: in std_logic;
|
| 88 |
|
|
-- processing: out std_logic;
|
| 89 |
|
|
-- result_is_ok: out std_logic
|
| 90 |
|
|
-- );
|
| 91 |
|
|
--end component;
|
| 92 |
|
|
--for parse_price_sim_0: parse_price_sim use entity work.parse_price_sim;
|
| 93 |
|
|
-- --signal RX_CLK: std_logic;
|
| 94 |
|
|
-- signal restart: std_logic;
|
| 95 |
|
|
-- signal processing: std_logic;
|
| 96 |
|
|
-- signal result_is_ok: std_logic;
|
| 97 |
|
|
--
|
| 98 |
10 |
stvhawes |
signal alight: std_logic := '0';
|
| 99 |
|
|
signal pos: integer := 0;
|
| 100 |
|
|
begin
|
| 101 |
20 |
stvhawes |
search_control_sim_0: search_control_sim port map (
|
| 102 |
10 |
stvhawes |
RX_CLK => RX_CLK,
|
| 103 |
|
|
restart => restart,
|
| 104 |
|
|
processing => processing,
|
| 105 |
20 |
stvhawes |
result_one => result_one,
|
| 106 |
|
|
result_two => result_two,
|
| 107 |
|
|
result_all_ok => result_all_ok
|
| 108 |
10 |
stvhawes |
);
|
| 109 |
|
|
--
|
| 110 |
20 |
stvhawes |
--temporarily commented
|
| 111 |
|
|
--parse_price_sim_0: parse_price_sim port map (
|
| 112 |
|
|
-- RX_CLK => RX_CLK,
|
| 113 |
|
|
-- restart => restart,
|
| 114 |
|
|
-- processing => processing,
|
| 115 |
|
|
-- result_is_ok => result_is_ok
|
| 116 |
|
|
--);
|
| 117 |
|
|
--
|
| 118 |
10 |
stvhawes |
flasher: process (RX_CLK) is
|
| 119 |
|
|
begin
|
| 120 |
|
|
if rising_edge(RX_CLK) then
|
| 121 |
23 |
stvhawes |
|
| 122 |
21 |
stvhawes |
-- if (pos < 4) then -- ghdl flash
|
| 123 |
23 |
stvhawes |
-- if (pos < 62500000) then -- 125Mhz timing / 0.5s
|
| 124 |
|
|
if (pos < 25000000) then -- 125Mhz timing / 0.2s
|
| 125 |
|
|
restart <= '1';
|
| 126 |
10 |
stvhawes |
pos <= pos + 1;
|
| 127 |
23 |
stvhawes |
elsif (pos < 125000000) then -- 125Mhz timing / 1s
|
| 128 |
|
|
pos <= pos + 1;
|
| 129 |
|
|
restart <= '0';
|
| 130 |
10 |
stvhawes |
else
|
| 131 |
|
|
alight <= not alight;
|
| 132 |
|
|
pos <= 0;
|
| 133 |
|
|
end if;
|
| 134 |
23 |
stvhawes |
|
| 135 |
10 |
stvhawes |
end if;
|
| 136 |
|
|
end process flasher;
|
| 137 |
|
|
|
| 138 |
20 |
stvhawes |
LEDS_POSITIONS_TRI_O(0) <= processing; -- C
|
| 139 |
|
|
LEDS_POSITIONS_TRI_O(1) <= alight; -- W
|
| 140 |
|
|
LEDS_POSITIONS_TRI_O(2) <= result_one; -- S
|
| 141 |
|
|
LEDS_POSITIONS_TRI_O(3) <= result_two; -- N
|
| 142 |
|
|
LEDS_POSITIONS_TRI_O(4) <= result_all_ok; -- E
|
| 143 |
23 |
stvhawes |
-- restart <= PUSH_BUTTONS_5BITS_TRI_I(0);
|
| 144 |
10 |
stvhawes |
end implementation;
|
| 145 |
|
|
|