--////////////////////////////////////////////////////////////////////
|
--////////////////////////////////////////////////////////////////////
|
--// ////
|
--// ////
|
--// hitter_sim.vhd ////
|
--// hitter_sim.vhd ////
|
--// ////
|
--// ////
|
--// This file is part of the open_hitter opencores effort. ////
|
--// This file is part of the open_hitter opencores effort. ////
|
--// <http://www.opencores.org/cores/open_hitter/> ////
|
--// <http://www.opencores.org/cores/open_hitter/> ////
|
--// ////
|
--// ////
|
--// Module Description: ////
|
--// Module Description: ////
|
--// Synthesizable simulation class for the class 'hitter' ////
|
--// Synthesizable simulation class for the class 'hitter' ////
|
--// * translates button actions/results onto NSEW buttons ////
|
--// * translates button actions/results onto NSEW buttons ////
|
--// and NSEW LEDs ////
|
--// and NSEW LEDs ////
|
--// * target env: Xilinx Virtex 6 / ML605 ////
|
--// * target env: Xilinx Virtex 6 / ML605 ////
|
--// ////
|
--// ////
|
--// To Do: ////
|
--// To Do: ////
|
--// #LOTS ////
|
--// #LOTS ////
|
--// ////
|
--// ////
|
--// Author(s): ////
|
--// Author(s): ////
|
--// - Stephen Hawes ////
|
--// - Stephen Hawes ////
|
--// ////
|
--// ////
|
--////////////////////////////////////////////////////////////////////
|
--////////////////////////////////////////////////////////////////////
|
--// ////
|
--// ////
|
--// Copyright (C) 2015 Stephen Hawes and OPENCORES.ORG ////
|
--// Copyright (C) 2015 Stephen Hawes and OPENCORES.ORG ////
|
--// ////
|
--// ////
|
--// This source file may be used and distributed without ////
|
--// This source file may be used and distributed without ////
|
--// restriction provided that this copyright statement is not ////
|
--// restriction provided that this copyright statement is not ////
|
--// removed from the file and that any derivative work contains ////
|
--// removed from the file and that any derivative work contains ////
|
--// the original copyright notice and the associated disclaimer. ////
|
--// the original copyright notice and the associated disclaimer. ////
|
--// ////
|
--// ////
|
--// This source file is free software; you can redistribute it ////
|
--// This source file is free software; you can redistribute it ////
|
--// and/or modify it under the terms of the GNU Lesser General ////
|
--// and/or modify it under the terms of the GNU Lesser General ////
|
--// Public License as published by the Free Software Foundation; ////
|
--// Public License as published by the Free Software Foundation; ////
|
--// either version 2.1 of the License, or (at your option) any ////
|
--// either version 2.1 of the License, or (at your option) any ////
|
--// later version. ////
|
--// later version. ////
|
--// ////
|
--// ////
|
--// This source is distributed in the hope that it will be ////
|
--// This source is distributed in the hope that it will be ////
|
--// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
--// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
--// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
--// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
--// PURPOSE. See the GNU Lesser General Public License for more ////
|
--// PURPOSE. See the GNU Lesser General Public License for more ////
|
--// details. ////
|
--// details. ////
|
--// ////
|
--// ////
|
--// You should have received a copy of the GNU Lesser General ////
|
--// You should have received a copy of the GNU Lesser General ////
|
--// Public License along with this source; if not, download it ////
|
--// Public License along with this source; if not, download it ////
|
--// from <http://www.opencores.org/lgpl.shtml> ////
|
--// from <http://www.opencores.org/lgpl.shtml> ////
|
--// ////
|
--// ////
|
--////////////////////////////////////////////////////////////////////
|
--////////////////////////////////////////////////////////////////////
|
--//
|
--//
|
--// \$Id\$ TAKE OUT THE \'s and this comment in order to get this to work
|
--// \$Id\$ TAKE OUT THE \'s and this comment in order to get this to work
|
--//
|
--//
|
--// CVS Revision History
|
--// CVS Revision History
|
--//
|
--//
|
--// \$Log\$ TAKE OUT THE \'s and this comment in order to get this to work
|
--// \$Log\$ TAKE OUT THE \'s and this comment in order to get this to work
|
--//
|
--//
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
|
|
entity hitter_sim is
|
entity hitter_sim is
|
port (
|
port (
|
RX_CLK: in std_logic;
|
RX_CLK: in std_logic;
|
PUSH_BUTTONS_5BITS_TRI_I: in std_logic_vector(4 downto 0);
|
PUSH_BUTTONS_5BITS_TRI_I: in std_logic_vector(4 downto 0);
|
LEDS_POSITIONS_TRI_O: out std_logic_vector(4 downto 0)
|
LEDS_POSITIONS_TRI_O: out std_logic_vector(4 downto 0)
|
);
|
);
|
end hitter_sim;
|
end hitter_sim;
|
|
|
architecture implementation of hitter_sim is
|
architecture implementation of hitter_sim is
|
component search_control_sim
|
component search_control_sim
|
port (
|
port (
|
RX_CLK: in std_logic;
|
RX_CLK: in std_logic;
|
restart: in std_logic;
|
restart: in std_logic;
|
processing: out std_logic;
|
processing: out std_logic;
|
result_one: out std_logic;
|
result_one: out std_logic;
|
result_two: out std_logic;
|
result_two: out std_logic;
|
result_all_ok: out std_logic
|
result_all_ok: out std_logic
|
);
|
);
|
end component;
|
end component;
|
for search_control_sim_0: search_control_sim use entity work.search_control_sim;
|
for search_control_sim_0: search_control_sim use entity work.search_control_sim;
|
--signal RX_CLK: std_logic;
|
--signal RX_CLK: std_logic;
|
signal restart: std_logic;
|
signal restart: std_logic;
|
signal processing: std_logic;
|
signal processing: std_logic;
|
signal result_one: std_logic;
|
signal result_one: std_logic;
|
signal result_two: std_logic;
|
signal result_two: std_logic;
|
signal result_all_ok: std_logic;
|
signal result_all_ok: std_logic;
|
--
|
--
|
--temporarily commented
|
--temporarily commented
|
--component parse_price_sim
|
--component parse_price_sim
|
-- port (
|
-- port (
|
-- RX_CLK: in std_logic;
|
-- RX_CLK: in std_logic;
|
-- restart: in std_logic;
|
-- restart: in std_logic;
|
-- processing: out std_logic;
|
-- processing: out std_logic;
|
-- result_is_ok: out std_logic
|
-- result_is_ok: out std_logic
|
-- );
|
-- );
|
--end component;
|
--end component;
|
--for parse_price_sim_0: parse_price_sim use entity work.parse_price_sim;
|
--for parse_price_sim_0: parse_price_sim use entity work.parse_price_sim;
|
-- --signal RX_CLK: std_logic;
|
-- --signal RX_CLK: std_logic;
|
-- signal restart: std_logic;
|
-- signal restart: std_logic;
|
-- signal processing: std_logic;
|
-- signal processing: std_logic;
|
-- signal result_is_ok: std_logic;
|
-- signal result_is_ok: std_logic;
|
--
|
--
|
signal alight: std_logic := '0';
|
signal alight: std_logic := '0';
|
signal pos: integer := 0;
|
signal pos: integer := 0;
|
begin
|
begin
|
search_control_sim_0: search_control_sim port map (
|
search_control_sim_0: search_control_sim port map (
|
RX_CLK => RX_CLK,
|
RX_CLK => RX_CLK,
|
restart => restart,
|
restart => restart,
|
processing => processing,
|
processing => processing,
|
result_one => result_one,
|
result_one => result_one,
|
result_two => result_two,
|
result_two => result_two,
|
result_all_ok => result_all_ok
|
result_all_ok => result_all_ok
|
);
|
);
|
--
|
--
|
--temporarily commented
|
--temporarily commented
|
--parse_price_sim_0: parse_price_sim port map (
|
--parse_price_sim_0: parse_price_sim port map (
|
-- RX_CLK => RX_CLK,
|
-- RX_CLK => RX_CLK,
|
-- restart => restart,
|
-- restart => restart,
|
-- processing => processing,
|
-- processing => processing,
|
-- result_is_ok => result_is_ok
|
-- result_is_ok => result_is_ok
|
--);
|
--);
|
--
|
--
|
flasher: process (RX_CLK) is
|
flasher: process (RX_CLK) is
|
begin
|
begin
|
if rising_edge(RX_CLK) then
|
if rising_edge(RX_CLK) then
|
|
|
-- if (pos < 4) then -- ghdl flash
|
-- if (pos < 4) then -- ghdl flash
|
if (pos < 62500000) then -- 125Mhz timing / 0.5s
|
-- if (pos < 62500000) then -- 125Mhz timing / 0.5s
|
|
if (pos < 25000000) then -- 125Mhz timing / 0.2s
|
|
restart <= '1';
|
|
pos <= pos + 1;
|
|
elsif (pos < 125000000) then -- 125Mhz timing / 1s
|
pos <= pos + 1;
|
pos <= pos + 1;
|
|
restart <= '0';
|
else
|
else
|
alight <= not alight;
|
alight <= not alight;
|
pos <= 0;
|
pos <= 0;
|
end if;
|
end if;
|
|
|
end if;
|
end if;
|
end process flasher;
|
end process flasher;
|
|
|
LEDS_POSITIONS_TRI_O(0) <= processing; -- C
|
LEDS_POSITIONS_TRI_O(0) <= processing; -- C
|
LEDS_POSITIONS_TRI_O(1) <= alight; -- W
|
LEDS_POSITIONS_TRI_O(1) <= alight; -- W
|
LEDS_POSITIONS_TRI_O(2) <= result_one; -- S
|
LEDS_POSITIONS_TRI_O(2) <= result_one; -- S
|
LEDS_POSITIONS_TRI_O(3) <= result_two; -- N
|
LEDS_POSITIONS_TRI_O(3) <= result_two; -- N
|
LEDS_POSITIONS_TRI_O(4) <= result_all_ok; -- E
|
LEDS_POSITIONS_TRI_O(4) <= result_all_ok; -- E
|
restart <= PUSH_BUTTONS_5BITS_TRI_I(0);
|
-- restart <= PUSH_BUTTONS_5BITS_TRI_I(0);
|
end implementation;
|
end implementation;
|
|
|
|
|