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

Subversion Repositories avr_hp

[/] [avr_hp/] [trunk/] [rtl/] [rtl_v5_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 sreg_cml_1 :  std_logic_vector ( 7 downto 0 );
53
signal sph_out_cml_out :  std_logic_vector ( 7 downto 0 );
54
signal sph_cml_1 :  std_logic_vector ( 7 downto 0 );
55
signal spl_out_cml_out :  std_logic_vector ( 7 downto 0 );
56
signal spl_cml_1 :  std_logic_vector ( 7 downto 0 );
57
signal rampz_out_cml_out :  std_logic_vector ( 7 downto 0 );
58
signal rampz_cml_1 :  std_logic_vector ( 7 downto 0 );
59
 
60
begin
61
 
62
 
63
 
64
process(cp2_cml_1) begin
65
if (cp2_cml_1 = '1' and cp2_cml_1'event) then
66
        sreg_cml_1 <= sreg;
67
        sph_cml_1 <= sph;
68
        spl_cml_1 <= spl;
69
        rampz_cml_1 <= rampz;
70
end if;
71
end process;
72
sph_out <= sph_out_cml_out;
73
spl_out <= spl_out_cml_out;
74
rampz_out <= rampz_out_cml_out;
75
 
76
 
77
-- SynEDA CoreMultiplier
78
-- assignment(s): sreg
79
-- replace(s): sreg
80
 
81
sreg_write:process(cp2,ireset)
82
begin
83
if ireset='0' then
84
sreg <= (others => '0');
85
elsif (cp2='1' and cp2'event) then sreg <= sreg_cml_1;
86
 if (cp2en='1') then                                                      -- Clock enable       
87
  for i in sreg'range loop
88
   if (sreg_fl_wr_en(i)='1' or (adr=SREG_Address and iowe='1')) then    -- CLOCK ENABLE
89
    if iowe='1' then
90
     sreg(i) <= dbusout(i);                        -- FROM THE INTERNAL DATA BUS
91
    else
92
     sreg(i) <= sreg_fl_in(i);                  -- FROM ALU FLAGS
93
    end if;
94
   end if;
95
  end loop;
96
 end if;
97
end if;
98
end process;
99
 
100
sreg_out <= sreg;
101
 
102
 
103
-- SynEDA CoreMultiplier
104
-- assignment(s): sp_intp
105
-- replace(s): sph, spl
106
 
107
sp_intp<=(sph_cml_1&spl_cml_1)+1;
108
-- SynEDA CoreMultiplier
109
-- assignment(s): sp_intm
110
-- replace(s): sph, spl
111
 
112
sp_intm<=(sph_cml_1&spl_cml_1)-1;
113
sp_res<= sp_intm when sp_ndown_up='0' else sp_intp;
114
 
115
-- SynEDA CoreMultiplier
116
-- assignment(s): spl
117
-- replace(s): spl
118
 
119
spl_write:process(cp2,ireset)
120
begin
121
if ireset='0' then
122
spl <= (others => '0');
123
elsif (cp2='1' and cp2'event) then spl <= spl_cml_1;
124
if (sp_en='1' or (adr=SPL_Address and iowe='1')) then    -- CLOCK ENABLE
125
 if iowe='1' then
126
  spl <= dbusout;                                        -- FROM THE INTERNAL DATA BUS
127
   else
128
    spl <= sp_res(7 downto 0);                          -- FROM SPL BUS
129
     end if;
130
 end if;
131
 
132
end if;
133
end process;
134
 
135
-- SynEDA CoreMultiplier
136
-- assignment(s): spl_out
137
-- replace(s): spl
138
 
139
spl_out_cml_out <= spl_cml_1;
140
 
141
-- SynEDA CoreMultiplier
142
-- assignment(s): sph
143
-- replace(s): sph
144
 
145
sph_write:process(cp2,ireset)
146
begin
147
if ireset='0' then
148
sph <= (others => '0');
149
elsif (cp2='1' and cp2'event) then sph <= sph_cml_1;
150
if (sp_en='1' or (adr=SPH_Address and iowe='1')) then    -- CLOCK ENABLE
151
 if iowe='1' then
152
  sph <= dbusout;                        -- FROM THE INTERNAL DATA BUS
153
   else
154
    sph <= sp_res(15 downto 8);                          -- FROM SPH BUS
155
     end if;
156
 end if;
157
 
158
end if;
159
end process;
160
 
161
-- SynEDA CoreMultiplier
162
-- assignment(s): sph_out
163
-- replace(s): sph
164
 
165
sph_out_cml_out <= sph_cml_1;
166
 
167
 
168
-- SynEDA CoreMultiplier
169
-- assignment(s): rampz
170
-- replace(s): rampz
171
 
172
rampz_write:process(cp2,ireset)
173
begin
174
if ireset='0' then
175
rampz <= (others => '0');
176
elsif (cp2='1' and cp2'event) then rampz <= rampz_cml_1;
177
if (adr=RAMPZ_Address and iowe='1') then    -- CLOCK ENABLE
178
  rampz <= dbusout;                      -- FROM THE INTERNAL DATA BUS
179
 end if;
180
end if;
181
end process;
182
 
183
-- SynEDA CoreMultiplier
184
-- assignment(s): rampz_out
185
-- replace(s): rampz
186
 
187
rampz_out_cml_out <= rampz_cml_1;
188
 
189
end rtl;

powered by: WebSVN 2.1.0

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