URL
https://opencores.org/ocsvn/t48/t48/trunk
Subversion Repositories t48
Compare Revisions
- This comparison shows the changes necessary to convert path
/t48/tags/rel_1_0/rtl/vhdl/system
- from Rev 277 to Rev 292
- ↔ Reverse comparison
Rev 277 → Rev 292
/t48_rom-struct-a.vhd
0,0 → 1,78
------------------------------------------------------------------------------- |
-- |
-- T8x48 ROM |
-- |
-- $Id: t48_rom-struct-a.vhd,v 1.3 2006-11-26 12:53:28 arniml Exp $ |
-- |
-- Copyright (c) 2006 Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
-- Redistribution and use in source and synthezised forms, with or without |
-- modification, are permitted provided that the following conditions are met: |
-- |
-- Redistributions of source code must retain the above copyright notice, |
-- this list of conditions and the following disclaimer. |
-- |
-- Redistributions in synthesized form must reproduce the above copyright |
-- notice, this list of conditions and the following disclaimer in the |
-- documentation and/or other materials provided with the distribution. |
-- |
-- Neither the name of the author nor the names of other contributors may |
-- be used to endorse or promote products derived from this software without |
-- specific prior written permission. |
-- |
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE |
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-- POSSIBILITY OF SUCH DAMAGE. |
-- |
-- Please report bugs to the author, but before you do so, please |
-- make sure that this is not a derivative work and that |
-- you have the latest version of this file. |
-- |
-- The latest version of this file can be found at: |
-- http://www.opencores.org/cvsweb.shtml/t48/ |
-- |
------------------------------------------------------------------------------- |
|
architecture struct of t48_rom is |
|
component rom_t48 |
port( |
Clk : in std_logic; |
A : in std_logic_vector(9 downto 0); |
D : out std_logic_vector(7 downto 0) |
); |
end component; |
|
begin |
|
rom_b : rom_t48 |
port map ( |
Clk => clk_i, |
A => rom_addr_i, |
D => rom_data_o |
); |
|
end struct; |
|
|
------------------------------------------------------------------------------- |
-- File History: |
-- |
-- $Log: not supported by cvs2svn $ |
-- Revision 1.2 2006/11/26 11:58:28 arniml |
-- fix component name |
-- |
-- Revision 1.1 2006/06/21 00:59:15 arniml |
-- initial check-in |
-- |
------------------------------------------------------------------------------- |
/t49_rom-struct-a.vhd
0,0 → 1,78
------------------------------------------------------------------------------- |
-- |
-- T8x49 ROM |
-- |
-- $Id: t49_rom-struct-a.vhd,v 1.3 2006-11-26 12:53:28 arniml Exp $ |
-- |
-- Copyright (c) 2006 Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
-- Redistribution and use in source and synthezised forms, with or without |
-- modification, are permitted provided that the following conditions are met: |
-- |
-- Redistributions of source code must retain the above copyright notice, |
-- this list of conditions and the following disclaimer. |
-- |
-- Redistributions in synthesized form must reproduce the above copyright |
-- notice, this list of conditions and the following disclaimer in the |
-- documentation and/or other materials provided with the distribution. |
-- |
-- Neither the name of the author nor the names of other contributors may |
-- be used to endorse or promote products derived from this software without |
-- specific prior written permission. |
-- |
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE |
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-- POSSIBILITY OF SUCH DAMAGE. |
-- |
-- Please report bugs to the author, but before you do so, please |
-- make sure that this is not a derivative work and that |
-- you have the latest version of this file. |
-- |
-- The latest version of this file can be found at: |
-- http://www.opencores.org/cvsweb.shtml/t48/ |
-- |
------------------------------------------------------------------------------- |
|
architecture struct of t49_rom is |
|
component rom_t49 |
port( |
Clk : in std_logic; |
A : in std_logic_vector(10 downto 0); |
D : out std_logic_vector( 7 downto 0) |
); |
end component; |
|
begin |
|
rom_b : rom_t49 |
port map ( |
Clk => clk_i, |
A => rom_addr_i, |
D => rom_data_o |
); |
|
end struct; |
|
|
------------------------------------------------------------------------------- |
-- File History: |
-- |
-- $Log: not supported by cvs2svn $ |
-- Revision 1.2 2006/11/26 11:58:28 arniml |
-- fix component name |
-- |
-- Revision 1.1 2006/06/21 00:59:15 arniml |
-- initial check-in |
-- |
------------------------------------------------------------------------------- |
/t49_rom-struct-c.vhd
0,0 → 1,23
------------------------------------------------------------------------------- |
-- |
-- T8x49 ROM |
-- |
-- $Id: t49_rom-struct-c.vhd,v 1.1 2006-11-26 12:52:34 arniml Exp $ |
-- |
-- Copyright (c) 2006, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
------------------------------------------------------------------------------- |
|
configuration t49_rom_struct_c0 of t49_rom is |
|
for struct |
|
for rom_b: rom_t49 |
use configuration work.rom_t49_rtl_c0; |
end for; |
|
end for; |
|
end t49_rom_struct_c0; |
/t48_rom-struct-c.vhd
0,0 → 1,23
------------------------------------------------------------------------------- |
-- |
-- T8x48 ROM |
-- |
-- $Id: t48_rom-struct-c.vhd,v 1.1 2006-11-26 12:52:34 arniml Exp $ |
-- |
-- Copyright (c) 2006, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
------------------------------------------------------------------------------- |
|
configuration t48_rom_struct_c0 of t48_rom is |
|
for struct |
|
for rom_b: rom_t48 |
use configuration work.rom_t48_rtl_c0; |
end for; |
|
end for; |
|
end t48_rom_struct_c0; |
/t8048_notri.vhd
0,0 → 1,268
------------------------------------------------------------------------------- |
-- |
-- T8048 Microcontroller System |
-- 8048 toplevel without tri-states |
-- |
-- $Id: t8048_notri.vhd,v 1.7 2006-07-14 01:13:32 arniml Exp $ |
-- $Name: not supported by cvs2svn $ |
-- |
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
-- Redistribution and use in source and synthezised forms, with or without |
-- modification, are permitted provided that the following conditions are met: |
-- |
-- Redistributions of source code must retain the above copyright notice, |
-- this list of conditions and the following disclaimer. |
-- |
-- Redistributions in synthesized form must reproduce the above copyright |
-- notice, this list of conditions and the following disclaimer in the |
-- documentation and/or other materials provided with the distribution. |
-- |
-- Neither the name of the author nor the names of other contributors may |
-- be used to endorse or promote products derived from this software without |
-- specific prior written permission. |
-- |
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE |
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-- POSSIBILITY OF SUCH DAMAGE. |
-- |
-- Please report bugs to the author, but before you do so, please |
-- make sure that this is not a derivative work and that |
-- you have the latest version of this file. |
-- |
-- The latest version of this file can be found at: |
-- http://www.opencores.org/cvsweb.shtml/t48/ |
-- |
------------------------------------------------------------------------------- |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
entity t8048_notri is |
|
generic ( |
gate_port_input_g : integer := 1 |
); |
|
port ( |
xtal_i : in std_logic; |
xtal_en_i : in std_logic; |
reset_n_i : in std_logic; |
t0_i : in std_logic; |
t0_o : out std_logic; |
t0_dir_o : out std_logic; |
int_n_i : in std_logic; |
ea_i : in std_logic; |
rd_n_o : out std_logic; |
psen_n_o : out std_logic; |
wr_n_o : out std_logic; |
ale_o : out std_logic; |
db_i : in std_logic_vector( 7 downto 0); |
db_o : out std_logic_vector( 7 downto 0); |
db_dir_o : out std_logic; |
t1_i : in std_logic; |
p2_i : in std_logic_vector( 7 downto 0); |
p2_o : out std_logic_vector( 7 downto 0); |
p2l_low_imp_o : out std_logic; |
p2h_low_imp_o : out std_logic; |
p1_i : in std_logic_vector( 7 downto 0); |
p1_o : out std_logic_vector( 7 downto 0); |
p1_low_imp_o : out std_logic; |
prog_n_o : out std_logic |
); |
|
end t8048_notri; |
|
|
library ieee; |
use ieee.numeric_std.all; |
|
use work.t48_core_comp_pack.t48_core; |
use work.t48_core_comp_pack.t48_rom; |
use work.t48_core_comp_pack.generic_ram_ena; |
|
architecture struct of t8048_notri is |
|
-- Address width of internal ROM |
constant rom_addr_width_c : natural := 10; |
|
signal xtal3_s : std_logic; |
signal dmem_addr_s : std_logic_vector( 7 downto 0); |
signal dmem_we_s : std_logic; |
signal dmem_data_from_s : std_logic_vector( 7 downto 0); |
signal dmem_data_to_s : std_logic_vector( 7 downto 0); |
signal pmem_addr_s : std_logic_vector(11 downto 0); |
signal pmem_data_s : std_logic_vector( 7 downto 0); |
|
signal ea_s : std_logic; |
|
signal p1_in_s, |
p1_out_s : std_logic_vector( 7 downto 0); |
signal p2_in_s, |
p2_out_s : std_logic_vector( 7 downto 0); |
|
signal vdd_s : std_logic; |
|
begin |
|
vdd_s <= '1'; |
|
----------------------------------------------------------------------------- |
-- Check generics for valid values. |
----------------------------------------------------------------------------- |
-- pragma translate_off |
assert gate_port_input_g = 0 or gate_port_input_g = 1 |
report "gate_port_input_g must be either 1 or 0!" |
severity failure; |
-- pragma translate_on |
|
|
t48_core_b : t48_core |
generic map ( |
xtal_div_3_g => 1, |
register_mnemonic_g => 1, |
include_port1_g => 1, |
include_port2_g => 1, |
include_bus_g => 1, |
include_timer_g => 1, |
sample_t1_state_g => 4 |
) |
port map ( |
xtal_i => xtal_i, |
xtal_en_i => xtal_en_i, |
reset_i => reset_n_i, |
t0_i => t0_i, |
t0_o => t0_o, |
t0_dir_o => t0_dir_o, |
int_n_i => int_n_i, |
ea_i => ea_s, |
rd_n_o => rd_n_o, |
psen_n_o => psen_n_o, |
wr_n_o => wr_n_o, |
ale_o => ale_o, |
db_i => db_i, |
db_o => db_o, |
db_dir_o => db_dir_o, |
t1_i => t1_i, |
p2_i => p2_in_s, |
p2_o => p2_out_s, |
p2l_low_imp_o => p2l_low_imp_o, |
p2h_low_imp_o => p2h_low_imp_o, |
p1_i => p1_in_s, |
p1_o => p1_out_s, |
p1_low_imp_o => p1_low_imp_o, |
prog_n_o => prog_n_o, |
clk_i => xtal_i, |
en_clk_i => xtal3_s, |
xtal3_o => xtal3_s, |
dmem_addr_o => dmem_addr_s, |
dmem_we_o => dmem_we_s, |
dmem_data_i => dmem_data_from_s, |
dmem_data_o => dmem_data_to_s, |
pmem_addr_o => pmem_addr_s, |
pmem_data_i => pmem_data_s |
); |
|
|
----------------------------------------------------------------------------- |
-- Gate port 1 and 2 input bus with respetive output value |
----------------------------------------------------------------------------- |
gate_ports: if gate_port_input_g = 1 generate |
p1_in_s <= p1_i and p1_out_s; |
p2_in_s <= p2_i and p2_out_s; |
end generate; |
|
pass_ports: if gate_port_input_g = 0 generate |
p1_in_s <= p1_i; |
p2_in_s <= p2_i; |
end generate; |
|
p1_o <= p1_out_s; |
p2_o <= p2_out_s; |
|
|
----------------------------------------------------------------------------- |
-- Process ea |
-- |
-- Purpose: |
-- Detects access to external program memory. |
-- Either by ea_i = '1' or when program memory address leaves address |
-- range of internal ROM. |
-- |
ea: process (ea_i, |
pmem_addr_s) |
begin |
if ea_i = '1' then |
-- Forced external access |
ea_s <= '1'; |
|
elsif unsigned(pmem_addr_s(11 downto rom_addr_width_c)) = 0 then |
-- Internal access |
ea_s <= '0'; |
|
else |
-- Access to program memory out of internal range |
ea_s <= '1'; |
|
end if; |
|
end process ea; |
-- |
----------------------------------------------------------------------------- |
|
|
rom_1k_b : t48_rom |
port map ( |
clk_i => xtal_i, |
rom_addr_i => pmem_addr_s(rom_addr_width_c-1 downto 0), |
rom_data_o => pmem_data_s |
); |
|
ram_64_b : generic_ram_ena |
generic map ( |
addr_width_g => 6, |
data_width_g => 8 |
) |
port map ( |
clk_i => xtal_i, |
a_i => dmem_addr_s(5 downto 0), |
we_i => dmem_we_s, |
ena_i => vdd_s, |
d_i => dmem_data_to_s, |
d_o => dmem_data_from_s |
); |
|
end struct; |
|
|
------------------------------------------------------------------------------- |
-- File History: |
-- |
-- $Log: not supported by cvs2svn $ |
-- Revision 1.6 2006/06/21 01:02:16 arniml |
-- replaced syn_rom and syn_ram with t48_rom and generic_ram_ena |
-- |
-- Revision 1.5 2006/06/20 00:47:08 arniml |
-- new input xtal_en_i |
-- |
-- Revision 1.4 2005/11/01 21:38:48 arniml |
-- wire signals for P2 low impedance marker issue |
-- |
-- Revision 1.3 2004/12/02 22:08:42 arniml |
-- introduced generic gate_port_input_g |
-- forces masking of P1 and P2 input bus |
-- |
-- Revision 1.2 2004/12/01 23:08:08 arniml |
-- update |
-- |
------------------------------------------------------------------------------- |
/t8039_notri.vhd
0,0 → 1,224
------------------------------------------------------------------------------- |
-- |
-- T8039 Microcontroller System |
-- 8039 toplevel without tri-states |
-- |
-- $Id: t8039_notri.vhd,v 1.5 2006-07-14 01:13:32 arniml Exp $ |
-- $Name: not supported by cvs2svn $ |
-- |
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
-- Redistribution and use in source and synthezised forms, with or without |
-- modification, are permitted provided that the following conditions are met: |
-- |
-- Redistributions of source code must retain the above copyright notice, |
-- this list of conditions and the following disclaimer. |
-- |
-- Redistributions in synthesized form must reproduce the above copyright |
-- notice, this list of conditions and the following disclaimer in the |
-- documentation and/or other materials provided with the distribution. |
-- |
-- Neither the name of the author nor the names of other contributors may |
-- be used to endorse or promote products derived from this software without |
-- specific prior written permission. |
-- |
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE |
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-- POSSIBILITY OF SUCH DAMAGE. |
-- |
-- Please report bugs to the author, but before you do so, please |
-- make sure that this is not a derivative work and that |
-- you have the latest version of this file. |
-- |
-- The latest version of this file can be found at: |
-- http://www.opencores.org/cvsweb.shtml/t48/ |
-- |
------------------------------------------------------------------------------- |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
entity t8039_notri is |
|
generic ( |
gate_port_input_g : integer := 1 |
); |
|
port ( |
xtal_i : in std_logic; |
xtal_en_i : in std_logic; |
reset_n_i : in std_logic; |
t0_i : in std_logic; |
t0_o : out std_logic; |
t0_dir_o : out std_logic; |
int_n_i : in std_logic; |
ea_i : in std_logic; |
rd_n_o : out std_logic; |
psen_n_o : out std_logic; |
wr_n_o : out std_logic; |
ale_o : out std_logic; |
db_i : in std_logic_vector( 7 downto 0); |
db_o : out std_logic_vector( 7 downto 0); |
db_dir_o : out std_logic; |
t1_i : in std_logic; |
p2_i : in std_logic_vector( 7 downto 0); |
p2_o : out std_logic_vector( 7 downto 0); |
p2l_low_imp_o : out std_logic; |
p2h_low_imp_o : out std_logic; |
p1_i : in std_logic_vector( 7 downto 0); |
p1_o : out std_logic_vector( 7 downto 0); |
p1_low_imp_o : out std_logic; |
prog_n_o : out std_logic |
); |
|
end t8039_notri; |
|
|
library ieee; |
use ieee.numeric_std.all; |
|
use work.t48_core_comp_pack.t48_core; |
use work.t48_core_comp_pack.generic_ram_ena; |
|
architecture struct of t8039_notri is |
|
signal xtal3_s : std_logic; |
signal dmem_addr_s : std_logic_vector( 7 downto 0); |
signal dmem_we_s : std_logic; |
signal dmem_data_from_s : std_logic_vector( 7 downto 0); |
signal dmem_data_to_s : std_logic_vector( 7 downto 0); |
signal pmem_data_s : std_logic_vector( 7 downto 0); |
|
signal p1_in_s, |
p1_out_s : std_logic_vector( 7 downto 0); |
signal p2_in_s, |
p2_out_s : std_logic_vector( 7 downto 0); |
|
signal vdd_s : std_logic; |
|
begin |
|
vdd_s <= '1'; |
|
----------------------------------------------------------------------------- |
-- Check generics for valid values. |
----------------------------------------------------------------------------- |
-- pragma translate_off |
assert gate_port_input_g = 0 or gate_port_input_g = 1 |
report "gate_port_input_g must be either 1 or 0!" |
severity failure; |
-- pragma translate_on |
|
|
-- no Program memory available |
pmem_data_s <= (others => '0'); |
|
|
t48_core_b : t48_core |
generic map ( |
xtal_div_3_g => 1, |
register_mnemonic_g => 1, |
include_port1_g => 1, |
include_port2_g => 1, |
include_bus_g => 1, |
include_timer_g => 1, |
sample_t1_state_g => 4 |
) |
port map ( |
xtal_i => xtal_i, |
xtal_en_i => xtal_en_i, |
reset_i => reset_n_i, |
t0_i => t0_i, |
t0_o => t0_o, |
t0_dir_o => t0_dir_o, |
int_n_i => int_n_i, |
ea_i => ea_i, |
rd_n_o => rd_n_o, |
psen_n_o => psen_n_o, |
wr_n_o => wr_n_o, |
ale_o => ale_o, |
db_i => db_i, |
db_o => db_o, |
db_dir_o => db_dir_o, |
t1_i => t1_i, |
p2_i => p2_in_s, |
p2_o => p2_out_s, |
p2l_low_imp_o => p2l_low_imp_o, |
p2h_low_imp_o => p2h_low_imp_o, |
p1_i => p1_in_s, |
p1_o => p1_out_s, |
p1_low_imp_o => p1_low_imp_o, |
prog_n_o => prog_n_o, |
clk_i => xtal_i, |
en_clk_i => xtal3_s, |
xtal3_o => xtal3_s, |
dmem_addr_o => dmem_addr_s, |
dmem_we_o => dmem_we_s, |
dmem_data_i => dmem_data_from_s, |
dmem_data_o => dmem_data_to_s, |
pmem_addr_o => open, |
pmem_data_i => pmem_data_s |
); |
|
|
----------------------------------------------------------------------------- |
-- Gate port 1 and 2 input bus with respetive output value |
----------------------------------------------------------------------------- |
gate_ports: if gate_port_input_g = 1 generate |
p1_in_s <= p1_i and p1_out_s; |
p2_in_s <= p2_i and p2_out_s; |
end generate; |
|
pass_ports: if gate_port_input_g = 0 generate |
p1_in_s <= p1_i; |
p2_in_s <= p2_i; |
end generate; |
|
p1_o <= p1_out_s; |
p2_o <= p2_out_s; |
|
|
ram_128_b : generic_ram_ena |
generic map ( |
addr_width_g => 7, |
data_width_g => 8 |
) |
port map ( |
clk_i => xtal_i, |
a_i => dmem_addr_s(6 downto 0), |
we_i => dmem_we_s, |
ena_i => vdd_s, |
d_i => dmem_data_to_s, |
d_o => dmem_data_from_s |
); |
|
end struct; |
|
|
------------------------------------------------------------------------------- |
-- File History: |
-- |
-- $Log: not supported by cvs2svn $ |
-- Revision 1.4 2006/06/21 01:02:35 arniml |
-- replaced syn_ram with generic_ram_ena |
-- |
-- Revision 1.3 2006/06/20 00:47:08 arniml |
-- new input xtal_en_i |
-- |
-- Revision 1.2 2005/11/01 21:38:10 arniml |
-- wire signals for P2 low impedance marker issue |
-- |
-- Revision 1.1 2004/12/03 19:42:34 arniml |
-- initial check-in |
-- |
------------------------------------------------------------------------------- |
/t8050_wb.vhd
0,0 → 1,310
------------------------------------------------------------------------------- |
-- |
-- T8048 Microcontroller System |
-- 8050 toplevel with Wishbone interface |
-- |
-- $Id: t8050_wb.vhd,v 1.5 2006-07-14 01:14:22 arniml Exp $ |
-- $Name: not supported by cvs2svn $ |
-- |
-- Copyright (c) 2005, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
-- Redistribution and use in source and synthezised forms, with or without |
-- modification, are permitted provided that the following conditions are met: |
-- |
-- Redistributions of source code must retain the above copyright notice, |
-- this list of conditions and the following disclaimer. |
-- |
-- Redistributions in synthesized form must reproduce the above copyright |
-- notice, this list of conditions and the following disclaimer in the |
-- documentation and/or other materials provided with the distribution. |
-- |
-- Neither the name of the author nor the names of other contributors may |
-- be used to endorse or promote products derived from this software without |
-- specific prior written permission. |
-- |
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE |
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-- POSSIBILITY OF SUCH DAMAGE. |
-- |
-- Please report bugs to the author, but before you do so, please |
-- make sure that this is not a derivative work and that |
-- you have the latest version of this file. |
-- |
-- The latest version of this file can be found at: |
-- http://www.opencores.org/cvsweb.shtml/t48/ |
-- |
------------------------------------------------------------------------------- |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
entity t8050_wb is |
|
generic ( |
gate_port_input_g : integer := 1 |
); |
|
port ( |
-- T48 Interface ---------------------------------------------------------- |
xtal_i : in std_logic; |
reset_n_i : in std_logic; |
t0_i : in std_logic; |
t0_o : out std_logic; |
t0_dir_o : out std_logic; |
int_n_i : in std_logic; |
ea_i : in std_logic; |
rd_n_o : out std_logic; |
psen_n_o : out std_logic; |
wr_n_o : out std_logic; |
ale_o : out std_logic; |
t1_i : in std_logic; |
p2_i : in std_logic_vector( 7 downto 0); |
p2_o : out std_logic_vector( 7 downto 0); |
p2l_low_imp_o : out std_logic; |
p2h_low_imp_o : out std_logic; |
p1_i : in std_logic_vector( 7 downto 0); |
p1_o : out std_logic_vector( 7 downto 0); |
p1_low_imp_o : out std_logic; |
prog_n_o : out std_logic; |
-- Wishbone Interface ----------------------------------------------------- |
wb_cyc_o : out std_logic; |
wb_stb_o : out std_logic; |
wb_we_o : out std_logic; |
wb_adr_o : out std_logic_vector(23 downto 0); |
wb_ack_i : in std_logic; |
wb_dat_i : in std_logic_vector( 7 downto 0); |
wb_dat_o : out std_logic_vector( 7 downto 0) |
|
); |
|
end t8050_wb; |
|
|
library ieee; |
use ieee.numeric_std.all; |
|
use work.t48_core_comp_pack.t48_core; |
use work.t48_core_comp_pack.syn_rom; |
use work.t48_core_comp_pack.syn_ram; |
use work.t48_system_comp_pack.t48_wb_master; |
|
architecture struct of t8050_wb is |
|
-- Address width of internal ROM |
constant rom_addr_width_c : natural := 12; |
|
signal xtal3_s : std_logic; |
signal dmem_addr_s : std_logic_vector( 7 downto 0); |
signal dmem_we_s : std_logic; |
signal dmem_data_from_s : std_logic_vector( 7 downto 0); |
signal dmem_data_to_s : std_logic_vector( 7 downto 0); |
signal pmem_addr_s : std_logic_vector(11 downto 0); |
signal pmem_data_s : std_logic_vector( 7 downto 0); |
|
signal ea_s : std_logic; |
|
signal ale_s : std_logic; |
signal wr_n_s : std_logic; |
signal rd_n_s : std_logic; |
signal db_bus_to_t48, |
db_bus_from_t48 : std_logic_vector( 7 downto 0); |
|
signal wb_en_clk_s : std_logic; |
signal xtal_en_s : std_logic; |
|
signal p1_in_s, |
p1_out_s : std_logic_vector( 7 downto 0); |
signal p2_in_s, |
p2_out_s : std_logic_vector( 7 downto 0); |
|
begin |
|
----------------------------------------------------------------------------- |
-- Check generics for valid values. |
----------------------------------------------------------------------------- |
-- pragma translate_off |
assert gate_port_input_g = 0 or gate_port_input_g = 1 |
report "gate_port_input_g must be either 1 or 0!" |
severity failure; |
-- pragma translate_on |
|
|
t48_core_b : t48_core |
generic map ( |
xtal_div_3_g => 1, |
register_mnemonic_g => 1, |
include_port1_g => 1, |
include_port2_g => 1, |
include_bus_g => 1, |
include_timer_g => 1, |
sample_t1_state_g => 4 |
) |
port map ( |
xtal_i => xtal_i, |
xtal_en_i => xtal_en_s, |
reset_i => reset_n_i, |
t0_i => t0_i, |
t0_o => t0_o, |
t0_dir_o => t0_dir_o, |
int_n_i => int_n_i, |
ea_i => ea_s, |
rd_n_o => rd_n_s, |
psen_n_o => psen_n_o, |
wr_n_o => wr_n_s, |
ale_o => ale_s, |
db_i => db_bus_to_t48, |
db_o => db_bus_from_t48, |
db_dir_o => open, |
t1_i => t1_i, |
p2_i => p2_in_s, |
p2_o => p2_out_s, |
p2l_low_imp_o => p2l_low_imp_o, |
p2h_low_imp_o => p2h_low_imp_o, |
p1_i => p1_in_s, |
p1_o => p1_out_s, |
p1_low_imp_o => p1_low_imp_o, |
prog_n_o => prog_n_o, |
clk_i => xtal_i, |
en_clk_i => xtal3_s, |
xtal3_o => xtal3_s, |
dmem_addr_o => dmem_addr_s, |
dmem_we_o => dmem_we_s, |
dmem_data_i => dmem_data_from_s, |
dmem_data_o => dmem_data_to_s, |
pmem_addr_o => pmem_addr_s, |
pmem_data_i => pmem_data_s |
); |
|
|
----------------------------------------------------------------------------- |
-- Gate port 1 and 2 input bus with respetive output value |
----------------------------------------------------------------------------- |
gate_ports: if gate_port_input_g = 1 generate |
p1_in_s <= p1_i and p1_out_s; |
p2_in_s <= p2_i and p2_out_s; |
end generate; |
|
pass_ports: if gate_port_input_g = 0 generate |
p1_in_s <= p1_i; |
p2_in_s <= p2_i; |
end generate; |
|
p1_o <= p1_out_s; |
p2_o <= p2_out_s; |
|
ale_o <= ale_s; |
wr_n_o <= wr_n_s; |
rd_n_o <= rd_n_s; |
|
|
----------------------------------------------------------------------------- |
-- Generate clock enable |
----------------------------------------------------------------------------- |
xtal_en_s <= wb_en_clk_s; |
|
|
----------------------------------------------------------------------------- |
-- Process ea |
-- |
-- Purpose: |
-- Detects access to external program memory. |
-- Either by ea_i = '1' or when program memory address leaves address |
-- range of internal ROM. |
-- |
ea: process (ea_i, |
pmem_addr_s) |
begin |
if ea_i = '1' then |
-- Forced external access |
ea_s <= '1'; |
|
-- elsif unsigned(pmem_addr_s(11 downto rom_addr_width_c)) = 0 then |
else |
-- Internal access |
ea_s <= '0'; |
|
-- else |
-- -- Access to program memory out of internal range |
-- ea_s <= '1'; |
|
end if; |
|
end process ea; |
-- |
----------------------------------------------------------------------------- |
|
|
wb_master_b : t48_wb_master |
port map ( |
xtal_i => xtal_i, |
res_i => reset_n_i, |
en_clk_o => wb_en_clk_s, |
ale_i => ale_s, |
rd_n_i => rd_n_s, |
wr_n_i => wr_n_s, |
adr_i => p2_out_s(4), |
db_bus_i => db_bus_from_t48, |
db_bus_o => db_bus_to_t48, |
wb_cyc_o => wb_cyc_o, |
wb_stb_o => wb_stb_o, |
wb_we_o => wb_we_o, |
wb_adr_o => wb_adr_o, |
wb_ack_i => wb_ack_i, |
wb_dat_i => wb_dat_i, |
wb_dat_o => wb_dat_o |
); |
|
|
rom_4k_b : syn_rom |
generic map ( |
address_width_g => rom_addr_width_c |
) |
port map ( |
clk_i => xtal_i, |
rom_addr_i => pmem_addr_s(rom_addr_width_c-1 downto 0), |
rom_data_o => pmem_data_s |
); |
|
ram_256_b : syn_ram |
generic map ( |
address_width_g => 8 |
) |
port map ( |
clk_i => xtal_i, |
res_i => reset_n_i, |
ram_addr_i => dmem_addr_s(7 downto 0), |
ram_data_i => dmem_data_to_s, |
ram_we_i => dmem_we_s, |
ram_data_o => dmem_data_from_s |
); |
|
end struct; |
|
|
------------------------------------------------------------------------------- |
-- File History: |
-- |
-- $Log: not supported by cvs2svn $ |
-- Revision 1.4 2006/06/20 00:58:49 arniml |
-- new input xtal_en_i |
-- |
-- Revision 1.3 2005/11/01 21:39:14 arniml |
-- wire signals for P2 low impedance marker issue |
-- |
-- Revision 1.2 2005/06/11 10:16:05 arniml |
-- introduce prefix 't48_' for wb_master entity and configuration |
-- |
-- Revision 1.1 2005/05/08 10:36:59 arniml |
-- initial check-in |
-- |
------------------------------------------------------------------------------- |
/t8039.vhd
0,0 → 1,202
------------------------------------------------------------------------------- |
-- |
-- T8039 Microcontroller System |
-- |
-- $Id: t8039.vhd,v 1.7 2006-07-14 01:13:32 arniml Exp $ |
-- $Name: not supported by cvs2svn $ |
-- |
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
-- Redistribution and use in source and synthezised forms, with or without |
-- modification, are permitted provided that the following conditions are met: |
-- |
-- Redistributions of source code must retain the above copyright notice, |
-- this list of conditions and the following disclaimer. |
-- |
-- Redistributions in synthesized form must reproduce the above copyright |
-- notice, this list of conditions and the following disclaimer in the |
-- documentation and/or other materials provided with the distribution. |
-- |
-- Neither the name of the author nor the names of other contributors may |
-- be used to endorse or promote products derived from this software without |
-- specific prior written permission. |
-- |
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE |
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-- POSSIBILITY OF SUCH DAMAGE. |
-- |
-- Please report bugs to the author, but before you do so, please |
-- make sure that this is not a derivative work and that |
-- you have the latest version of this file. |
-- |
-- The latest version of this file can be found at: |
-- http://www.opencores.org/cvsweb.shtml/t48/ |
-- |
------------------------------------------------------------------------------- |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
entity t8039 is |
|
port ( |
xtal_i : in std_logic; |
reset_n_i : in std_logic; |
t0_b : inout std_logic; |
int_n_i : in std_logic; |
ea_i : in std_logic; |
rd_n_o : out std_logic; |
psen_n_o : out std_logic; |
wr_n_o : out std_logic; |
ale_o : out std_logic; |
db_b : inout std_logic_vector( 7 downto 0); |
t1_i : in std_logic; |
p2_b : inout std_logic_vector( 7 downto 0); |
p1_b : inout std_logic_vector( 7 downto 0); |
prog_n_o : out std_logic |
); |
|
end t8039; |
|
|
use work.t48_system_comp_pack.t8039_notri; |
|
architecture struct of t8039 is |
|
signal t0_s : std_logic; |
signal t0_dir_s : std_logic; |
signal db_s : std_logic_vector( 7 downto 0); |
signal db_dir_s : std_logic; |
signal p2_s : std_logic_vector( 7 downto 0); |
signal p2l_low_imp_s : std_logic; |
signal p2h_low_imp_s : std_logic; |
signal p1_s : std_logic_vector( 7 downto 0); |
signal p1_low_imp_s : std_logic; |
|
signal vdd_s : std_logic; |
|
begin |
|
vdd_s <= '1'; |
|
t8039_notri_b : t8039_notri |
generic map ( |
-- we don't need explicit gating of input ports |
-- this is done implicitely by the bidirectional pads |
gate_port_input_g => 0 |
) |
|
port map ( |
xtal_i => xtal_i, |
xtal_en_i => vdd_s, |
reset_n_i => reset_n_i, |
t0_i => t0_b, |
t0_o => t0_s, |
t0_dir_o => t0_dir_s, |
int_n_i => int_n_i, |
ea_i => ea_i, |
rd_n_o => rd_n_o, |
psen_n_o => psen_n_o, |
wr_n_o => wr_n_o, |
ale_o => ale_o, |
db_i => db_b, |
db_o => db_s, |
db_dir_o => db_dir_s, |
t1_i => t1_i, |
p2_i => p2_b, |
p2_o => p2_s, |
p2l_low_imp_o => p2l_low_imp_s, |
p2h_low_imp_o => p2h_low_imp_s, |
p1_i => p1_b, |
p1_o => p1_s, |
p1_low_imp_o => p1_low_imp_s, |
prog_n_o => prog_n_o |
); |
|
----------------------------------------------------------------------------- |
-- Process bidirs |
-- |
-- Purpose: |
-- Assign bidirectional signals. |
-- |
bidirs: process (t0_b, t0_s, t0_dir_s, |
db_b, db_s, db_dir_s, |
p1_b, p1_s, p1_low_imp_s, |
p2_b, p2_s, p2l_low_imp_s, p2h_low_imp_s) |
|
function port_bidir_f(port_value : in std_logic_vector; |
low_imp : in std_logic) return std_logic_vector is |
variable result_v : std_logic_vector(port_value'range); |
begin |
for idx in port_value'high downto port_value'low loop |
if low_imp = '1' then |
result_v(idx) := port_value(idx); |
elsif port_value(idx) = '0' then |
result_v(idx) := '0'; |
else |
result_v(idx) := 'Z'; |
end if; |
end loop; |
|
return result_v; |
end; |
|
begin |
-- Test 0 ----------------------------------------------------------------- |
if t0_dir_s = '1' then |
t0_b <= t0_s; |
else |
t0_b <= 'Z'; |
end if; |
|
-- Data Bus --------------------------------------------------------------- |
if db_dir_s = '1' then |
db_b <= db_s; |
else |
db_b <= (others => 'Z'); |
end if; |
|
-- Port 1 ----------------------------------------------------------------- |
p1_b <= port_bidir_f(port_value => p1_s, |
low_imp => p1_low_imp_s); |
|
-- Port 2 ----------------------------------------------------------------- |
p2_b(3 downto 0) <= port_bidir_f(port_value => p2_s(3 downto 0), |
low_imp => p2l_low_imp_s); |
p2_b(7 downto 4) <= port_bidir_f(port_value => p2_s(7 downto 4), |
low_imp => p2h_low_imp_s); |
|
end process bidirs; |
-- |
----------------------------------------------------------------------------- |
|
end struct; |
|
|
------------------------------------------------------------------------------- |
-- File History: |
-- |
-- $Log: not supported by cvs2svn $ |
-- Revision 1.6 2006/06/20 00:47:08 arniml |
-- new input xtal_en_i |
-- |
-- Revision 1.5 2005/11/02 23:41:43 arniml |
-- properly drive P1 and P2 with low impedance markers |
-- |
-- Revision 1.4 2005/11/01 21:37:45 arniml |
-- wire signals for P2 low impedance marker issue |
-- |
-- Revision 1.3 2004/12/03 19:43:12 arniml |
-- added hierarchy t8039_notri |
-- |
------------------------------------------------------------------------------- |
/t8048.vhd
0,0 → 1,228
------------------------------------------------------------------------------- |
-- |
-- T8048 Microcontroller System |
-- |
-- $Id: t8048.vhd,v 1.11 2006-07-14 01:13:32 arniml Exp $ |
-- $Name: not supported by cvs2svn $ |
-- |
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
-- Redistribution and use in source and synthezised forms, with or without |
-- modification, are permitted provided that the following conditions are met: |
-- |
-- Redistributions of source code must retain the above copyright notice, |
-- this list of conditions and the following disclaimer. |
-- |
-- Redistributions in synthesized form must reproduce the above copyright |
-- notice, this list of conditions and the following disclaimer in the |
-- documentation and/or other materials provided with the distribution. |
-- |
-- Neither the name of the author nor the names of other contributors may |
-- be used to endorse or promote products derived from this software without |
-- specific prior written permission. |
-- |
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE |
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-- POSSIBILITY OF SUCH DAMAGE. |
-- |
-- Please report bugs to the author, but before you do so, please |
-- make sure that this is not a derivative work and that |
-- you have the latest version of this file. |
-- |
-- The latest version of this file can be found at: |
-- http://www.opencores.org/cvsweb.shtml/t48/ |
-- |
------------------------------------------------------------------------------- |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
entity t8048 is |
|
port ( |
xtal_i : in std_logic; |
reset_n_i : in std_logic; |
t0_b : inout std_logic; |
int_n_i : in std_logic; |
ea_i : in std_logic; |
rd_n_o : out std_logic; |
psen_n_o : out std_logic; |
wr_n_o : out std_logic; |
ale_o : out std_logic; |
db_b : inout std_logic_vector( 7 downto 0); |
t1_i : in std_logic; |
p2_b : inout std_logic_vector( 7 downto 0); |
p1_b : inout std_logic_vector( 7 downto 0); |
prog_n_o : out std_logic |
); |
|
end t8048; |
|
|
library ieee; |
use ieee.numeric_std.all; |
|
use work.t48_system_comp_pack.t8048_notri; |
|
architecture struct of t8048 is |
|
signal t0_s : std_logic; |
signal t0_dir_s : std_logic; |
signal db_s : std_logic_vector( 7 downto 0); |
signal db_dir_s : std_logic; |
signal p2_s : std_logic_vector( 7 downto 0); |
signal p2l_low_imp_s : std_logic; |
signal p2h_low_imp_s : std_logic; |
signal p1_s : std_logic_vector( 7 downto 0); |
signal p1_low_imp_s : std_logic; |
|
signal vdd_s : std_logic; |
|
begin |
|
vdd_s <= '1'; |
|
t8048_notri_b : t8048_notri |
generic map ( |
-- we don't need explicit gating of input ports |
-- this is done implicitely by the bidirectional pads |
gate_port_input_g => 0 |
) |
|
port map ( |
xtal_i => xtal_i, |
xtal_en_i => vdd_s, |
reset_n_i => reset_n_i, |
t0_i => t0_b, |
t0_o => t0_s, |
t0_dir_o => t0_dir_s, |
int_n_i => int_n_i, |
ea_i => ea_i, |
rd_n_o => rd_n_o, |
psen_n_o => psen_n_o, |
wr_n_o => wr_n_o, |
ale_o => ale_o, |
db_i => db_b, |
db_o => db_s, |
db_dir_o => db_dir_s, |
t1_i => t1_i, |
p2_i => p2_b, |
p2_o => p2_s, |
p2l_low_imp_o => p2l_low_imp_s, |
p2h_low_imp_o => p2h_low_imp_s, |
p1_i => p1_b, |
p1_o => p1_s, |
p1_low_imp_o => p1_low_imp_s, |
prog_n_o => prog_n_o |
); |
|
----------------------------------------------------------------------------- |
-- Process bidirs |
-- |
-- Purpose: |
-- Assign bidirectional signals. |
-- |
bidirs: process (t0_b, t0_s, t0_dir_s, |
db_b, db_s, db_dir_s, |
p1_b, p1_s, p1_low_imp_s, |
p2_b, p2_s, p2l_low_imp_s, p2h_low_imp_s) |
|
function port_bidir_f(port_value : in std_logic_vector; |
low_imp : in std_logic) return std_logic_vector is |
variable result_v : std_logic_vector(port_value'range); |
begin |
for idx in port_value'high downto port_value'low loop |
if low_imp = '1' then |
result_v(idx) := port_value(idx); |
elsif port_value(idx) = '0' then |
result_v(idx) := '0'; |
else |
result_v(idx) := 'Z'; |
end if; |
end loop; |
|
return result_v; |
end; |
|
begin |
-- Test 0 ----------------------------------------------------------------- |
if t0_dir_s = '1' then |
t0_b <= t0_s; |
else |
t0_b <= 'Z'; |
end if; |
|
-- Data Bus --------------------------------------------------------------- |
if db_dir_s = '1' then |
db_b <= db_s; |
else |
db_b <= (others => 'Z'); |
end if; |
|
-- Port 1 ----------------------------------------------------------------- |
p1_b <= port_bidir_f(port_value => p1_s, |
low_imp => p1_low_imp_s); |
|
-- Port 2 ----------------------------------------------------------------- |
p2_b(3 downto 0) <= port_bidir_f(port_value => p2_s(3 downto 0), |
low_imp => p2l_low_imp_s); |
p2_b(7 downto 4) <= port_bidir_f(port_value => p2_s(7 downto 4), |
low_imp => p2h_low_imp_s); |
|
end process bidirs; |
-- |
----------------------------------------------------------------------------- |
|
|
end struct; |
|
|
------------------------------------------------------------------------------- |
-- File History: |
-- |
-- $Log: not supported by cvs2svn $ |
-- Revision 1.10 2006/06/20 00:47:08 arniml |
-- new input xtal_en_i |
-- |
-- Revision 1.9 2005/11/02 23:41:43 arniml |
-- properly drive P1 and P2 with low impedance markers |
-- |
-- Revision 1.8 2005/11/01 21:38:31 arniml |
-- wire signals for P2 low impedance marker issue |
-- |
-- Revision 1.7 2004/12/03 19:44:36 arniml |
-- removed obsolete constant |
-- |
-- Revision 1.6 2004/12/02 22:08:42 arniml |
-- introduced generic gate_port_input_g |
-- forces masking of P1 and P2 input bus |
-- |
-- Revision 1.5 2004/12/01 23:09:47 arniml |
-- intruduced hierarchy t8048_notri where all system functionality |
-- except bidirectional ports is handled |
-- |
-- Revision 1.4 2004/10/24 09:10:16 arniml |
-- Fix for: |
-- P1 constantly in push-pull mode in t8048 |
-- |
-- Revision 1.3 2004/05/20 21:58:26 arniml |
-- Fix for: |
-- External Program Memory ignored when EA = 0 |
-- |
-- Revision 1.2 2004/03/29 19:40:14 arniml |
-- rename pX_limp to pX_low_imp |
-- |
-- Revision 1.1 2004/03/24 21:32:27 arniml |
-- initial check-in |
-- |
------------------------------------------------------------------------------- |
/t8039_notri-c.vhd
0,0 → 1,28
------------------------------------------------------------------------------- |
-- |
-- T8039 Microcontroller System |
-- 8039 toplevel without tri-states |
-- |
-- $Id: t8039_notri-c.vhd,v 1.2 2006-06-21 01:02:35 arniml Exp $ |
-- |
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
------------------------------------------------------------------------------- |
|
configuration t8039_notri_struct_c0 of t8039_notri is |
|
for struct |
|
for ram_128_b : generic_ram_ena |
use configuration work.generic_ram_ena_rtl_c0; |
end for; |
|
for t48_core_b : t48_core |
use configuration work.t48_core_struct_c0; |
end for; |
|
end for; |
|
end t8039_notri_struct_c0; |
/t8048_notri-c.vhd
0,0 → 1,31
------------------------------------------------------------------------------- |
-- |
-- T8048 Microcontroller System |
-- |
-- $Id: t8048_notri-c.vhd,v 1.2 2006-06-21 01:02:16 arniml Exp $ |
-- |
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
------------------------------------------------------------------------------- |
|
configuration t8048_notri_struct_c0 of t8048_notri is |
|
for struct |
|
for rom_1k_b : t48_rom |
use configuration work.t48_rom_lpm_c0; |
end for; |
|
for ram_64_b : generic_ram_ena |
use configuration work.generic_ram_ena_rtl_c0; |
end for; |
|
for t48_core_b : t48_core |
use configuration work.t48_core_struct_c0; |
end for; |
|
end for; |
|
end t8048_notri_struct_c0; |
/t48_rom-e.vhd
0,0 → 1,64
------------------------------------------------------------------------------- |
-- |
-- T8x48 ROM |
-- |
-- $Id: t48_rom-e.vhd,v 1.1 2006-06-21 00:59:15 arniml Exp $ |
-- |
-- Copyright (c) 2006 Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
-- Redistribution and use in source and synthezised forms, with or without |
-- modification, are permitted provided that the following conditions are met: |
-- |
-- Redistributions of source code must retain the above copyright notice, |
-- this list of conditions and the following disclaimer. |
-- |
-- Redistributions in synthesized form must reproduce the above copyright |
-- notice, this list of conditions and the following disclaimer in the |
-- documentation and/or other materials provided with the distribution. |
-- |
-- Neither the name of the author nor the names of other contributors may |
-- be used to endorse or promote products derived from this software without |
-- specific prior written permission. |
-- |
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE |
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-- POSSIBILITY OF SUCH DAMAGE. |
-- |
-- Please report bugs to the author, but before you do so, please |
-- make sure that this is not a derivative work and that |
-- you have the latest version of this file. |
-- |
-- The latest version of this file can be found at: |
-- http://www.opencores.org/cvsweb.shtml/t48/ |
-- |
------------------------------------------------------------------------------- |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
entity t48_rom is |
|
port ( |
clk_i : in std_logic; |
rom_addr_i : in std_logic_vector(9 downto 0); |
rom_data_o : out std_logic_vector(7 downto 0) |
); |
|
end t48_rom; |
|
|
------------------------------------------------------------------------------- |
-- File History: |
-- |
-- $Log: not supported by cvs2svn $ |
------------------------------------------------------------------------------- |
/generic_ram_ena-c.vhd
0,0 → 1,18
------------------------------------------------------------------------------- |
-- |
-- Parametrizable, generic RAM with enable. |
-- |
-- $Id: generic_ram_ena-c.vhd,v 1.1 2006-06-21 00:59:15 arniml Exp $ |
-- |
-- Copyright (c) 2006, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
------------------------------------------------------------------------------- |
|
configuration generic_ram_ena_rtl_c0 of generic_ram_ena is |
|
for rtl |
end for; |
|
end generic_ram_ena_rtl_c0; |
/t49_rom-e.vhd
0,0 → 1,64
------------------------------------------------------------------------------- |
-- |
-- T8x49 ROM |
-- |
-- $Id: t49_rom-e.vhd,v 1.1 2006-06-21 00:59:15 arniml Exp $ |
-- |
-- Copyright (c) 2006 Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
-- Redistribution and use in source and synthezised forms, with or without |
-- modification, are permitted provided that the following conditions are met: |
-- |
-- Redistributions of source code must retain the above copyright notice, |
-- this list of conditions and the following disclaimer. |
-- |
-- Redistributions in synthesized form must reproduce the above copyright |
-- notice, this list of conditions and the following disclaimer in the |
-- documentation and/or other materials provided with the distribution. |
-- |
-- Neither the name of the author nor the names of other contributors may |
-- be used to endorse or promote products derived from this software without |
-- specific prior written permission. |
-- |
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE |
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-- POSSIBILITY OF SUCH DAMAGE. |
-- |
-- Please report bugs to the author, but before you do so, please |
-- make sure that this is not a derivative work and that |
-- you have the latest version of this file. |
-- |
-- The latest version of this file can be found at: |
-- http://www.opencores.org/cvsweb.shtml/t48/ |
-- |
------------------------------------------------------------------------------- |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
entity t49_rom is |
|
port ( |
clk_i : in std_logic; |
rom_addr_i : in std_logic_vector(10 downto 0); |
rom_data_o : out std_logic_vector( 7 downto 0) |
); |
|
end t49_rom; |
|
|
------------------------------------------------------------------------------- |
-- File History: |
-- |
-- $Log: not supported by cvs2svn $ |
------------------------------------------------------------------------------- |
/generic_ram_ena.vhd
0,0 → 1,100
------------------------------------------------------------------------------- |
-- |
-- Parametrizable, generic RAM with enable. |
-- |
-- $Id: generic_ram_ena.vhd,v 1.1 2006-06-21 00:59:15 arniml Exp $ |
-- |
-- Copyright (c) 2006 Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
-- Redistribution and use in source and synthezised forms, with or without |
-- modification, are permitted provided that the following conditions are met: |
-- |
-- Redistributions of source code must retain the above copyright notice, |
-- this list of conditions and the following disclaimer. |
-- |
-- Redistributions in synthesized form must reproduce the above copyright |
-- notice, this list of conditions and the following disclaimer in the |
-- documentation and/or other materials provided with the distribution. |
-- |
-- Neither the name of the author nor the names of other contributors may |
-- be used to endorse or promote products derived from this software without |
-- specific prior written permission. |
-- |
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE |
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-- POSSIBILITY OF SUCH DAMAGE. |
-- |
-- Please report bugs to the author, but before you do so, please |
-- make sure that this is not a derivative work and that |
-- you have the latest version of this file. |
-- |
-- The latest version of this file can be found at: |
-- http://www.opencores.org/cvsweb.shtml/t48/ |
-- |
------------------------------------------------------------------------------- |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
entity generic_ram_ena is |
|
generic ( |
addr_width_g : integer := 10; |
data_width_g : integer := 8 |
); |
port ( |
clk_i : in std_logic; |
a_i : in std_logic_vector(addr_width_g-1 downto 0); |
we_i : in std_logic; |
ena_i : in std_logic; |
d_i : in std_logic_vector(data_width_g-1 downto 0); |
d_o : out std_logic_vector(data_width_g-1 downto 0) |
); |
|
end generic_ram_ena; |
|
|
library ieee; |
use ieee.numeric_std.all; |
|
architecture rtl of generic_ram_ena is |
|
type mem_t is array (natural range 0 to 2**addr_width_g-1) of |
std_logic_vector(d_i'range); |
signal mem_q : mem_t |
-- pragma translate_off |
:= (others => (others => '0')) |
-- pragma translate_on |
; |
signal a_q : std_logic_vector(a_i'range); |
|
begin |
|
mem: process (clk_i) |
begin |
|
if clk_i'event and clk_i = '1' then |
if ena_i = '1' then |
if we_i = '1' then |
mem_q(to_integer(unsigned(a_i))) <= d_i; |
end if; |
|
a_q <= a_i; |
end if; |
|
end if; |
end process mem; |
|
d_o <= mem_q(to_integer(unsigned(a_q))); |
|
end rtl; |
/t48_system_comp_pack-p.vhd
0,0 → 1,177
------------------------------------------------------------------------------- |
-- |
-- $Id: t48_system_comp_pack-p.vhd,v 1.8 2006-06-20 00:47:08 arniml Exp $ |
-- |
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
------------------------------------------------------------------------------- |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
package t48_system_comp_pack is |
|
component t48_wb_master |
port ( |
xtal_i : in std_logic; |
res_i : in std_logic; |
en_clk_o : out std_logic; |
ale_i : in std_logic; |
rd_n_i : in std_logic; |
wr_n_i : in std_logic; |
adr_i : in std_logic; |
db_bus_i : in std_logic_vector( 7 downto 0); |
db_bus_o : out std_logic_vector( 7 downto 0); |
wb_cyc_o : out std_logic; |
wb_stb_o : out std_logic; |
wb_we_o : out std_logic; |
wb_adr_o : out std_logic_vector(23 downto 0); |
wb_ack_i : in std_logic; |
wb_dat_i : in std_logic_vector( 7 downto 0); |
wb_dat_o : out std_logic_vector( 7 downto 0) |
); |
end component; |
|
component t8048_notri |
generic ( |
gate_port_input_g : integer := 1 |
); |
|
port ( |
xtal_i : in std_logic; |
xtal_en_i : in std_logic; |
reset_n_i : in std_logic; |
t0_i : in std_logic; |
t0_o : out std_logic; |
t0_dir_o : out std_logic; |
int_n_i : in std_logic; |
ea_i : in std_logic; |
rd_n_o : out std_logic; |
psen_n_o : out std_logic; |
wr_n_o : out std_logic; |
ale_o : out std_logic; |
db_i : in std_logic_vector( 7 downto 0); |
db_o : out std_logic_vector( 7 downto 0); |
db_dir_o : out std_logic; |
t1_i : in std_logic; |
p2_i : in std_logic_vector( 7 downto 0); |
p2_o : out std_logic_vector( 7 downto 0); |
p2l_low_imp_o : out std_logic; |
p2h_low_imp_o : out std_logic; |
p1_i : in std_logic_vector( 7 downto 0); |
p1_o : out std_logic_vector( 7 downto 0); |
p1_low_imp_o : out std_logic; |
prog_n_o : out std_logic |
); |
end component; |
|
component t8039_notri |
generic ( |
gate_port_input_g : integer := 1 |
); |
|
port ( |
xtal_i : in std_logic; |
xtal_en_i : in std_logic; |
reset_n_i : in std_logic; |
t0_i : in std_logic; |
t0_o : out std_logic; |
t0_dir_o : out std_logic; |
int_n_i : in std_logic; |
ea_i : in std_logic; |
rd_n_o : out std_logic; |
psen_n_o : out std_logic; |
wr_n_o : out std_logic; |
ale_o : out std_logic; |
db_i : in std_logic_vector( 7 downto 0); |
db_o : out std_logic_vector( 7 downto 0); |
db_dir_o : out std_logic; |
t1_i : in std_logic; |
p2_i : in std_logic_vector( 7 downto 0); |
p2_o : out std_logic_vector( 7 downto 0); |
p2l_low_imp_o : out std_logic; |
p2h_low_imp_o : out std_logic; |
p1_i : in std_logic_vector( 7 downto 0); |
p1_o : out std_logic_vector( 7 downto 0); |
p1_low_imp_o : out std_logic; |
prog_n_o : out std_logic |
); |
end component; |
|
component t8050_wb |
generic ( |
gate_port_input_g : integer := 1 |
); |
|
port ( |
xtal_i : in std_logic; |
reset_n_i : in std_logic; |
t0_i : in std_logic; |
t0_o : out std_logic; |
t0_dir_o : out std_logic; |
int_n_i : in std_logic; |
ea_i : in std_logic; |
rd_n_o : out std_logic; |
psen_n_o : out std_logic; |
wr_n_o : out std_logic; |
ale_o : out std_logic; |
t1_i : in std_logic; |
p2_i : in std_logic_vector( 7 downto 0); |
p2_o : out std_logic_vector( 7 downto 0); |
p2l_low_imp_o : out std_logic; |
p2h_low_imp_o : out std_logic; |
p1_i : in std_logic_vector( 7 downto 0); |
p1_o : out std_logic_vector( 7 downto 0); |
p1_low_imp_o : out std_logic; |
prog_n_o : out std_logic; |
wb_cyc_o : out std_logic; |
wb_stb_o : out std_logic; |
wb_we_o : out std_logic; |
wb_adr_o : out std_logic_vector(23 downto 0); |
wb_ack_i : in std_logic; |
wb_dat_i : in std_logic_vector( 7 downto 0); |
wb_dat_o : out std_logic_vector( 7 downto 0) |
); |
end component; |
|
component t8048 |
port ( |
xtal_i : in std_logic; |
reset_n_i : in std_logic; |
t0_b : inout std_logic; |
int_n_i : in std_logic; |
ea_i : in std_logic; |
rd_n_o : out std_logic; |
psen_n_o : out std_logic; |
wr_n_o : out std_logic; |
ale_o : out std_logic; |
db_b : inout std_logic_vector( 7 downto 0); |
t1_i : in std_logic; |
p2_b : inout std_logic_vector( 7 downto 0); |
p1_b : inout std_logic_vector( 7 downto 0); |
prog_n_o : out std_logic |
); |
end component; |
|
component t8039 |
port ( |
xtal_i : in std_logic; |
reset_n_i : in std_logic; |
t0_b : inout std_logic; |
int_n_i : in std_logic; |
ea_i : in std_logic; |
rd_n_o : out std_logic; |
psen_n_o : out std_logic; |
wr_n_o : out std_logic; |
ale_o : out std_logic; |
db_b : inout std_logic_vector( 7 downto 0); |
t1_i : in std_logic; |
p2_b : inout std_logic_vector( 7 downto 0); |
p1_b : inout std_logic_vector( 7 downto 0); |
prog_n_o : out std_logic |
); |
end component; |
|
end t48_system_comp_pack; |
/wb_master-c.vhd
0,0 → 1,18
------------------------------------------------------------------------------- |
-- |
-- The Wishbone master module. |
-- |
-- $Id: wb_master-c.vhd,v 1.2 2005-06-11 10:16:05 arniml Exp $ |
-- |
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
------------------------------------------------------------------------------- |
|
configuration t48_wb_master_rtl_c0 of t48_wb_master is |
|
for rtl |
end for; |
|
end t48_wb_master_rtl_c0; |
/wb_master.vhd
0,0 → 1,271
------------------------------------------------------------------------------- |
-- |
-- The Wishbone master module. |
-- |
-- $Id: wb_master.vhd,v 1.5 2005-06-11 10:16:05 arniml Exp $ |
-- |
-- Copyright (c) 2005, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
-- Redistribution and use in source and synthezised forms, with or without |
-- modification, are permitted provided that the following conditions are met: |
-- |
-- Redistributions of source code must retain the above copyright notice, |
-- this list of conditions and the following disclaimer. |
-- |
-- Redistributions in synthesized form must reproduce the above copyright |
-- notice, this list of conditions and the following disclaimer in the |
-- documentation and/or other materials provided with the distribution. |
-- |
-- Neither the name of the author nor the names of other contributors may |
-- be used to endorse or promote products derived from this software without |
-- specific prior written permission. |
-- |
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE |
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-- POSSIBILITY OF SUCH DAMAGE. |
-- |
-- Please report bugs to the author, but before you do so, please |
-- make sure that this is not a derivative work and that |
-- you have the latest version of this file. |
-- |
-- The latest version of this file can be found at: |
-- http://www.opencores.org/cvsweb.shtml/t48/ |
-- |
-- |
-- Short description: |
-- This design implements a simple Wishbone bus master. It connects to the |
-- BUS interface of the T48 uController core. |
-- |
-- The CPU clock is suppressed with en_clk_o to stall the CPU until the |
-- acknowledge signal from the peripheral is detected. |
-- |
-- The adr_i input selects between configuration and Wishbone address range: |
-- 1 - configuration range |
-- 0 - Wishbone range |
-- |
-- When configuration range is selected, two address register are accessible. |
-- 000h -> adr1 |
-- 001h -> adr2 |
-- These registers can be read and written with movx to their addresses. |
-- |
-- When Wishbone range is selected, all movx generate Wishbone bus cycles |
-- (either read or write) at following address: |
-- Wishbone address = adr2 & adr1 & address of movx |
-- |
------------------------------------------------------------------------------- |
|
library ieee; |
use ieee.std_logic_1164.all; |
|
use work.t48_pack.all; |
|
entity t48_wb_master is |
|
port ( |
xtal_i : in std_logic; |
res_i : in std_logic; |
en_clk_o : out std_logic; |
-- T48 Interface ---------------------------------------------------------- |
ale_i : in std_logic; |
rd_n_i : in std_logic; |
wr_n_i : in std_logic; |
adr_i : in std_logic; |
db_bus_i : in std_logic_vector( 7 downto 0); |
db_bus_o : out std_logic_vector( 7 downto 0); |
-- Wishbone Interface ----------------------------------------------------- |
wb_cyc_o : out std_logic; |
wb_stb_o : out std_logic; |
wb_we_o : out std_logic; |
wb_adr_o : out std_logic_vector(23 downto 0); |
wb_ack_i : in std_logic; |
wb_dat_i : in std_logic_vector( 7 downto 0); |
wb_dat_o : out std_logic_vector( 7 downto 0) |
); |
|
end t48_wb_master; |
|
|
architecture rtl of t48_wb_master is |
|
----------------------------------------------------------------------------- |
-- Controller FSM |
----------------------------------------------------------------------------- |
type state_t is (IDLE, CYC, WAIT_INACT); |
signal state_s, |
state_q : state_t; |
|
----------------------------------------------------------------------------- |
-- Select signals for each range |
----------------------------------------------------------------------------- |
signal sel_adr1_s, |
sel_adr2_s, |
sel_wb_s : boolean; |
|
signal wr_s, |
rd_s : boolean; |
|
signal adr_q : std_logic_vector(23 downto 0); |
signal wb_dat_q : std_logic_vector( 7 downto 0); |
|
begin |
|
----------------------------------------------------------------------------- |
-- Select signal generation |
----------------------------------------------------------------------------- |
sel_adr1_s <= adr_i = '1' and adr_q(word_t'range) = "00000000"; |
sel_adr2_s <= adr_i = '1' and adr_q(word_t'range) = "00000001"; |
sel_wb_s <= adr_i = '0'; |
|
wr_s <= wr_n_i = '0'; |
rd_s <= rd_n_i = '0'; |
|
|
----------------------------------------------------------------------------- |
-- Process seq |
-- |
-- Purpose: |
-- Implements the sequential elements. |
-- |
seq: process (res_i, xtal_i) |
begin |
if res_i = res_active_c then |
adr_q <= (others => '0'); |
wb_dat_q <= (others => '0'); |
state_q <= IDLE; |
|
elsif xtal_i'event and xtal_i = clk_active_c then |
-- Address register ----------------------------------------------------- |
-- update lowest address byte |
if ale_i = '1' then |
adr_q(word_t'range) <= db_bus_i; |
end if; |
-- set adr1 part |
if wr_s and sel_adr1_s then |
adr_q(word_t'length*2 - 1 downto word_t'length) <= db_bus_i; |
end if; |
-- set adr2 part |
if wr_s and sel_adr2_s then |
adr_q(word_t'length*3 - 1 downto word_t'length*2) <= db_bus_i; |
end if; |
|
-- Data from peripheral has to be saved --------------------------------- |
if wb_ack_i = '1' then |
wb_dat_q <= wb_dat_i; |
end if; |
|
-- FSM state ------------------------------------------------------------ |
state_q <= state_s; |
|
end if; |
end process seq; |
-- |
----------------------------------------------------------------------------- |
|
|
----------------------------------------------------------------------------- |
-- Process fsm |
-- |
-- Purpose: |
-- Implements the state transitions of the controller FSM. |
-- |
fsm: process (state_q, |
wr_s, |
rd_s, |
sel_wb_s, |
wb_ack_i) |
begin |
-- default assignments |
wb_cyc_o <= '0'; |
wb_stb_o <= '0'; |
en_clk_o <= '1'; |
state_s <= IDLE; |
|
case state_q is |
-- Idle State: Wait for read or write access ---------------------------- |
when IDLE => |
if sel_wb_s and (wr_s or rd_s) then |
state_s <= CYC; |
end if; |
|
-- WB Cycle State: Start Wishbone cycle and wait for ack ---------------- |
when CYC => |
wb_cyc_o <= '1'; |
wb_stb_o <= '1'; |
en_clk_o <= '0'; |
|
if wb_ack_i = '1' then |
state_s <= WAIT_INACT; |
else |
state_s <= CYC; |
end if; |
|
-- Wait inact State: Wait for end of T48 access ------------------------- |
when WAIT_INACT => |
if not wr_s and not rd_s then |
state_s <= IDLE; |
else |
state_s <= WAIT_INACT; |
end if; |
|
when others => |
null; |
|
end case; |
|
end process fsm; |
-- |
----------------------------------------------------------------------------- |
|
|
----------------------------------------------------------------------------- |
-- Output multiplexer |
----------------------------------------------------------------------------- |
db_bus_o <= adr_q(word_t'length*2 - 1 downto word_t'length) |
when sel_adr1_s else |
adr_q(word_t'length*3 - 1 downto word_t'length*2) |
when sel_adr2_s else |
wb_dat_q; |
|
|
----------------------------------------------------------------------------- |
-- Output mapping |
----------------------------------------------------------------------------- |
wb_adr_o <= adr_q; |
wb_dat_o <= db_bus_i; |
wb_we_o <= '1' |
when wr_s and sel_wb_s else |
'0'; |
|
end rtl; |
|
|
------------------------------------------------------------------------------- |
-- File History: |
-- |
-- $Log: not supported by cvs2svn $ |
-- Revision 1.4 2005/05/10 22:36:23 arniml |
-- save data from wishbone bus in register bank with wb_ack |
-- necessary to hold data from peripheral/memory until it is read by T48 |
-- |
-- Revision 1.3 2005/05/08 10:36:07 arniml |
-- simplify address range: |
-- - configuration range |
-- - Wishbone range |
-- |
-- Revision 1.2 2005/05/06 18:54:03 arniml |
-- assign default for state_s |
-- |
-- Revision 1.1 2005/05/05 19:49:03 arniml |
-- initial check-in |
-- |
------------------------------------------------------------------------------- |
/t8050_wb-c.vhd
0,0 → 1,35
------------------------------------------------------------------------------- |
-- |
-- T8048 Microcontroller System |
-- |
-- $Id: t8050_wb-c.vhd,v 1.2 2005-06-11 10:19:14 arniml Exp $ |
-- |
-- Copyright (c) 2005, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
------------------------------------------------------------------------------- |
|
configuration t8050_wb_struct_c0 of t8050_wb is |
|
for struct |
|
for rom_4k_b : syn_rom |
use configuration work.syn_rom_lpm_c0; |
end for; |
|
for ram_256_b : syn_ram |
use configuration work.syn_ram_lpm_c0; |
end for; |
|
for wb_master_b : t48_wb_master |
use configuration work.t48_wb_master_rtl_c0; |
end for; |
|
for t48_core_b : t48_core |
use configuration work.t48_core_struct_c0; |
end for; |
|
end for; |
|
end t8050_wb_struct_c0; |
/lpm_rom.vhd
0,0 → 1,437
-------------------------------------------------------------------------- |
-- This VHDL file was developed by Altera Corporation. It may be |
-- freely copied and/or distributed at no cost. Any persons using this |
-- file for any purpose do so at their own risk, and are responsible for |
-- the results of such use. Altera Corporation does not guarantee that |
-- this file is complete, correct, or fit for any particular purpose. |
-- NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. This notice must |
-- accompany any copy of this file. |
-- |
-------------------------------------------------------------------------- |
-- LPM Synthesizable Models (Support string type generic) |
-------------------------------------------------------------------------- |
-- Version 2.0 (lpm 220) Date 01/04/00 |
-- |
-- 1. Fixed LPM_RAM_DQ, LPM_RAM_DP, LPM_RAM_IO and LPM_ROM to correctly |
-- read in values from LPM_FILE (*.hex) when the DATA width is greater |
-- than 16 bits. |
-- 2. Explicit sign conversions are added to standard logic vector |
-- comparisons in LPM_RAM_DQ, LPM_RAM_DP, LPM_RAM_IO, LPM_ROM, and |
-- LPM_COMPARE. |
-- 3. LPM_FIFO_DC is rewritten to have correct outputs. |
-- 4. LPM_FIFO outputs zeros when nothing has been read from it, and |
-- outputs LPM_NUMWORDS mod exp(2, LPM_WIDTHU) when it is full. |
-- 5. Fixed LPM_DIVIDE to divide correctly. |
-------------------------------------------------------------------------- |
-- Version 1.9 (lpm 220) Date 11/30/99 |
-- |
-- 1. Fixed UNUSED file not found problem and initialization problem |
-- with LPM_RAM_DP, LPM_RAM_DQ, and LPM_RAM_IO. |
-- 2. Fixed LPM_MULT when SUM port is not used. |
-- 3. Fixed LPM_FIFO_DC to enable read when rdclock and wrclock rise |
-- at the same time. |
-- 4. Fixed LPM_COUNTER comparison problem when signed library is loaded |
-- and counter is incrementing. |
-- 5. Got rid of "Illegal Character" error message at time = 0 ns when |
-- simulating LPM_COUNTER. |
-------------------------------------------------------------------------- |
-- Version 1.8 (lpm 220) Date 10/25/99 |
-- |
-- 1. Some LPM_PVALUE implementations were missing, and now implemented. |
-- 2. Fixed LPM_COUNTER to count correctly without conversion overflow, |
-- that is, when LPM_MODULUS = 2 ** LPM_WIDTH. |
-- 3. Fixed LPM_RAM_DP sync process sensitivity list to detect wraddress |
-- changes. |
-------------------------------------------------------------------------- |
-- Version 1.7 (lpm 220) Date 07/13/99 |
-- |
-- Changed LPM_RAM_IO so that it can be used to simulate both MP2 and |
-- Quartus behaviour and LPM220-compliant behaviour. |
-------------------------------------------------------------------------- |
-- Version 1.6 (lpm 220) Date 06/15/99 |
-- |
-- 1. Fixed LPM_ADD_SUB sign extension problem and subtraction bug. |
-- 2. Fixed LPM_COUNTER to use LPM_MODULUS value. |
-- 3. Added CIN and COUT port, and discarded EQ port in LPM_COUNTER to |
-- comply with the specfication. |
-- 4. Included LPM_RAM_DP, LPM_RAM_DQ, LPM_RAM_IO, LPM_ROM, LPM_FIFO, and |
-- LPM_FIFO_DC; they are all initialized to 0's. |
-------------------------------------------------------------------------- |
-- Version 1.5 (lpm 220) Date 05/10/99 |
-- |
-- Changed LPM_MODULUS from string type to integer. |
-------------------------------------------------------------------------- |
-- Version 1.4 (lpm 220) Date 02/05/99 |
-- |
-- 1. Added LPM_DIVIDE module. |
-- 2. Added CLKEN port to LPM_MUX, LPM_DECODE, LPM_ADD_SUB, LPM_MULT |
-- and LPM_COMPARE |
-- 3. Replaced the constants holding string with the actual string. |
-------------------------------------------------------------------------- |
-- Version 1.3 Date 07/30/96 |
-- |
-- Modification History |
-- |
-- 1. Changed the DEFAULT value to "UNUSED" for LPM_SVALUE, LPM_AVALUE, |
-- LPM_MODULUS, and LPM_NUMWORDS, LPM_HINT,LPM_STRENGTH, LPM_DIRECTION, |
-- and LPM_PVALUE |
-- |
-- 2. Added the two dimentional port components (AND, OR, XOR, and MUX). |
-------------------------------------------------------------------------- |
-- Excluded Functions: |
-- |
-- LPM_FSM and LPM_TTABLE |
-- |
-------------------------------------------------------------------------- |
-- Assumptions: |
-- |
-- 1. All ports and signal types are std_logic or std_logic_vector |
-- from IEEE 1164 package. |
-- 2. Synopsys std_logic_arith, std_logic_unsigned, and std_logic_signed |
-- package are assumed to be accessible from IEEE library. |
-- 3. lpm_component_package must be accessible from library work. |
-- 4. The default value of LPM_SVALUE, LPM_AVALUE, LPM_MODULUS, LPM_HINT, |
-- LPM_NUMWORDS, LPM_STRENGTH, LPM_DIRECTION, and LPM_PVALUE is |
-- string "UNUSED". |
-------------------------------------------------------------------------- |
|
library IEEE; |
use IEEE.std_logic_1164.all; |
use IEEE.numeric_std.all; |
--use work.LPM_COMPONENTS.all; |
use std.textio.all; |
|
entity LPM_ROM is |
generic (LPM_WIDTH : positive; |
LPM_WIDTHAD : positive; |
LPM_NUMWORDS : natural := 0; |
LPM_ADDRESS_CONTROL : string := "REGISTERED"; |
LPM_OUTDATA : string := "REGISTERED"; |
LPM_FILE : string; |
LPM_TYPE : string := "LPM_ROM"; |
LPM_HINT : string := "UNUSED"); |
port (ADDRESS : in STD_LOGIC_VECTOR(LPM_WIDTHAD-1 downto 0); |
INCLOCK : in STD_LOGIC := '0'; |
OUTCLOCK : in STD_LOGIC := '0'; |
MEMENAB : in STD_LOGIC := '1'; |
Q : out STD_LOGIC_VECTOR(LPM_WIDTH-1 downto 0)); |
|
function int_to_str( value : integer ) return string is |
variable ivalue,index : integer; |
variable digit : integer; |
variable line_no: string(8 downto 1) := " "; |
begin |
ivalue := value; |
index := 1; |
while (ivalue > 0 ) loop |
digit := ivalue MOD 10; |
ivalue := ivalue/10; |
case digit is |
when 0 => |
line_no(index) := '0'; |
when 1 => |
line_no(index) := '1'; |
when 2 => |
line_no(index) := '2'; |
when 3 => |
line_no(index) := '3'; |
when 4 => |
line_no(index) := '4'; |
when 5 => |
line_no(index) := '5'; |
when 6 => |
line_no(index) := '6'; |
when 7 => |
line_no(index) := '7'; |
when 8 => |
line_no(index) := '8'; |
when 9 => |
line_no(index) := '9'; |
when others => |
ASSERT FALSE |
REPORT "Illegal number!" |
SEVERITY ERROR; |
end case; |
index := index + 1; |
end loop; |
return line_no; |
end; |
|
function hex_str_to_int( str : string ) return integer is |
variable len : integer := str'length; |
variable ivalue : integer := 0; |
variable digit : integer; |
begin |
for i in len downto 1 loop |
case str(i) is |
when '0' => |
digit := 0; |
when '1' => |
digit := 1; |
when '2' => |
digit := 2; |
when '3' => |
digit := 3; |
when '4' => |
digit := 4; |
when '5' => |
digit := 5; |
when '6' => |
digit := 6; |
when '7' => |
digit := 7; |
when '8' => |
digit := 8; |
when '9' => |
digit := 9; |
when 'A' => |
digit := 10; |
when 'a' => |
digit := 10; |
when 'B' => |
digit := 11; |
when 'b' => |
digit := 11; |
when 'C' => |
digit := 12; |
when 'c' => |
digit := 12; |
when 'D' => |
digit := 13; |
when 'd' => |
digit := 13; |
when 'E' => |
digit := 14; |
when 'e' => |
digit := 14; |
when 'F' => |
digit := 15; |
when 'f' => |
digit := 15; |
when others => |
ASSERT FALSE |
REPORT "Illegal character "& str(i) & "in Intel Hex File! " |
SEVERITY ERROR; |
end case; |
ivalue := ivalue * 16 + digit; |
end loop; |
return ivalue; |
end; |
|
procedure Shrink_line(L : inout LINE; pos : in integer) is |
subtype nstring is string(1 to pos); |
variable stmp : nstring; |
begin |
if pos >= 1 then |
read(l, stmp); |
end if; |
end; |
|
end LPM_ROM; |
|
architecture LPM_SYN of lpm_rom is |
|
--type lpm_memory is array(lpm_numwords-1 downto 0) of std_logic_vector(lpm_width-1 downto 0); |
type lpm_memory is array(integer range (2**lpm_widthad)-1 downto 0) of std_logic_vector(lpm_width-1 downto 0); |
|
signal q2, q_tmp, q_reg : std_logic_vector(lpm_width-1 downto 0); |
signal address_tmp, address_reg : std_logic_vector(lpm_widthad-1 downto 0); |
|
begin |
|
enable_mem: process(memenab, q2) |
begin |
if (memenab = '1') then |
q <= q2; |
else |
q <= (OTHERS => 'Z'); |
end if; |
end process; |
|
sync: process(address, address_reg, q_tmp, q_reg) |
begin |
if (lpm_address_control = "REGISTERED") then |
address_tmp <= address_reg; |
else |
address_tmp <= address; |
end if; |
if (lpm_outdata = "REGISTERED") then |
q2 <= q_reg; |
else |
q2 <= q_tmp; |
end if; |
end process; |
|
input_reg: process (inclock) |
begin |
if inclock'event and inclock = '1' then |
address_reg <= address; |
end if; |
end process; |
|
output_reg: process (outclock) |
begin |
if outclock'event and outclock = '1' then |
q_reg <= q_tmp; |
end if; |
end process; |
|
memory: process(memenab, address_tmp) |
variable mem_data : lpm_memory; |
variable mem_data_tmp : integer := 0; |
variable mem_init: boolean := false; |
variable i, j, k, lineno : integer := 0; |
variable buf: line ; |
variable booval: boolean ; |
FILE mem_data_file: TEXT IS IN LPM_FILE; |
variable base, byte, rec_type, datain, addr, checksum: string(2 downto 1); |
variable startadd: string(4 downto 1); |
variable ibase: integer := 0; |
variable ibyte: integer := 0; |
variable istartadd: integer := 0; |
variable check_sum_vec, check_sum_vec_tmp: unsigned(7 downto 0); |
begin |
-- INITIALIZE -- |
if NOT(mem_init) then |
-- INITIALIZE TO 0 -- |
for i in mem_data'LOW to mem_data'HIGH loop |
mem_data(i) := (OTHERS => '0'); |
end loop; |
|
if (LPM_FILE = "UNUSED") then |
ASSERT FALSE |
REPORT "Initialization file not found!" |
SEVERITY ERROR; |
else |
WHILE NOT ENDFILE(mem_data_file) loop |
booval := true; |
READLINE(mem_data_file, buf); |
lineno := lineno + 1; |
check_sum_vec := (OTHERS => '0'); |
if (buf(buf'LOW) = ':') then |
i := 1; |
shrink_line(buf, i); |
READ(L=>buf, VALUE=>byte, good=>booval); |
if not (booval) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format!" |
SEVERITY ERROR; |
end if; |
ibyte := hex_str_to_int(byte); |
check_sum_vec := unsigned(check_sum_vec) + to_unsigned(ibyte, 8); |
READ(L=>buf, VALUE=>startadd, good=>booval); |
if not (booval) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format! " |
SEVERITY ERROR; |
end if; |
istartadd := hex_str_to_int(startadd); |
addr(2) := startadd(4); |
addr(1) := startadd(3); |
check_sum_vec := unsigned(check_sum_vec) + to_unsigned(hex_str_to_int(addr), check_sum_vec'length); |
addr(2) := startadd(2); |
addr(1) := startadd(1); |
check_sum_vec := unsigned(check_sum_vec) + to_unsigned(hex_str_to_int(addr), check_sum_vec'length); |
READ(L=>buf, VALUE=>rec_type, good=>booval); |
if not (booval) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format! " |
SEVERITY ERROR; |
end if; |
check_sum_vec := unsigned(check_sum_vec) + to_unsigned(hex_str_to_int(rec_type), check_sum_vec'length); |
else |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format! " |
SEVERITY ERROR; |
end if; |
case rec_type is |
when "00"=> -- Data record |
i := 0; |
k := lpm_width / 8; |
if ((lpm_width MOD 8) /= 0) then |
k := k + 1; |
end if; |
-- k = no. of bytes per CAM entry. |
while (i < ibyte) loop |
mem_data_tmp := 0; |
for j in 1 to k loop |
READ(L=>buf, VALUE=>datain,good=>booval); -- read in data a byte (2 hex chars) at a time. |
if not (booval) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format! " |
SEVERITY ERROR; |
end if; |
check_sum_vec := unsigned(check_sum_vec) + to_unsigned(hex_str_to_int(datain), check_sum_vec'length); |
mem_data_tmp := mem_data_tmp * 256 + hex_str_to_int(datain); |
end loop; |
i := i + k; |
mem_data(ibase + istartadd) := STD_LOGIC_VECTOR(to_unsigned(mem_data_tmp, lpm_width)); |
istartadd := istartadd + 1; |
end loop; |
when "01"=> |
exit; |
when "02"=> |
ibase := 0; |
if (ibyte /= 2) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format for record type 02! " |
SEVERITY ERROR; |
end if; |
for i in 0 to (ibyte-1) loop |
READ(L=>buf, VALUE=>base,good=>booval); |
ibase := ibase * 256 + hex_str_to_int(base); |
if not (booval) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format! " |
SEVERITY ERROR; |
end if; |
check_sum_vec := unsigned(check_sum_vec) + to_unsigned(hex_str_to_int(base), check_sum_vec'length); |
end loop; |
ibase := ibase * 16; |
when OTHERS => |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal record type in Intel Hex File! " |
SEVERITY ERROR; |
end case; |
READ(L=>buf, VALUE=>checksum,good=>booval); |
if not (booval) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Checksum is missing! " |
SEVERITY ERROR; |
end if; |
|
check_sum_vec := unsigned(not (check_sum_vec)) + 1 ; |
check_sum_vec_tmp := to_unsigned(hex_str_to_int(checksum),8); |
|
if (unsigned(check_sum_vec) /= unsigned(check_sum_vec_tmp)) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Incorrect checksum!" |
SEVERITY ERROR; |
end if; |
end loop; |
end if; |
mem_init := TRUE; |
end if; |
|
-- MEMORY FUNCTION -- |
--if memenab = '1' then |
q_tmp <= mem_data(to_integer(UNSIGNED(address_tmp))); |
--else |
-- q_tmp <= (OTHERS => 'Z'); |
--end if; |
end process; |
|
end LPM_SYN; |
|
|
--------------------------------------------------------------------------- |
|
|
-- pragma translate_off |
configuration lpm_rom_c0 of lpm_rom is |
|
for lpm_syn |
end for; |
|
end lpm_rom_c0; |
-- pragma translate_on |
/lpm_ram_dq.vhd
0,0 → 1,439
-------------------------------------------------------------------------- |
-- This VHDL file was developed by Altera Corporation. It may be |
-- freely copied and/or distributed at no cost. Any persons using this |
-- file for any purpose do so at their own risk, and are responsible for |
-- the results of such use. Altera Corporation does not guarantee that |
-- this file is complete, correct, or fit for any particular purpose. |
-- NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. This notice must |
-- accompany any copy of this file. |
-- |
-------------------------------------------------------------------------- |
-- LPM Synthesizable Models (Support string type generic) |
-------------------------------------------------------------------------- |
-- Version 2.0 (lpm 220) Date 01/04/00 |
-- |
-- 1. Fixed LPM_RAM_DQ, LPM_RAM_DP, LPM_RAM_IO and LPM_ROM to correctly |
-- read in values from LPM_FILE (*.hex) when the DATA width is greater |
-- than 16 bits. |
-- 2. Explicit sign conversions are added to standard logic vector |
-- comparisons in LPM_RAM_DQ, LPM_RAM_DP, LPM_RAM_IO, LPM_ROM, and |
-- LPM_COMPARE. |
-- 3. LPM_FIFO_DC is rewritten to have correct outputs. |
-- 4. LPM_FIFO outputs zeros when nothing has been read from it, and |
-- outputs LPM_NUMWORDS mod exp(2, LPM_WIDTHU) when it is full. |
-- 5. Fixed LPM_DIVIDE to divide correctly. |
-------------------------------------------------------------------------- |
-- Version 1.9 (lpm 220) Date 11/30/99 |
-- |
-- 1. Fixed UNUSED file not found problem and initialization problem |
-- with LPM_RAM_DP, LPM_RAM_DQ, and LPM_RAM_IO. |
-- 2. Fixed LPM_MULT when SUM port is not used. |
-- 3. Fixed LPM_FIFO_DC to enable read when rdclock and wrclock rise |
-- at the same time. |
-- 4. Fixed LPM_COUNTER comparison problem when signed library is loaded |
-- and counter is incrementing. |
-- 5. Got rid of "Illegal Character" error message at time = 0 ns when |
-- simulating LPM_COUNTER. |
-------------------------------------------------------------------------- |
-- Version 1.8 (lpm 220) Date 10/25/99 |
-- |
-- 1. Some LPM_PVALUE implementations were missing, and now implemented. |
-- 2. Fixed LPM_COUNTER to count correctly without conversion overflow, |
-- that is, when LPM_MODULUS = 2 ** LPM_WIDTH. |
-- 3. Fixed LPM_RAM_DP sync process sensitivity list to detect wraddress |
-- changes. |
-------------------------------------------------------------------------- |
-- Version 1.7 (lpm 220) Date 07/13/99 |
-- |
-- Changed LPM_RAM_IO so that it can be used to simulate both MP2 and |
-- Quartus behaviour and LPM220-compliant behaviour. |
-------------------------------------------------------------------------- |
-- Version 1.6 (lpm 220) Date 06/15/99 |
-- |
-- 1. Fixed LPM_ADD_SUB sign extension problem and subtraction bug. |
-- 2. Fixed LPM_COUNTER to use LPM_MODULUS value. |
-- 3. Added CIN and COUT port, and discarded EQ port in LPM_COUNTER to |
-- comply with the specfication. |
-- 4. Included LPM_RAM_DP, LPM_RAM_DQ, LPM_RAM_IO, LPM_ROM, LPM_FIFO, and |
-- LPM_FIFO_DC; they are all initialized to 0's. |
-------------------------------------------------------------------------- |
-- Version 1.5 (lpm 220) Date 05/10/99 |
-- |
-- Changed LPM_MODULUS from string type to integer. |
-------------------------------------------------------------------------- |
-- Version 1.4 (lpm 220) Date 02/05/99 |
-- |
-- 1. Added LPM_DIVIDE module. |
-- 2. Added CLKEN port to LPM_MUX, LPM_DECODE, LPM_ADD_SUB, LPM_MULT |
-- and LPM_COMPARE |
-- 3. Replaced the constants holding string with the actual string. |
-------------------------------------------------------------------------- |
-- Version 1.3 Date 07/30/96 |
-- |
-- Modification History |
-- |
-- 1. Changed the DEFAULT value to "UNUSED" for LPM_SVALUE, LPM_AVALUE, |
-- LPM_MODULUS, and LPM_NUMWORDS, LPM_HINT,LPM_STRENGTH, LPM_DIRECTION, |
-- and LPM_PVALUE |
-- |
-- 2. Added the two dimentional port components (AND, OR, XOR, and MUX). |
-------------------------------------------------------------------------- |
-- Excluded Functions: |
-- |
-- LPM_FSM and LPM_TTABLE |
-- |
-------------------------------------------------------------------------- |
-- Assumptions: |
-- |
-- 1. All ports and signal types are std_logic or std_logic_vector |
-- from IEEE 1164 package. |
-- 2. Synopsys std_logic_arith, std_logic_unsigned, and std_logic_signed |
-- package are assumed to be accessible from IEEE library. |
-- 3. lpm_component_package must be accessible from library work. |
-- 4. The default value of LPM_SVALUE, LPM_AVALUE, LPM_MODULUS, LPM_HINT, |
-- LPM_NUMWORDS, LPM_STRENGTH, LPM_DIRECTION, and LPM_PVALUE is |
-- string "UNUSED". |
-------------------------------------------------------------------------- |
|
library IEEE; |
use IEEE.std_logic_1164.all; |
use IEEE.numeric_std.all; |
--use IEEE.std_logic_unsigned.all; |
use std.textio.all; |
|
entity LPM_RAM_DQ is |
generic (LPM_WIDTH : positive; |
LPM_WIDTHAD : positive; |
LPM_NUMWORDS : natural := 0; |
LPM_INDATA : string := "REGISTERED"; |
LPM_ADDRESS_CONTROL: string := "REGISTERED"; |
LPM_OUTDATA : string := "REGISTERED"; |
LPM_FILE : string := "UNUSED"; |
LPM_TYPE : string := "LPM_RAM_DQ"; |
LPM_HINT : string := "UNUSED"); |
port (DATA : in std_logic_vector(LPM_WIDTH-1 downto 0); |
ADDRESS : in std_logic_vector(LPM_WIDTHAD-1 downto 0); |
INCLOCK : in std_logic := '0'; |
OUTCLOCK : in std_logic := '0'; |
WE : in std_logic; |
Q : out std_logic_vector(LPM_WIDTH-1 downto 0)); |
|
function int_to_str( value : integer ) return string is |
variable ivalue,index : integer; |
variable digit : integer; |
variable line_no: string(8 downto 1) := " "; |
begin |
ivalue := value; |
index := 1; |
while (ivalue > 0) loop |
digit := ivalue MOD 10; |
ivalue := ivalue/10; |
case digit is |
when 0 => |
line_no(index) := '0'; |
when 1 => |
line_no(index) := '1'; |
when 2 => |
line_no(index) := '2'; |
when 3 => |
line_no(index) := '3'; |
when 4 => |
line_no(index) := '4'; |
when 5 => |
line_no(index) := '5'; |
when 6 => |
line_no(index) := '6'; |
when 7 => |
line_no(index) := '7'; |
when 8 => |
line_no(index) := '8'; |
when 9 => |
line_no(index) := '9'; |
when others => |
ASSERT FALSE |
REPORT "Illegal number!" |
SEVERITY ERROR; |
end case; |
index := index + 1; |
end loop; |
return line_no; |
end; |
|
function hex_str_to_int( str : string ) return integer is |
variable len : integer := str'length; |
variable ivalue : integer := 0; |
variable digit : integer; |
begin |
for i in len downto 1 loop |
case str(i) is |
when '0' => |
digit := 0; |
when '1' => |
digit := 1; |
when '2' => |
digit := 2; |
when '3' => |
digit := 3; |
when '4' => |
digit := 4; |
when '5' => |
digit := 5; |
when '6' => |
digit := 6; |
when '7' => |
digit := 7; |
when '8' => |
digit := 8; |
when '9' => |
digit := 9; |
when 'A' => |
digit := 10; |
when 'a' => |
digit := 10; |
when 'B' => |
digit := 11; |
when 'b' => |
digit := 11; |
when 'C' => |
digit := 12; |
when 'c' => |
digit := 12; |
when 'D' => |
digit := 13; |
when 'd' => |
digit := 13; |
when 'E' => |
digit := 14; |
when 'e' => |
digit := 14; |
when 'F' => |
digit := 15; |
when 'f' => |
digit := 15; |
when others => |
ASSERT FALSE |
REPORT "Illegal character "& str(i) & "in Intel Hex File! " |
SEVERITY ERROR; |
end case; |
ivalue := ivalue * 16 + digit; |
end loop; |
return ivalue; |
end; |
|
procedure Shrink_line(L : inout LINE; pos : in integer) is |
subtype nstring is string(1 to pos); |
variable stmp : nstring; |
begin |
if pos >= 1 then |
read(l, stmp); |
end if; |
end; |
|
end LPM_RAM_DQ; |
|
architecture LPM_SYN of lpm_ram_dq is |
|
--type lpm_memory is array(lpm_numwords-1 downto 0) of std_logic_vector(lpm_width-1 downto 0); |
type lpm_memory is array(integer range (2**lpm_widthad)-1 downto 0) of std_logic_vector(lpm_width-1 downto 0); |
|
signal data_tmp, data_reg : std_logic_vector(lpm_width-1 downto 0); |
signal q_tmp, q_reg : std_logic_vector(lpm_width-1 downto 0) := (others => '0'); |
signal address_tmp, address_reg : std_logic_vector(lpm_widthad-1 downto 0); |
signal we_tmp, we_reg : std_logic; |
|
begin |
|
sync: process(data, data_reg, address, address_reg, |
we, we_reg, q_tmp, q_reg) |
begin |
if (lpm_address_control = "REGISTERED") then |
address_tmp <= address_reg; |
we_tmp <= we_reg; |
else |
address_tmp <= address; |
we_tmp <= we; |
end if; |
if (lpm_indata = "REGISTERED") then |
data_tmp <= data_reg; |
else |
data_tmp <= data; |
end if; |
if (lpm_outdata = "REGISTERED") then |
q <= q_reg; |
else |
q <= q_tmp; |
end if; |
end process; |
|
input_reg: process (inclock) |
begin |
if inclock'event and inclock = '1' then |
data_reg <= data; |
address_reg <= address; |
we_reg <= we; |
end if; |
end process; |
|
output_reg: process (outclock) |
begin |
if outclock'event and outclock = '1' then |
q_reg <= q_tmp; |
end if; |
end process; |
|
memory: process(data_tmp, we_tmp, address_tmp) |
variable mem_data : lpm_memory; |
variable mem_data_tmp : integer := 0; |
variable mem_init: boolean := false; |
variable i,j,k,lineno: integer := 0; |
variable buf: line ; |
variable booval: boolean ; |
FILE unused_file: TEXT IS OUT "UNUSED"; |
FILE mem_data_file: TEXT IS IN LPM_FILE; |
variable base, byte, rec_type, datain, addr, checksum: string(2 downto 1); |
variable startadd: string(4 downto 1); |
variable ibase: integer := 0; |
variable ibyte: integer := 0; |
variable istartadd: integer := 0; |
variable check_sum_vec, check_sum_vec_tmp: unsigned(7 downto 0); |
begin |
-- INITIALIZE -- |
if NOT(mem_init) then |
-- INITIALIZE TO 0 -- |
for i in mem_data'LOW to mem_data'HIGH loop |
mem_data(i) := (OTHERS => '0'); |
end loop; |
|
if (LPM_FILE = "UNUSED") then |
ASSERT FALSE |
REPORT "Initialization file not found!" |
SEVERITY WARNING; |
else |
WHILE NOT ENDFILE(mem_data_file) loop |
booval := true; |
READLINE(mem_data_file, buf); |
lineno := lineno + 1; |
check_sum_vec := (OTHERS => '0'); |
if (buf(buf'LOW) = ':') then |
i := 1; |
shrink_line(buf, i); |
READ(L=>buf, VALUE=>byte, good=>booval); |
if not (booval) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format!" |
SEVERITY ERROR; |
end if; |
ibyte := hex_str_to_int(byte); |
check_sum_vec := unsigned(check_sum_vec) + to_unsigned(ibyte, check_sum_vec'length); |
READ(L=>buf, VALUE=>startadd, good=>booval); |
if not (booval) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format! " |
SEVERITY ERROR; |
end if; |
istartadd := hex_str_to_int(startadd); |
addr(2) := startadd(4); |
addr(1) := startadd(3); |
check_sum_vec := unsigned(check_sum_vec) + to_unsigned(hex_str_to_int(addr), check_sum_vec'length); |
addr(2) := startadd(2); |
addr(1) := startadd(1); |
check_sum_vec := unsigned(check_sum_vec) + to_unsigned(hex_str_to_int(addr), check_sum_vec'length); |
READ(L=>buf, VALUE=>rec_type, good=>booval); |
if not (booval) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format! " |
SEVERITY ERROR; |
end if; |
check_sum_vec := unsigned(check_sum_vec) + to_unsigned(hex_str_to_int(rec_type), check_sum_vec'length); |
else |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format! " |
SEVERITY ERROR; |
end if; |
case rec_type is |
when "00"=> -- Data record |
i := 0; |
k := lpm_width / 8; |
if ((lpm_width MOD 8) /= 0) then |
k := k + 1; |
end if; |
-- k = no. of bytes per CAM entry. |
while (i < ibyte) loop |
mem_data_tmp := 0; |
for j in 1 to k loop |
READ(L=>buf, VALUE=>datain,good=>booval); -- read in data a byte (2 hex chars) at a time. |
if not (booval) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format! " |
SEVERITY ERROR; |
end if; |
check_sum_vec := unsigned(check_sum_vec) + to_unsigned(hex_str_to_int(datain), check_sum_vec'length); |
mem_data_tmp := mem_data_tmp * 256 + hex_str_to_int(datain); |
end loop; |
i := i + k; |
mem_data(ibase + istartadd) := STD_LOGIC_VECTOR(to_unsigned(mem_data_tmp, lpm_width)); |
istartadd := istartadd + 1; |
end loop; |
when "01"=> |
exit; |
when "02"=> |
ibase := 0; |
if (ibyte /= 2) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format for record type 02! " |
SEVERITY ERROR; |
end if; |
for i in 0 to (ibyte-1) loop |
READ(L=>buf, VALUE=>base,good=>booval); |
ibase := ibase * 256 + hex_str_to_int(base); |
if not (booval) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal Intel Hex Format! " |
SEVERITY ERROR; |
end if; |
check_sum_vec := unsigned(check_sum_vec) + to_unsigned(hex_str_to_int(base), check_sum_vec'length); |
end loop; |
ibase := ibase * 16; |
when OTHERS => |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Illegal record type in Intel Hex File! " |
SEVERITY ERROR; |
end case; |
READ(L=>buf, VALUE=>checksum,good=>booval); |
if not (booval) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Checksum is missing! " |
SEVERITY ERROR; |
end if; |
|
check_sum_vec := unsigned(not (check_sum_vec)) + 1 ; |
check_sum_vec_tmp := to_unsigned(hex_str_to_int(checksum), check_sum_vec_tmp'length); |
|
if (unsigned(check_sum_vec) /= unsigned(check_sum_vec_tmp)) then |
ASSERT FALSE |
REPORT "[Line "& int_to_str(lineno) & "]:Incorrect checksum!" |
SEVERITY ERROR; |
end if; |
end loop; |
end if; |
mem_init := TRUE; |
end if; |
|
-- MEMORY FUNCTION -- |
if we_tmp = '1' then |
mem_data (to_integer(unsigned(address_tmp))) := data_tmp; |
end if; |
q_tmp <= mem_data(to_integer(unsigned(address_tmp))); |
end process; |
|
end LPM_SYN; |
|
|
-- pragma translate_off |
configuration lpm_ram_dq_c0 of lpm_ram_dq is |
|
for lpm_syn |
end for; |
|
end lpm_ram_dq_c0; |
-- pragma translate_on |
/t8039-c.vhd
0,0 → 1,23
------------------------------------------------------------------------------- |
-- |
-- T8039 Microcontroller System |
-- |
-- $Id: t8039-c.vhd,v 1.2 2004-12-03 19:43:12 arniml Exp $ |
-- |
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
------------------------------------------------------------------------------- |
|
configuration t8039_struct_c0 of t8039 is |
|
for struct |
|
for t8039_notri_b : t8039_notri |
use configuration work.t8039_notri_struct_c0; |
end for; |
|
end for; |
|
end t8039_struct_c0; |
/t8048-c.vhd
0,0 → 1,23
------------------------------------------------------------------------------- |
-- |
-- T8048 Microcontroller System |
-- |
-- $Id: t8048-c.vhd,v 1.2 2004-12-01 23:09:47 arniml Exp $ |
-- |
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org) |
-- |
-- All rights reserved |
-- |
------------------------------------------------------------------------------- |
|
configuration t8048_struct_c0 of t8048 is |
|
for struct |
|
for t8048_notri_b : t8048_notri |
use configuration work.t8048_notri_struct_c0; |
end for; |
|
end for; |
|
end t8048_struct_c0; |