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

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [src/] [gpib/] [if_func_SR.vhd] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 Andrewski
--------------------------------------------------------------------------------
2
--This file is part of fpga_gpib_controller.
3
--
4
-- Fpga_gpib_controller is free software: you can redistribute it and/or modify
5
-- it under the terms of the GNU General Public License as published by
6
-- the Free Software Foundation, either version 3 of the License, or
7
-- (at your option) any later version.
8
--
9
-- Fpga_gpib_controller is distributed in the hope that it will be useful,
10
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
-- GNU General Public License for more details.
13
 
14
-- You should have received a copy of the GNU General Public License
15
-- along with Fpga_gpib_controller.  If not, see <http://www.gnu.org/licenses/>.
16 3 Andrewski
----------------------------------------------------------------------------------
17 13 Andrewski
-- Author: Andrzej Paluch
18 3 Andrewski
-- 
19
-- Create Date:    01:04:57 10/01/2011 
20
-- Design Name: 
21
-- Module Name:    if_func_SR - Behavioral 
22
-- Project Name: 
23
-- Target Devices: 
24
-- Tool versions: 
25
-- Description: 
26
--
27
-- Dependencies: 
28
--
29
-- Revision: 
30
-- Revision 0.01 - File Created
31
-- Additional Comments: 
32
--
33
----------------------------------------------------------------------------------
34
library IEEE;
35
use IEEE.STD_LOGIC_1164.ALL;
36
 
37
---- Uncomment the following library declaration if instantiating
38
---- any Xilinx primitives in this code.
39
--library UNISIM;
40
--use UNISIM.VComponents.all;
41
 
42
entity if_func_SR is
43
        port(
44
                -- device inputs
45
                clk : in std_logic; -- clock
46
                pon : in std_logic; -- power on
47
                rsv : in std_logic; -- service request
48
                -- state inputs
49
                SPAS : in std_logic; -- serial poll active state (T or TE)
50
                -- output instructions
51
                SRQ : out std_logic; -- service request
52
                -- reported states
53
                APRS : out std_logic -- affirmative poll response state
54
        );
55
end if_func_SR;
56
 
57
architecture Behavioral of if_func_SR is
58
 
59
 -- states
60
 type SR_STATE is (
61
  -- negative poll response state
62
  ST_NPRS,
63
  -- service request state
64
  ST_SRQS,
65
  -- affirmative poll response state
66
  ST_APRS
67
 );
68
 
69
 -- current state
70
 signal current_state : SR_STATE;
71
 
72
 -- predicates
73
 signal pred1 : boolean;
74
 signal pred2 : boolean;
75
 
76
begin
77
 
78
 -- state machine process
79
 process(pon, clk) begin
80
 
81
        if pon = '1' then
82
 
83
          current_state <= ST_NPRS;
84
 
85
        elsif rising_edge(clk) then
86
 
87
          case current_state is
88
            ------------------
89
            when ST_NPRS =>
90
                   if pred1 then
91
                     current_state <= ST_SRQS;
92
                        end if;
93
                 ------------------
94
                 when ST_SRQS =>
95
                   if pred2 then
96
                          current_state <= ST_NPRS;
97
                        elsif SPAS='1' then
98
                          current_state <= ST_APRS;
99
                        end if;
100
                 ------------------
101
                 when ST_APRS =>
102
                   if pred2 then
103
                          current_state <= ST_NPRS;
104
                        end if;
105
                 ------------------
106
                 when others =>
107
                   current_state <= ST_NPRS;
108
       end case;
109
        end if;
110
 
111
 end process;
112
 
113
 -- predicates
114
 pred1 <= rsv='1' and SPAS='0';
115
 pred2 <= rsv='0' and SPAS='0';
116
 
117
 -- APRS generator
118
 with current_state select
119
   APRS <=
120
                '1' when ST_APRS,
121
                '0' when others;
122
 
123
 -- SRQ generator
124
 with current_state select
125
   SRQ <=
126
                '1' when ST_SRQS,
127
                '0' when others;
128
 
129
end Behavioral;

powered by: WebSVN 2.1.0

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