1 |
4 |
arniml |
-------------------------------------------------------------------------------
|
2 |
|
|
--
|
3 |
|
|
-- The Port 1 unit.
|
4 |
|
|
-- Implements the Port 1 logic.
|
5 |
|
|
--
|
6 |
|
|
-- $Id: p1.vhd,v 1.1 2004-03-23 21:31:52 arniml Exp $
|
7 |
|
|
--
|
8 |
|
|
-- All rights reserved
|
9 |
|
|
--
|
10 |
|
|
-- Redistribution and use in source and synthezised forms, with or without
|
11 |
|
|
-- modification, are permitted provided that the following conditions are met:
|
12 |
|
|
--
|
13 |
|
|
-- Redistributions of source code must retain the above copyright notice,
|
14 |
|
|
-- this list of conditions and the following disclaimer.
|
15 |
|
|
--
|
16 |
|
|
-- Redistributions in synthesized form must reproduce the above copyright
|
17 |
|
|
-- notice, this list of conditions and the following disclaimer in the
|
18 |
|
|
-- documentation and/or other materials provided with the distribution.
|
19 |
|
|
--
|
20 |
|
|
-- Neither the name of the author nor the names of other contributors may
|
21 |
|
|
-- be used to endorse or promote products derived from this software without
|
22 |
|
|
-- specific prior written permission.
|
23 |
|
|
--
|
24 |
|
|
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
25 |
|
|
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
26 |
|
|
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
27 |
|
|
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
|
28 |
|
|
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
29 |
|
|
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
30 |
|
|
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
31 |
|
|
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
32 |
|
|
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
33 |
|
|
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
34 |
|
|
-- POSSIBILITY OF SUCH DAMAGE.
|
35 |
|
|
--
|
36 |
|
|
-- Please report bugs to the author, but before you do so, please
|
37 |
|
|
-- make sure that this is not a derivative work and that
|
38 |
|
|
-- you have the latest version of this file.
|
39 |
|
|
--
|
40 |
|
|
-- The latest version of this file can be found at:
|
41 |
|
|
-- http://www.opencores.org/cvsweb.shtml/t48/
|
42 |
|
|
--
|
43 |
|
|
-------------------------------------------------------------------------------
|
44 |
|
|
|
45 |
|
|
library ieee;
|
46 |
|
|
use ieee.std_logic_1164.all;
|
47 |
|
|
|
48 |
|
|
use work.t48_pack.word_t;
|
49 |
|
|
|
50 |
|
|
entity p1 is
|
51 |
|
|
|
52 |
|
|
port (
|
53 |
|
|
-- Global Interface -------------------------------------------------------
|
54 |
|
|
clk_i : in std_logic;
|
55 |
|
|
res_i : in std_logic;
|
56 |
|
|
en_clk_i : in boolean;
|
57 |
|
|
-- T48 Bus Interface ------------------------------------------------------
|
58 |
|
|
data_i : in word_t;
|
59 |
|
|
data_o : out word_t;
|
60 |
|
|
write_p1_i : in boolean;
|
61 |
|
|
read_p1_i : in boolean;
|
62 |
|
|
read_reg_i : in boolean;
|
63 |
|
|
-- Port 1 Interface -------------------------------------------------------
|
64 |
|
|
p1_i : in word_t;
|
65 |
|
|
p1_o : out word_t;
|
66 |
|
|
p1_limp_o : out std_logic
|
67 |
|
|
);
|
68 |
|
|
|
69 |
|
|
end p1;
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
use work.t48_pack.clk_active_c;
|
73 |
|
|
use work.t48_pack.res_active_c;
|
74 |
|
|
use work.t48_pack.bus_idle_level_c;
|
75 |
|
|
|
76 |
|
|
architecture rtl of p1 is
|
77 |
|
|
|
78 |
|
|
-- the port output register
|
79 |
|
|
signal p1_q : word_t;
|
80 |
|
|
|
81 |
|
|
-- the low impedance marker
|
82 |
|
|
signal limp_q : std_logic;
|
83 |
|
|
|
84 |
|
|
begin
|
85 |
|
|
|
86 |
|
|
-----------------------------------------------------------------------------
|
87 |
|
|
-- Process p1_reg
|
88 |
|
|
--
|
89 |
|
|
-- Purpose:
|
90 |
|
|
-- Implements the port output register.
|
91 |
|
|
--
|
92 |
|
|
p1_reg: process (res_i, clk_i)
|
93 |
|
|
begin
|
94 |
|
|
if res_i = res_active_c then
|
95 |
|
|
p1_q <= (others => '1');
|
96 |
|
|
limp_q <= '0';
|
97 |
|
|
|
98 |
|
|
elsif clk_i'event and clk_i = clk_active_c then
|
99 |
|
|
if en_clk_i then
|
100 |
|
|
|
101 |
|
|
if write_p1_i then
|
102 |
|
|
p1_q <= data_i;
|
103 |
|
|
limp_q <= '1';
|
104 |
|
|
else
|
105 |
|
|
limp_q <= '0';
|
106 |
|
|
end if;
|
107 |
|
|
|
108 |
|
|
end if;
|
109 |
|
|
|
110 |
|
|
end if;
|
111 |
|
|
|
112 |
|
|
end process p1_reg;
|
113 |
|
|
--
|
114 |
|
|
-----------------------------------------------------------------------------
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
-----------------------------------------------------------------------------
|
118 |
|
|
-- Output Mapping.
|
119 |
|
|
-----------------------------------------------------------------------------
|
120 |
|
|
p1_o <= p1_q;
|
121 |
|
|
p1_limp_o <= limp_q;
|
122 |
|
|
data_o <= (others => bus_idle_level_c)
|
123 |
|
|
when not read_p1_i else
|
124 |
|
|
p1_q
|
125 |
|
|
when read_reg_i else
|
126 |
|
|
p1_i;
|
127 |
|
|
|
128 |
|
|
end rtl;
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
-------------------------------------------------------------------------------
|
132 |
|
|
-- File History:
|
133 |
|
|
--
|
134 |
|
|
-- $Log: not supported by cvs2svn $
|
135 |
|
|
--
|
136 |
|
|
-------------------------------------------------------------------------------
|