1 |
2 |
arniml |
-------------------------------------------------------------------------------
|
2 |
|
|
--
|
3 |
|
|
-- The D port controller.
|
4 |
|
|
--
|
5 |
179 |
arniml |
-- $Id: t400_io_d.vhd 179 2009-04-01 19:48:38Z arniml $
|
6 |
2 |
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_opt_pack.all;
|
50 |
|
|
use work.t400_pack.all;
|
51 |
|
|
|
52 |
|
|
entity t400_io_d is
|
53 |
|
|
|
54 |
|
|
generic (
|
55 |
|
|
opt_out_type_3_g : integer := t400_opt_out_type_std_c;
|
56 |
|
|
opt_out_type_2_g : integer := t400_opt_out_type_std_c;
|
57 |
|
|
opt_out_type_1_g : integer := t400_opt_out_type_std_c;
|
58 |
|
|
opt_out_type_0_g : integer := t400_opt_out_type_std_c
|
59 |
|
|
);
|
60 |
|
|
port (
|
61 |
|
|
-- System Interface -------------------------------------------------------
|
62 |
|
|
ck_i : in std_logic;
|
63 |
|
|
ck_en_i : in boolean;
|
64 |
|
|
por_i : in boolean;
|
65 |
|
|
res_i : in boolean;
|
66 |
|
|
-- Control Interface ------------------------------------------------------
|
67 |
|
|
op_i : in io_d_op_t;
|
68 |
|
|
bd_i : in bd_t;
|
69 |
|
|
-- Port D Interface -------------------------------------------------------
|
70 |
|
|
io_d_o : out dw_t;
|
71 |
|
|
io_d_en_o : out dw_t
|
72 |
|
|
);
|
73 |
|
|
|
74 |
|
|
end t400_io_d;
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
use work.t400_io_pack.all;
|
78 |
|
|
|
79 |
|
|
architecture rtl of t400_io_d is
|
80 |
|
|
|
81 |
|
|
signal d_q : dw_t;
|
82 |
|
|
|
83 |
|
|
signal vdd_s : std_logic;
|
84 |
|
|
|
85 |
|
|
begin
|
86 |
|
|
|
87 |
|
|
vdd_s <= '1';
|
88 |
|
|
|
89 |
|
|
-----------------------------------------------------------------------------
|
90 |
|
|
-- Process d_reg
|
91 |
|
|
--
|
92 |
|
|
-- Purpose:
|
93 |
|
|
-- Implements the D output register.
|
94 |
|
|
--
|
95 |
|
|
d_reg: process (ck_i, por_i)
|
96 |
|
|
begin
|
97 |
|
|
if por_i then
|
98 |
|
|
d_q <= (others => '0');
|
99 |
|
|
|
100 |
|
|
elsif ck_i'event and ck_i = '1' then
|
101 |
|
|
if res_i then
|
102 |
|
|
-- synchronous reset upon external reset event
|
103 |
|
|
d_q <= (others => '0');
|
104 |
|
|
|
105 |
|
|
elsif ck_en_i then
|
106 |
|
|
if op_i = IOD_LOAD then
|
107 |
|
|
d_q <= bd_i;
|
108 |
|
|
end if;
|
109 |
|
|
end if;
|
110 |
|
|
|
111 |
|
|
end if;
|
112 |
|
|
end process d_reg;
|
113 |
|
|
--
|
114 |
|
|
-----------------------------------------------------------------------------
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
-----------------------------------------------------------------------------
|
118 |
|
|
-- Process out_driver
|
119 |
|
|
--
|
120 |
|
|
-- Purpose:
|
121 |
|
|
-- Implements the output driver data and enable.
|
122 |
|
|
--
|
123 |
12 |
arniml |
out_driver: process (d_q,
|
124 |
|
|
vdd_s)
|
125 |
2 |
arniml |
begin
|
126 |
|
|
-- bit 3
|
127 |
|
|
io_d_o(3) <= io_out_f(dat => d_q(3),
|
128 |
|
|
opt => opt_out_type_3_g);
|
129 |
|
|
io_d_en_o(3) <= io_en_f (en => vdd_s, dat => d_q(3),
|
130 |
|
|
opt => opt_out_type_3_g);
|
131 |
|
|
|
132 |
|
|
-- bit 2
|
133 |
|
|
io_d_o(2) <= io_out_f(dat => d_q(2),
|
134 |
|
|
opt => opt_out_type_2_g);
|
135 |
|
|
io_d_en_o(2) <= io_en_f (en => vdd_s, dat => d_q(2),
|
136 |
|
|
opt => opt_out_type_2_g);
|
137 |
|
|
|
138 |
|
|
-- bit 1
|
139 |
|
|
io_d_o(1) <= io_out_f(dat => d_q(1),
|
140 |
|
|
opt => opt_out_type_1_g);
|
141 |
|
|
io_d_en_o(1) <= io_en_f (en => vdd_s, dat => d_q(1),
|
142 |
|
|
opt => opt_out_type_1_g);
|
143 |
|
|
|
144 |
|
|
-- bit 0
|
145 |
|
|
io_d_o(0) <= io_out_f(dat => d_q(0),
|
146 |
|
|
opt => opt_out_type_0_g);
|
147 |
|
|
io_d_en_o(0) <= io_en_f (en => vdd_s, dat => d_q(0),
|
148 |
|
|
opt => opt_out_type_0_g);
|
149 |
|
|
|
150 |
|
|
end process out_driver;
|
151 |
|
|
--
|
152 |
|
|
-----------------------------------------------------------------------------
|
153 |
|
|
|
154 |
|
|
end rtl;
|