| 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 |
|
|
component parse_price_sim
|
| 66 |
|
|
port (
|
| 67 |
|
|
RX_CLK: in std_logic;
|
| 68 |
|
|
restart: in std_logic;
|
| 69 |
|
|
processing: out std_logic;
|
| 70 |
|
|
result_is_ok: out std_logic
|
| 71 |
|
|
);
|
| 72 |
|
|
end component;
|
| 73 |
|
|
for parse_price_sim_0: parse_price_sim use entity work.parse_price_sim;
|
| 74 |
|
|
--signal RX_CLK: std_logic;
|
| 75 |
|
|
signal restart: std_logic;
|
| 76 |
|
|
signal processing: std_logic;
|
| 77 |
|
|
signal result_is_ok: std_logic;
|
| 78 |
|
|
--
|
| 79 |
|
|
signal alight: std_logic := '0';
|
| 80 |
|
|
signal pos: integer := 0;
|
| 81 |
|
|
begin
|
| 82 |
|
|
parse_price_sim_0: parse_price_sim port map (
|
| 83 |
|
|
RX_CLK => RX_CLK,
|
| 84 |
|
|
restart => restart,
|
| 85 |
|
|
processing => processing,
|
| 86 |
|
|
result_is_ok => result_is_ok
|
| 87 |
|
|
);
|
| 88 |
|
|
--
|
| 89 |
|
|
flasher: process (RX_CLK) is
|
| 90 |
|
|
begin
|
| 91 |
|
|
if rising_edge(RX_CLK) then
|
| 92 |
|
|
if (pos < 4) then -- ghdl flash
|
| 93 |
|
|
-- if (pos < 62500000) then -- 125Mhz timing / 0.5s
|
| 94 |
|
|
pos <= pos + 1;
|
| 95 |
|
|
else
|
| 96 |
|
|
alight <= not alight;
|
| 97 |
|
|
pos <= 0;
|
| 98 |
|
|
end if;
|
| 99 |
|
|
end if;
|
| 100 |
|
|
end process flasher;
|
| 101 |
|
|
|
| 102 |
|
|
LEDS_POSITIONS_TRI_O(0) <= alight;
|
| 103 |
|
|
LEDS_POSITIONS_TRI_O(1) <= result_is_ok;
|
| 104 |
|
|
LEDS_POSITIONS_TRI_O(2) <= result_is_ok;
|
| 105 |
|
|
LEDS_POSITIONS_TRI_O(3) <= processing;
|
| 106 |
|
|
LEDS_POSITIONS_TRI_O(4) <= alight;
|
| 107 |
|
|
restart <= PUSH_BUTTONS_5BITS_TRI_I(0);
|
| 108 |
|
|
end implementation;
|
| 109 |
|
|
|