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 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 Andrewski
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    01:04:57 10/01/2011 
6
-- Design Name: 
7
-- Module Name:    if_func_SR - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
 
23
---- Uncomment the following library declaration if instantiating
24
---- any Xilinx primitives in this code.
25
--library UNISIM;
26
--use UNISIM.VComponents.all;
27
 
28
entity if_func_SR is
29
        port(
30
                -- device inputs
31
                clk : in std_logic; -- clock
32
                pon : in std_logic; -- power on
33
                rsv : in std_logic; -- service request
34
                -- state inputs
35
                SPAS : in std_logic; -- serial poll active state (T or TE)
36
                -- output instructions
37
                SRQ : out std_logic; -- service request
38
                -- reported states
39
                APRS : out std_logic -- affirmative poll response state
40
        );
41
end if_func_SR;
42
 
43
architecture Behavioral of if_func_SR is
44
 
45
 -- states
46
 type SR_STATE is (
47
  -- negative poll response state
48
  ST_NPRS,
49
  -- service request state
50
  ST_SRQS,
51
  -- affirmative poll response state
52
  ST_APRS
53
 );
54
 
55
 -- current state
56
 signal current_state : SR_STATE;
57
 
58
 -- predicates
59
 signal pred1 : boolean;
60
 signal pred2 : boolean;
61
 
62
begin
63
 
64
 -- state machine process
65
 process(pon, clk) begin
66
 
67
        if pon = '1' then
68
 
69
          current_state <= ST_NPRS;
70
 
71
        elsif rising_edge(clk) then
72
 
73
          case current_state is
74
            ------------------
75
            when ST_NPRS =>
76
                   if pred1 then
77
                     current_state <= ST_SRQS;
78
                        end if;
79
                 ------------------
80
                 when ST_SRQS =>
81
                   if pred2 then
82
                          current_state <= ST_NPRS;
83
                        elsif SPAS='1' then
84
                          current_state <= ST_APRS;
85
                        end if;
86
                 ------------------
87
                 when ST_APRS =>
88
                   if pred2 then
89
                          current_state <= ST_NPRS;
90
                        end if;
91
                 ------------------
92
                 when others =>
93
                   current_state <= ST_NPRS;
94
       end case;
95
        end if;
96
 
97
 end process;
98
 
99
 -- predicates
100
 pred1 <= rsv='1' and SPAS='0';
101
 pred2 <= rsv='0' and SPAS='0';
102
 
103
 -- APRS generator
104
 with current_state select
105
   APRS <=
106
                '1' when ST_APRS,
107
                '0' when others;
108
 
109
 -- SRQ generator
110
 with current_state select
111
   SRQ <=
112
                '1' when ST_SRQS,
113
                '0' when others;
114
 
115
end Behavioral;

powered by: WebSVN 2.1.0

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