OpenCores
URL https://opencores.org/ocsvn/avr_hp/avr_hp/trunk

Subversion Repositories avr_hp

[/] [avr_hp/] [trunk/] [rtl/] [rtl_orig/] [io_reg_file.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tobil
--************************************************************************************************
2
-- Internal I/O registers (implemented inside the core) decoder/multiplexer 
3
-- for AVR core
4
-- Version 1.3 (Special version for the JTAG OCD)
5
-- Designed by Ruslan Lepetenok
6
-- Modified 22.04.2004
7
--************************************************************************************************
8
 
9
library IEEE;
10
use IEEE.std_logic_1164.all;
11
use IEEE.std_logic_unsigned.all;
12
 
13
use WORK.AVRuCPackage.all;
14
 
15
entity io_reg_file is port (
16
                                    --Clock and reset
17
                                cp2           : in std_logic;
18
                                                        cp2en         : in std_logic;
19
                            ireset        : in std_logic;
20
 
21
                            adr           : in std_logic_vector(5 downto 0);
22
                            iowe          : in std_logic;
23
                            dbusout       : in std_logic_vector(7 downto 0);
24
 
25
                            sreg_fl_in    : in std_logic_vector(7 downto 0);
26
                            sreg_out      : out std_logic_vector(7 downto 0);
27
 
28
                            sreg_fl_wr_en : in  std_logic_vector (7 downto 0);   --FLAGS WRITE ENABLE SIGNALS       
29
 
30
                            spl_out       : out std_logic_vector(7 downto 0);
31
                            sph_out       : out std_logic_vector(7 downto 0);
32
                            sp_ndown_up   : in std_logic; -- DIRECTION OF CHANGING OF STACK POINTER SPH:SPL 0->UP(+) 1->DOWN(-)
33
                            sp_en         : in std_logic; -- WRITE ENABLE(COUNT ENABLE) FOR SPH AND SPL REGISTERS
34
 
35
                            rampz_out    : out std_logic_vector(7 downto 0));
36
end io_reg_file;
37
 
38
architecture rtl of io_reg_file is
39
signal sreg    : std_logic_vector(7 downto 0);
40
signal sph     : std_logic_vector(7 downto 0);
41
signal spl     : std_logic_vector(7 downto 0);
42
signal rampz   : std_logic_vector(7 downto 0);
43
 
44
signal sp_int  : std_logic_vector(15 downto 0);
45
signal sp_intp : std_logic_vector(15 downto 0);
46
signal sp_intm : std_logic_vector(15 downto 0);
47
signal sp_res : std_logic_vector(15 downto 0);
48
 
49
 
50
begin
51
 
52
sreg_write:process(cp2,ireset)
53
begin
54
if ireset='0' then
55
sreg <= (others => '0');
56
elsif (cp2='1' and cp2'event) then
57
 if (cp2en='1') then                                                      -- Clock enable       
58
  for i in sreg'range loop
59
   if (sreg_fl_wr_en(i)='1' or (adr=SREG_Address and iowe='1')) then    -- CLOCK ENABLE
60
    if iowe='1' then
61
     sreg(i) <= dbusout(i);                        -- FROM THE INTERNAL DATA BUS
62
    else
63
     sreg(i) <= sreg_fl_in(i);                  -- FROM ALU FLAGS
64
    end if;
65
   end if;
66
  end loop;
67
 end if;
68
end if;
69
end process;
70
 
71
sreg_out <= sreg;
72
 
73
 
74
sp_intp<=(sph&spl)+1;
75
sp_intm<=(sph&spl)-1;
76
sp_res<= sp_intm when sp_ndown_up='0' else sp_intp;
77
 
78
spl_write:process(cp2,ireset)
79
begin
80
if ireset='0' then
81
spl <= (others => '0');
82
elsif (cp2='1' and cp2'event) then
83
if (sp_en='1' or (adr=SPL_Address and iowe='1')) then    -- CLOCK ENABLE
84
 if iowe='1' then
85
  spl <= dbusout;                                        -- FROM THE INTERNAL DATA BUS
86
   else
87
    spl <= sp_res(7 downto 0);                          -- FROM SPL BUS
88
     end if;
89
 end if;
90
 
91
end if;
92
end process;
93
 
94
spl_out <= spl;
95
 
96
sph_write:process(cp2,ireset)
97
begin
98
if ireset='0' then
99
sph <= (others => '0');
100
elsif (cp2='1' and cp2'event) then
101
if (sp_en='1' or (adr=SPH_Address and iowe='1')) then    -- CLOCK ENABLE
102
 if iowe='1' then
103
  sph <= dbusout;                        -- FROM THE INTERNAL DATA BUS
104
   else
105
    sph <= sp_res(15 downto 8);                          -- FROM SPH BUS
106
     end if;
107
 end if;
108
 
109
end if;
110
end process;
111
 
112
sph_out <= sph;
113
 
114
 
115
rampz_write:process(cp2,ireset)
116
begin
117
if ireset='0' then
118
rampz <= (others => '0');
119
elsif (cp2='1' and cp2'event) then
120
if (adr=RAMPZ_Address and iowe='1') then    -- CLOCK ENABLE
121
  rampz <= dbusout;                      -- FROM THE INTERNAL DATA BUS
122
 end if;
123
end if;
124
end process;
125
 
126
rampz_out <= rampz;
127
 
128
end rtl;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.