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

Subversion Repositories t400

[/] [t400/] [trunk/] [rtl/] [vhdl/] [t400_io_in.vhd] - Blame information for rev 52

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

Line No. Rev Author Line
1 45 arniml
-------------------------------------------------------------------------------
2
--
3
-- The IN port controller.
4
--
5 52 arniml
-- $Id: t400_io_in.vhd,v 1.2 2006-05-23 01:13:28 arniml Exp $
6 45 arniml
--
7
-- Copyright (c) 2006 Arnim Laeuger (arniml@opencores.org)
8
--
9
-- All rights reserved
10
--
11
-- Redistribution and use in source and synthezised forms, with or without
12
-- modification, are permitted provided that the following conditions are met:
13
--
14
-- Redistributions of source code must retain the above copyright notice,
15
-- this list of conditions and the following disclaimer.
16
--
17
-- Redistributions in synthesized form must reproduce the above copyright
18
-- notice, this list of conditions and the following disclaimer in the
19
-- documentation and/or other materials provided with the distribution.
20
--
21
-- Neither the name of the author nor the names of other contributors may
22
-- be used to endorse or promote products derived from this software without
23
-- specific prior written permission.
24
--
25
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
29
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
-- POSSIBILITY OF SUCH DAMAGE.
36
--
37
-- Please report bugs to the author, but before you do so, please
38
-- make sure that this is not a derivative work and that
39
-- you have the latest version of this file.
40
--
41
-- The latest version of this file can be found at:
42
--      http://www.opencores.org/cvsweb.shtml/t400/
43
--
44
-------------------------------------------------------------------------------
45
 
46
library ieee;
47
use ieee.std_logic_1164.all;
48
 
49
use work.t400_pack.all;
50
 
51
entity t400_io_in is
52
 
53
  port (
54
    -- System Interface -------------------------------------------------------
55
    ck_i    : in  std_logic;
56
    ck_en_i : in  boolean;
57
    por_i   : in  boolean;
58
    in_en_i : in  boolean;
59
    -- Control Interface ------------------------------------------------------
60
    op_i    : in  io_in_op_t;
61
    en1_i   : in  std_logic;
62
    -- Port Interface ---------------------------------------------------------
63
    io_in_i : in  dw_t;
64
    in_o    : out dw_t;
65
    int_o   : out boolean
66
  );
67
 
68
end t400_io_in;
69
 
70
 
71
architecture rtl of t400_io_in is
72
 
73
  constant idx_in3_c  : natural := 2;
74
  constant idx_in0_c  : natural := 1;
75
  constant idx_int_c  : natural := 0;
76
 
77
  type     neg_edge_t is array (natural range 1 downto 0) of
78
                           std_logic_vector(2 downto 0);
79
  signal   neg_edge_q : neg_edge_t;
80
  signal   neg_edge_s : std_logic_vector(2 downto 0);
81
 
82
  signal   il_q       : std_logic_vector(1 downto 0);
83
 
84
begin
85
 
86
  -----------------------------------------------------------------------------
87
  -- Process seq
88
  --
89
  -- Purpose:
90
  --   Implements the sequential elements.
91
  --
92
  seq: process (ck_i, por_i)
93
    variable neg_edge_v : std_logic_vector(2 downto 0);
94
  begin
95
    if por_i then
96 52 arniml
      neg_edge_q <= (others => (others => '0'));
97 45 arniml
      il_q       <= (others => '0');
98
 
99
    elsif ck_i'event and ck_i = '1' then
100
      -- negative edge detector filp-flops ------------------------------------
101 52 arniml
      neg_edge_v(idx_in3_c) := to_X01(io_in_i(3));
102
      neg_edge_v(idx_in0_c) := to_X01(io_in_i(0));
103
      neg_edge_v(idx_int_c) := to_X01(io_in_i(1));
104 45 arniml
 
105
      if in_en_i then
106
        neg_edge_q(0) <= neg_edge_v;
107
        neg_edge_q(1) <= neg_edge_q(0) or neg_edge_v;
108
      end if;
109
 
110
      -- IL latches -----------------------------------------------------------
111
      if in_en_i then
112
        if neg_edge_q(1)(idx_in3_c) = '1' and
113
           ((neg_edge_q(0)(idx_in3_c) or neg_edge_v(idx_in3_c)) = '0') then
114
          il_q(1) <= '1';
115
        end if;
116
        if neg_edge_q(1)(idx_in0_c) = '1' and
117
           ((neg_edge_q(0)(idx_in0_c) or neg_edge_v(idx_in0_c)) = '0') then
118
          il_q(0) <= '1';
119
        end if;
120
      end if;
121
 
122
      if ck_en_i then
123
        if op_i = IOIN_INIL then
124
          il_q <= (others => '0');
125
        end if;
126
      end if;
127
 
128
    end if;
129
  end process seq;
130
  --
131
  -----------------------------------------------------------------------------
132
 
133
 
134
  -----------------------------------------------------------------------------
135
  -- Output mapping
136
  -----------------------------------------------------------------------------
137
  in_o  <=   il_q(1) & "00" & il_q(0)
138
           when op_i = IOIN_INIL else
139
             io_in_i;
140
  int_o <= false;
141
 
142
end rtl;
143
 
144
 
145
-------------------------------------------------------------------------------
146
-- File History:
147
--
148
-- $Log: not supported by cvs2svn $
149 52 arniml
-- Revision 1.1  2006/05/22 00:00:55  arniml
150
-- initial check-in
151
--
152 45 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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