|
--------------------------------------------------------------------------------
|
|
--This file is part of fpga_gpib_controller.
|
|
--
|
|
-- Fpga_gpib_controller is free software: you can redistribute it and/or modify
|
|
-- it under the terms of the GNU General Public License as published by
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
|
-- (at your option) any later version.
|
|
--
|
|
-- Fpga_gpib_controller is distributed in the hope that it will be useful,
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
-- GNU General Public License for more details.
|
|
|
|
-- You should have received a copy of the GNU General Public License
|
|
-- along with Fpga_gpib_controller. If not, see <http://www.gnu.org/licenses/>.
|
----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
-- Company:
|
-- author: Andrzej Paluch
|
-- Engineer:
|
|
--
|
--
|
-- Create Date: 01:04:57 10/03/2011
|
-- Create Date: 01:04:57 10/03/2011
|
-- Design Name:
|
-- Design Name:
|
-- Module Name: if_func_DC - Behavioral
|
-- Module Name: if_func_DC - Behavioral
|
-- Project Name:
|
-- Project Name:
|
-- Target Devices:
|
-- Target Devices:
|
-- Tool versions:
|
-- Tool versions:
|
-- Description:
|
-- Description:
|
--
|
--
|
-- Dependencies:
|
-- Dependencies:
|
--
|
--
|
-- Revision:
|
-- Revision:
|
-- Revision 0.01 - File Created
|
-- Revision 0.01 - File Created
|
-- Additional Comments:
|
-- Additional Comments:
|
--
|
--
|
----------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------
|
library IEEE;
|
library IEEE;
|
use IEEE.STD_LOGIC_1164.ALL;
|
use IEEE.STD_LOGIC_1164.ALL;
|
|
|
---- Uncomment the following library declaration if instantiating
|
---- Uncomment the following library declaration if instantiating
|
---- any Xilinx primitives in this code.
|
---- any Xilinx primitives in this code.
|
--library UNISIM;
|
--library UNISIM;
|
--use UNISIM.VComponents.all;
|
--use UNISIM.VComponents.all;
|
|
|
entity if_func_DC is
|
entity if_func_DC is
|
port(
|
port(
|
-- device inputs
|
-- device inputs
|
clk : in std_logic; -- clock
|
clk : in std_logic; -- clock
|
-- state inputs
|
-- state inputs
|
LADS : in std_logic; -- listener addressed state (L or LE)
|
LADS : in std_logic; -- listener addressed state (L or LE)
|
ACDS : in std_logic; -- accept data state (AH)
|
ACDS : in std_logic; -- accept data state (AH)
|
-- instructions
|
-- instructions
|
DCL : in std_logic; -- my listen address
|
DCL : in std_logic; -- my listen address
|
SDC : in std_logic; -- unlisten
|
SDC : in std_logic; -- unlisten
|
-- local instructions
|
-- local instructions
|
clr : out std_logic -- clear device
|
clr : out std_logic -- clear device
|
);
|
);
|
end if_func_DC;
|
end if_func_DC;
|
|
|
architecture Behavioral of if_func_DC is
|
architecture Behavioral of if_func_DC is
|
|
|
-- states
|
-- states
|
type DC_STATE is (
|
type DC_STATE is (
|
-- device clear idle state
|
-- device clear idle state
|
ST_DCIS,
|
ST_DCIS,
|
-- device clear active state
|
-- device clear active state
|
ST_DCAS
|
ST_DCAS
|
);
|
);
|
|
|
-- current state
|
-- current state
|
signal current_state : DC_STATE;
|
signal current_state : DC_STATE;
|
|
|
-- predicates
|
-- predicates
|
signal pred1 : boolean;
|
signal pred1 : boolean;
|
signal pred2 : boolean;
|
signal pred2 : boolean;
|
|
|
begin
|
begin
|
|
|
-- state machine process
|
-- state machine process
|
process(clk) begin
|
process(clk) begin
|
|
|
if rising_edge(clk) then
|
if rising_edge(clk) then
|
|
|
case current_state is
|
case current_state is
|
------------------
|
------------------
|
when ST_DCIS =>
|
when ST_DCIS =>
|
if pred1 then
|
if pred1 then
|
current_state <= ST_DCAS;
|
current_state <= ST_DCAS;
|
end if;
|
end if;
|
------------------
|
------------------
|
when ST_DCAS =>
|
when ST_DCAS =>
|
if pred2 then
|
if pred2 then
|
current_state <= ST_DCIS;
|
current_state <= ST_DCIS;
|
end if;
|
end if;
|
------------------
|
------------------
|
when others =>
|
when others =>
|
current_state <= ST_DCIS;
|
current_state <= ST_DCIS;
|
end case;
|
end case;
|
end if;
|
end if;
|
|
|
end process;
|
end process;
|
|
|
-- predicates
|
-- predicates
|
pred1 <= (DCL='1' or (SDC='1' and LADS='1')) and ACDS='1';
|
pred1 <= (DCL='1' or (SDC='1' and LADS='1')) and ACDS='1';
|
pred2 <= not pred1;
|
pred2 <= not pred1;
|
|
|
-- clr generator
|
-- clr generator
|
with current_state select
|
with current_state select
|
clr <=
|
clr <=
|
'1' when ST_DCAS,
|
'1' when ST_DCAS,
|
'0' when others;
|
'0' when others;
|
|
|
end Behavioral;
|
end Behavioral;
|
|
|