1 |
148 |
arniml |
-------------------------------------------------------------------------------
|
2 |
|
|
--
|
3 |
|
|
-- T8048 Microcontroller System
|
4 |
|
|
-- 8048 toplevel without tri-states
|
5 |
|
|
--
|
6 |
|
|
-- $Id: t8048_notri.vhd,v 1.1 2004-12-01 23:07:21 arniml Exp $
|
7 |
|
|
--
|
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 t8048_notri is
|
51 |
|
|
|
52 |
|
|
port (
|
53 |
|
|
xtal_i : in std_logic;
|
54 |
|
|
reset_n_i : in std_logic;
|
55 |
|
|
t0_i : in std_logic;
|
56 |
|
|
t0_o : out std_logic;
|
57 |
|
|
t0_dir_o : out std_logic;
|
58 |
|
|
int_n_i : in std_logic;
|
59 |
|
|
ea_i : in std_logic;
|
60 |
|
|
rd_n_o : out std_logic;
|
61 |
|
|
psen_n_o : out std_logic;
|
62 |
|
|
wr_n_o : out std_logic;
|
63 |
|
|
ale_o : out std_logic;
|
64 |
|
|
db_i : in std_logic_vector( 7 downto 0);
|
65 |
|
|
db_o : out std_logic_vector( 7 downto 0);
|
66 |
|
|
db_dir_o : out std_logic;
|
67 |
|
|
t1_i : in std_logic;
|
68 |
|
|
p2_i : in std_logic_vector( 7 downto 0);
|
69 |
|
|
p2_o : out std_logic_vector( 7 downto 0);
|
70 |
|
|
p2_low_imp_o : out std_logic;
|
71 |
|
|
p1_i : in std_logic_vector( 7 downto 0);
|
72 |
|
|
p1_o : out std_logic_vector( 7 downto 0);
|
73 |
|
|
p1_low_imp_o : out std_logic;
|
74 |
|
|
prog_n_o : out std_logic
|
75 |
|
|
);
|
76 |
|
|
|
77 |
|
|
end t8048_notri;
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
library ieee;
|
81 |
|
|
use ieee.numeric_std.all;
|
82 |
|
|
|
83 |
|
|
use work.t48_core_comp_pack.t48_core;
|
84 |
|
|
use work.t48_core_comp_pack.syn_rom;
|
85 |
|
|
use work.t48_core_comp_pack.syn_ram;
|
86 |
|
|
|
87 |
|
|
architecture struct of t8048_notri is
|
88 |
|
|
|
89 |
|
|
-- Address width of internal ROM
|
90 |
|
|
constant rom_addr_width_c : natural := 10;
|
91 |
|
|
|
92 |
|
|
signal xtal3_s : std_logic;
|
93 |
|
|
signal dmem_addr_s : std_logic_vector( 7 downto 0);
|
94 |
|
|
signal dmem_we_s : std_logic;
|
95 |
|
|
signal dmem_data_from_s : std_logic_vector( 7 downto 0);
|
96 |
|
|
signal dmem_data_to_s : std_logic_vector( 7 downto 0);
|
97 |
|
|
signal pmem_addr_s : std_logic_vector(11 downto 0);
|
98 |
|
|
signal pmem_data_s : std_logic_vector( 7 downto 0);
|
99 |
|
|
|
100 |
|
|
signal ea_s : std_logic;
|
101 |
|
|
|
102 |
|
|
begin
|
103 |
|
|
|
104 |
|
|
t48_core_b : t48_core
|
105 |
|
|
generic map (
|
106 |
|
|
xtal_div_3_g => 1,
|
107 |
|
|
register_mnemonic_g => 1,
|
108 |
|
|
include_port1_g => 1,
|
109 |
|
|
include_port2_g => 1,
|
110 |
|
|
include_bus_g => 1,
|
111 |
|
|
include_timer_g => 1,
|
112 |
|
|
sample_t1_state_g => 4
|
113 |
|
|
)
|
114 |
|
|
port map (
|
115 |
|
|
xtal_i => xtal_i,
|
116 |
|
|
reset_i => reset_n_i,
|
117 |
|
|
t0_i => t0_i,
|
118 |
|
|
t0_o => t0_o,
|
119 |
|
|
t0_dir_o => t0_dir_o,
|
120 |
|
|
int_n_i => int_n_i,
|
121 |
|
|
ea_i => ea_s,
|
122 |
|
|
rd_n_o => rd_n_o,
|
123 |
|
|
psen_n_o => psen_n_o,
|
124 |
|
|
wr_n_o => wr_n_o,
|
125 |
|
|
ale_o => ale_o,
|
126 |
|
|
db_i => db_i,
|
127 |
|
|
db_o => db_o,
|
128 |
|
|
db_dir_o => db_dir_o,
|
129 |
|
|
t1_i => t1_i,
|
130 |
|
|
p2_i => p2_i,
|
131 |
|
|
p2_o => p2_o,
|
132 |
|
|
p2_low_imp_o => p2_low_imp_o,
|
133 |
|
|
p1_i => p1_i,
|
134 |
|
|
p1_o => p1_o,
|
135 |
|
|
p1_low_imp_o => p1_low_imp_o,
|
136 |
|
|
prog_n_o => prog_n_o,
|
137 |
|
|
clk_i => xtal_i,
|
138 |
|
|
en_clk_i => xtal3_s,
|
139 |
|
|
xtal3_o => xtal3_s,
|
140 |
|
|
dmem_addr_o => dmem_addr_s,
|
141 |
|
|
dmem_we_o => dmem_we_s,
|
142 |
|
|
dmem_data_i => dmem_data_from_s,
|
143 |
|
|
dmem_data_o => dmem_data_to_s,
|
144 |
|
|
pmem_addr_o => pmem_addr_s,
|
145 |
|
|
pmem_data_i => pmem_data_s
|
146 |
|
|
);
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
-----------------------------------------------------------------------------
|
150 |
|
|
-- Process ea
|
151 |
|
|
--
|
152 |
|
|
-- Purpose:
|
153 |
|
|
-- Detects access to external program memory.
|
154 |
|
|
-- Either by ea_i = '1' or when program memory address leaves address
|
155 |
|
|
-- range of internal ROM.
|
156 |
|
|
--
|
157 |
|
|
ea: process (ea_i,
|
158 |
|
|
pmem_addr_s)
|
159 |
|
|
begin
|
160 |
|
|
if ea_i = '1' then
|
161 |
|
|
-- Forced external access
|
162 |
|
|
ea_s <= '1';
|
163 |
|
|
|
164 |
|
|
elsif unsigned(pmem_addr_s(11 downto rom_addr_width_c)) = 0 then
|
165 |
|
|
-- Internal access
|
166 |
|
|
ea_s <= '0';
|
167 |
|
|
|
168 |
|
|
else
|
169 |
|
|
-- Access to program memory out of internal range
|
170 |
|
|
ea_s <= '1';
|
171 |
|
|
|
172 |
|
|
end if;
|
173 |
|
|
|
174 |
|
|
end process ea;
|
175 |
|
|
--
|
176 |
|
|
-----------------------------------------------------------------------------
|
177 |
|
|
|
178 |
|
|
|
179 |
|
|
rom_1k_b : syn_rom
|
180 |
|
|
generic map (
|
181 |
|
|
address_width_g => rom_addr_width_c
|
182 |
|
|
)
|
183 |
|
|
port map (
|
184 |
|
|
clk_i => xtal_i,
|
185 |
|
|
rom_addr_i => pmem_addr_s(rom_addr_width_c-1 downto 0),
|
186 |
|
|
rom_data_o => pmem_data_s
|
187 |
|
|
);
|
188 |
|
|
|
189 |
|
|
ram_64_b : syn_ram
|
190 |
|
|
generic map (
|
191 |
|
|
address_width_g => 6
|
192 |
|
|
)
|
193 |
|
|
port map (
|
194 |
|
|
clk_i => xtal_i,
|
195 |
|
|
res_i => reset_n_i,
|
196 |
|
|
ram_addr_i => dmem_addr_s(5 downto 0),
|
197 |
|
|
ram_data_i => dmem_data_to_s,
|
198 |
|
|
ram_we_i => dmem_we_s,
|
199 |
|
|
ram_data_o => dmem_data_from_s
|
200 |
|
|
);
|
201 |
|
|
|
202 |
|
|
end struct;
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
-------------------------------------------------------------------------------
|
206 |
|
|
-- File History:
|
207 |
|
|
-------------------------------------------------------------------------------
|