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

Subversion Repositories avr_hp

[/] [avr_hp/] [trunk/] [rtl/] [rtl_s3_cm2/] [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_cm2 is port (
16
                cp2_cml_1 : in std_logic;
17
 
18
                                    --Clock and reset
19
                                cp2           : in std_logic;
20
                                                        cp2en         : in std_logic;
21
                            ireset        : in std_logic;
22
 
23
                            adr           : in std_logic_vector(5 downto 0);
24
                            iowe          : in std_logic;
25
                            dbusout       : in std_logic_vector(7 downto 0);
26
 
27
                            sreg_fl_in    : in std_logic_vector(7 downto 0);
28
                            sreg_out      : out std_logic_vector(7 downto 0);
29
 
30
                            sreg_fl_wr_en : in  std_logic_vector (7 downto 0);   --FLAGS WRITE ENABLE SIGNALS       
31
 
32
                            spl_out       : out std_logic_vector(7 downto 0);
33
                            sph_out       : out std_logic_vector(7 downto 0);
34
                            sp_ndown_up   : in std_logic; -- DIRECTION OF CHANGING OF STACK POINTER SPH:SPL 0->UP(+) 1->DOWN(-)
35
                            sp_en         : in std_logic; -- WRITE ENABLE(COUNT ENABLE) FOR SPH AND SPL REGISTERS
36
 
37
                            rampz_out    : out std_logic_vector(7 downto 0));
38
end io_reg_file_cm2;
39
 
40
architecture rtl of io_reg_file_cm2 is
41
signal sreg    : std_logic_vector(7 downto 0);
42
signal sph     : std_logic_vector(7 downto 0);
43
signal spl     : std_logic_vector(7 downto 0);
44
signal rampz   : std_logic_vector(7 downto 0);
45
 
46
signal sp_int  : std_logic_vector(15 downto 0);
47
signal sp_intp : std_logic_vector(15 downto 0);
48
signal sp_intm : std_logic_vector(15 downto 0);
49
signal sp_res : std_logic_vector(15 downto 0);
50
 
51
 
52
signal adr_cml_1 :  std_logic_vector ( 5 downto 0 );
53
signal sreg_cml_1 :  std_logic_vector ( 7 downto 0 );
54
signal sph_cml_1 :  std_logic_vector ( 7 downto 0 );
55
signal spl_cml_1 :  std_logic_vector ( 7 downto 0 );
56
signal rampz_cml_1 :  std_logic_vector ( 7 downto 0 );
57
 
58
begin
59
 
60
 
61
 
62
process(cp2_cml_1) begin
63
if (cp2_cml_1 = '1' and cp2_cml_1'event) then
64
        adr_cml_1 <= adr;
65
        sreg_cml_1 <= sreg;
66
        sph_cml_1 <= sph;
67
        spl_cml_1 <= spl;
68
        rampz_cml_1 <= rampz;
69
end if;
70
end process;
71
 
72
 
73
-- SynEDA CoreMultiplier
74
-- assignment(s): sreg
75
-- replace(s): adr, sreg
76
 
77
sreg_write:process(cp2,ireset)
78
begin
79
if ireset='0' then
80
sreg <= (others => '0');
81
elsif (cp2='1' and cp2'event) then sreg <= sreg_cml_1;
82
 if (cp2en='1') then                                                      -- Clock enable       
83
  for i in sreg'range loop
84
   if (sreg_fl_wr_en(i)='1' or (adr_cml_1=SREG_Address and iowe='1')) then    -- CLOCK ENABLE
85
    if iowe='1' then
86
     sreg(i) <= dbusout(i);                        -- FROM THE INTERNAL DATA BUS
87
    else
88
     sreg(i) <= sreg_fl_in(i);                  -- FROM ALU FLAGS
89
    end if;
90
   end if;
91
  end loop;
92
 end if;
93
end if;
94
end process;
95
 
96
sreg_out <= sreg;
97
 
98
 
99
-- SynEDA CoreMultiplier
100
-- assignment(s): sp_intp
101
-- replace(s): sph, spl
102
 
103
sp_intp<=(sph_cml_1&spl_cml_1)+1;
104
-- SynEDA CoreMultiplier
105
-- assignment(s): sp_intm
106
-- replace(s): sph, spl
107
 
108
sp_intm<=(sph_cml_1&spl_cml_1)-1;
109
sp_res<= sp_intm when sp_ndown_up='0' else sp_intp;
110
 
111
-- SynEDA CoreMultiplier
112
-- assignment(s): spl
113
-- replace(s): adr, spl
114
 
115
spl_write:process(cp2,ireset)
116
begin
117
if ireset='0' then
118
spl <= (others => '0');
119
elsif (cp2='1' and cp2'event) then spl <= spl_cml_1;
120
if (sp_en='1' or (adr_cml_1=SPL_Address and iowe='1')) then    -- CLOCK ENABLE
121
 if iowe='1' then
122
  spl <= dbusout;                                        -- FROM THE INTERNAL DATA BUS
123
   else
124
    spl <= sp_res(7 downto 0);                          -- FROM SPL BUS
125
     end if;
126
 end if;
127
 
128
end if;
129
end process;
130
 
131
spl_out <= spl;
132
 
133
-- SynEDA CoreMultiplier
134
-- assignment(s): sph
135
-- replace(s): adr, sph
136
 
137
sph_write:process(cp2,ireset)
138
begin
139
if ireset='0' then
140
sph <= (others => '0');
141
elsif (cp2='1' and cp2'event) then sph <= sph_cml_1;
142
if (sp_en='1' or (adr_cml_1=SPH_Address and iowe='1')) then    -- CLOCK ENABLE
143
 if iowe='1' then
144
  sph <= dbusout;                        -- FROM THE INTERNAL DATA BUS
145
   else
146
    sph <= sp_res(15 downto 8);                          -- FROM SPH BUS
147
     end if;
148
 end if;
149
 
150
end if;
151
end process;
152
 
153
sph_out <= sph;
154
 
155
 
156
-- SynEDA CoreMultiplier
157
-- assignment(s): rampz
158
-- replace(s): adr, rampz
159
 
160
rampz_write:process(cp2,ireset)
161
begin
162
if ireset='0' then
163
rampz <= (others => '0');
164
elsif (cp2='1' and cp2'event) then rampz <= rampz_cml_1;
165
if (adr_cml_1=RAMPZ_Address and iowe='1') then    -- CLOCK ENABLE
166
  rampz <= dbusout;                      -- FROM THE INTERNAL DATA BUS
167
 end if;
168
end if;
169
end process;
170
 
171
rampz_out <= rampz;
172
 
173
end rtl;

powered by: WebSVN 2.1.0

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