1 |
155 |
arniml |
-------------------------------------------------------------------------------
|
2 |
|
|
--
|
3 |
|
|
-- T8039 Microcontroller System
|
4 |
|
|
-- 8039 toplevel without tri-states
|
5 |
|
|
--
|
6 |
211 |
arniml |
-- $Id: t8039_notri.vhd,v 1.2 2005-11-01 21:38:10 arniml Exp $
|
7 |
155 |
arniml |
--
|
8 |
|
|
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
|
9 |
|
|
--
|
10 |
|
|
-- All rights reserved
|
11 |
|
|
--
|
12 |
|
|
-- Redistribution and use in source and synthezised forms, with or without
|
13 |
|
|
-- modification, are permitted provided that the following conditions are met:
|
14 |
|
|
--
|
15 |
|
|
-- Redistributions of source code must retain the above copyright notice,
|
16 |
|
|
-- this list of conditions and the following disclaimer.
|
17 |
|
|
--
|
18 |
|
|
-- Redistributions in synthesized form must reproduce the above copyright
|
19 |
|
|
-- notice, this list of conditions and the following disclaimer in the
|
20 |
|
|
-- documentation and/or other materials provided with the distribution.
|
21 |
|
|
--
|
22 |
|
|
-- Neither the name of the author nor the names of other contributors may
|
23 |
|
|
-- be used to endorse or promote products derived from this software without
|
24 |
|
|
-- specific prior written permission.
|
25 |
|
|
--
|
26 |
|
|
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
27 |
|
|
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
28 |
|
|
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
29 |
|
|
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
|
30 |
|
|
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
31 |
|
|
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
32 |
|
|
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
33 |
|
|
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
34 |
|
|
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
35 |
|
|
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
36 |
|
|
-- POSSIBILITY OF SUCH DAMAGE.
|
37 |
|
|
--
|
38 |
|
|
-- Please report bugs to the author, but before you do so, please
|
39 |
|
|
-- make sure that this is not a derivative work and that
|
40 |
|
|
-- you have the latest version of this file.
|
41 |
|
|
--
|
42 |
|
|
-- The latest version of this file can be found at:
|
43 |
|
|
-- http://www.opencores.org/cvsweb.shtml/t48/
|
44 |
|
|
--
|
45 |
|
|
-------------------------------------------------------------------------------
|
46 |
|
|
|
47 |
|
|
library ieee;
|
48 |
|
|
use ieee.std_logic_1164.all;
|
49 |
|
|
|
50 |
|
|
entity t8039_notri is
|
51 |
|
|
|
52 |
|
|
generic (
|
53 |
|
|
gate_port_input_g : integer := 1
|
54 |
|
|
);
|
55 |
|
|
|
56 |
|
|
port (
|
57 |
211 |
arniml |
xtal_i : in std_logic;
|
58 |
|
|
reset_n_i : in std_logic;
|
59 |
|
|
t0_i : in std_logic;
|
60 |
|
|
t0_o : out std_logic;
|
61 |
|
|
t0_dir_o : out std_logic;
|
62 |
|
|
int_n_i : in std_logic;
|
63 |
|
|
ea_i : in std_logic;
|
64 |
|
|
rd_n_o : out std_logic;
|
65 |
|
|
psen_n_o : out std_logic;
|
66 |
|
|
wr_n_o : out std_logic;
|
67 |
|
|
ale_o : out std_logic;
|
68 |
|
|
db_i : in std_logic_vector( 7 downto 0);
|
69 |
|
|
db_o : out std_logic_vector( 7 downto 0);
|
70 |
|
|
db_dir_o : out std_logic;
|
71 |
|
|
t1_i : in std_logic;
|
72 |
|
|
p2_i : in std_logic_vector( 7 downto 0);
|
73 |
|
|
p2_o : out std_logic_vector( 7 downto 0);
|
74 |
|
|
p2l_low_imp_o : out std_logic;
|
75 |
|
|
p2h_low_imp_o : out std_logic;
|
76 |
|
|
p1_i : in std_logic_vector( 7 downto 0);
|
77 |
|
|
p1_o : out std_logic_vector( 7 downto 0);
|
78 |
|
|
p1_low_imp_o : out std_logic;
|
79 |
|
|
prog_n_o : out std_logic
|
80 |
155 |
arniml |
);
|
81 |
|
|
|
82 |
|
|
end t8039_notri;
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
library ieee;
|
86 |
|
|
use ieee.numeric_std.all;
|
87 |
|
|
|
88 |
|
|
use work.t48_core_comp_pack.t48_core;
|
89 |
|
|
use work.t48_core_comp_pack.syn_rom;
|
90 |
|
|
use work.t48_core_comp_pack.syn_ram;
|
91 |
|
|
|
92 |
|
|
architecture struct of t8039_notri is
|
93 |
|
|
|
94 |
|
|
signal xtal3_s : std_logic;
|
95 |
|
|
signal dmem_addr_s : std_logic_vector( 7 downto 0);
|
96 |
|
|
signal dmem_we_s : std_logic;
|
97 |
|
|
signal dmem_data_from_s : std_logic_vector( 7 downto 0);
|
98 |
|
|
signal dmem_data_to_s : std_logic_vector( 7 downto 0);
|
99 |
|
|
signal pmem_data_s : std_logic_vector( 7 downto 0);
|
100 |
|
|
|
101 |
|
|
signal p1_in_s,
|
102 |
|
|
p1_out_s : std_logic_vector( 7 downto 0);
|
103 |
|
|
signal p2_in_s,
|
104 |
|
|
p2_out_s : std_logic_vector( 7 downto 0);
|
105 |
|
|
|
106 |
|
|
begin
|
107 |
|
|
|
108 |
|
|
-----------------------------------------------------------------------------
|
109 |
|
|
-- Check generics for valid values.
|
110 |
|
|
-----------------------------------------------------------------------------
|
111 |
|
|
-- pragma translate_off
|
112 |
|
|
assert gate_port_input_g = 0 or gate_port_input_g = 1
|
113 |
|
|
report "gate_port_input_g must be either 1 or 0!"
|
114 |
|
|
severity failure;
|
115 |
|
|
-- pragma translate_on
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
-- no Program memory available
|
119 |
|
|
pmem_data_s <= (others => '0');
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
t48_core_b : t48_core
|
123 |
|
|
generic map (
|
124 |
|
|
xtal_div_3_g => 1,
|
125 |
|
|
register_mnemonic_g => 1,
|
126 |
|
|
include_port1_g => 1,
|
127 |
|
|
include_port2_g => 1,
|
128 |
|
|
include_bus_g => 1,
|
129 |
|
|
include_timer_g => 1,
|
130 |
|
|
sample_t1_state_g => 4
|
131 |
|
|
)
|
132 |
|
|
port map (
|
133 |
211 |
arniml |
xtal_i => xtal_i,
|
134 |
|
|
reset_i => reset_n_i,
|
135 |
|
|
t0_i => t0_i,
|
136 |
|
|
t0_o => t0_o,
|
137 |
|
|
t0_dir_o => t0_dir_o,
|
138 |
|
|
int_n_i => int_n_i,
|
139 |
|
|
ea_i => ea_i,
|
140 |
|
|
rd_n_o => rd_n_o,
|
141 |
|
|
psen_n_o => psen_n_o,
|
142 |
|
|
wr_n_o => wr_n_o,
|
143 |
|
|
ale_o => ale_o,
|
144 |
|
|
db_i => db_i,
|
145 |
|
|
db_o => db_o,
|
146 |
|
|
db_dir_o => db_dir_o,
|
147 |
|
|
t1_i => t1_i,
|
148 |
|
|
p2_i => p2_in_s,
|
149 |
|
|
p2_o => p2_out_s,
|
150 |
|
|
p2l_low_imp_o => p2l_low_imp_o,
|
151 |
|
|
p2h_low_imp_o => p2h_low_imp_o,
|
152 |
|
|
p1_i => p1_in_s,
|
153 |
|
|
p1_o => p1_out_s,
|
154 |
|
|
p1_low_imp_o => p1_low_imp_o,
|
155 |
|
|
prog_n_o => prog_n_o,
|
156 |
|
|
clk_i => xtal_i,
|
157 |
|
|
en_clk_i => xtal3_s,
|
158 |
|
|
xtal3_o => xtal3_s,
|
159 |
|
|
dmem_addr_o => dmem_addr_s,
|
160 |
|
|
dmem_we_o => dmem_we_s,
|
161 |
|
|
dmem_data_i => dmem_data_from_s,
|
162 |
|
|
dmem_data_o => dmem_data_to_s,
|
163 |
|
|
pmem_addr_o => open,
|
164 |
|
|
pmem_data_i => pmem_data_s
|
165 |
155 |
arniml |
);
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
-----------------------------------------------------------------------------
|
169 |
|
|
-- Gate port 1 and 2 input bus with respetive output value
|
170 |
|
|
-----------------------------------------------------------------------------
|
171 |
|
|
gate_ports: if gate_port_input_g = 1 generate
|
172 |
|
|
p1_in_s <= p1_i and p1_out_s;
|
173 |
|
|
p2_in_s <= p2_i and p2_out_s;
|
174 |
|
|
end generate;
|
175 |
|
|
|
176 |
|
|
pass_ports: if gate_port_input_g = 0 generate
|
177 |
|
|
p1_in_s <= p1_i;
|
178 |
|
|
p2_in_s <= p2_i;
|
179 |
|
|
end generate;
|
180 |
|
|
|
181 |
|
|
p1_o <= p1_out_s;
|
182 |
|
|
p2_o <= p2_out_s;
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
ram_128_b : syn_ram
|
186 |
|
|
generic map (
|
187 |
|
|
address_width_g => 7
|
188 |
|
|
)
|
189 |
|
|
port map (
|
190 |
|
|
clk_i => xtal_i,
|
191 |
|
|
res_i => reset_n_i,
|
192 |
|
|
ram_addr_i => dmem_addr_s(6 downto 0),
|
193 |
|
|
ram_data_i => dmem_data_to_s,
|
194 |
|
|
ram_we_i => dmem_we_s,
|
195 |
|
|
ram_data_o => dmem_data_from_s
|
196 |
|
|
);
|
197 |
|
|
|
198 |
|
|
end struct;
|
199 |
|
|
|
200 |
|
|
|
201 |
|
|
-------------------------------------------------------------------------------
|
202 |
|
|
-- File History:
|
203 |
|
|
--
|
204 |
|
|
-- $Log: not supported by cvs2svn $
|
205 |
211 |
arniml |
-- Revision 1.1 2004/12/03 19:42:34 arniml
|
206 |
|
|
-- initial check-in
|
207 |
|
|
--
|
208 |
155 |
arniml |
-------------------------------------------------------------------------------
|