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

Subversion Repositories cpu65c02_true_cycle

[/] [cpu65c02_true_cycle/] [trunk/] [released/] [rtl/] [v2_00/] [vhdl/] [reg_pc.vhd] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 fpga_is_fu
LIBRARY ieee;
2
USE ieee.std_logic_1164.all;
3
USE ieee.std_logic_arith.all;
4
 
5
entity reg_pc is
6
   port(
7
      adr_i        : in     std_logic_vector (15 downto 0);
8
      clk_clk_i    : in     std_logic;
9
      ld_i         : in     std_logic_vector (1 downto 0);
10
      ld_pc_i      : in     std_logic;
11
      offset_i     : in     std_logic_vector (15 downto 0);
12
      rst_rst_n_i  : in     std_logic;
13
      sel_pc_in_i  : in     std_logic;
14
      sel_pc_val_i : in     std_logic_vector (1 downto 0);
15
      adr_nxt_pc_o : out    std_logic_vector (15 downto 0);
16
      adr_pc_o     : out    std_logic_vector (15 downto 0)
17
   );
18
 
19
-- Declarations
20
 
21
end reg_pc ;
22
-- (C) 2008 - 2021 Jens Gutschmidt
23
-- (email: opencores@vivare-services.com)
24
-- 
25
-- Versions:
26
-- Revision 1.8  2021/01/10 17:40:00  jens
27
-- - Performance improvements
28
-- 
29
-- Revision 1.7  2013/07/21 11:11:00  jens
30
-- - Changing the title block and internal revision history
31
-- 
32
-- Revision 1.6  2009/01/04 10:20:47  eda
33
-- Changes for cosmetic issues only
34
-- 
35
-- Revision 1.5  2009/01/04 09:23:10  eda
36
-- - Delete unused nets and blocks (same as R6502_TC)
37
-- - Rename blocks
38
-- 
39
-- Revision 1.4  2009/01/03 16:53:02  eda
40
-- - Unused nets and blocks deleted
41
-- - Renamed blocks
42
-- 
43
-- Revision 1.3  2009/01/03 16:42:02  eda
44
-- - Unused nets and blocks deleted
45
-- - Renamed blocks
46
-- 
47
-- Revision 1.2  2008/12/31 19:31:24  eda
48
-- Production Release
49
--  
50
-- 
51
--
52
-- r65c02_tc.reg_pc.struct
53
--
54
-- Date:    14.01.2021
55
-- Time:    16:34:05
56
-- By:        VIVARE GmbH, Switzerland
57
--
58
-- COPYRIGHT (C) 2008 - 2021 by Jens Gutschmidt
59
-- 
60
-- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
61
-- 
62
-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
63
-- 
64
-- You should have received a copy of the GNU General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>.
65
-- 
66
-- 
67
LIBRARY ieee;
68
USE ieee.std_logic_1164.all;
69
USE ieee.std_logic_arith.all;
70
 
71
 
72
architecture struct of reg_pc is
73
 
74
   -- Architecture declarations
75
 
76
   -- Internal signal declarations
77
   signal adr_pc_high_o_i : std_logic_vector(7 downto 0);
78
   signal adr_pc_low_o_i  : std_logic_vector(7 downto 0);
79
   signal adr_pc_o_i      : std_logic_vector(15 downto 0);
80
   signal cout_pc_o_i     : std_logic;
81
   signal load3_o_i       : std_logic;
82
   signal load_o_i        : std_logic;
83
   signal offset_high_o_i : std_logic_vector(7 downto 0);
84
   signal offset_low_o_i  : std_logic_vector(7 downto 0);
85
   signal val_o_i         : std_logic_vector(7 downto 0);
86
   signal val_one         : std_logic_vector(7 downto 0);
87
   signal val_zero        : std_logic_vector(7 downto 0);
88
 
89
   -- Implicit buffer signal declarations
90
   signal adr_nxt_pc_o_internal : std_logic_vector (15 downto 0);
91
   signal adr_pc_o_internal     : std_logic_vector (15 downto 0);
92
 
93
 
94
   -- ModuleWare signal declarations(v1.12) for instance 'U_0' of 'adff'
95
   signal mw_U_0reg_cval : std_logic_vector(7 downto 0);
96
 
97
   -- ModuleWare signal declarations(v1.12) for instance 'U_4' of 'adff'
98
   signal mw_U_4reg_cval : std_logic_vector(15 downto 8);
99
 
100
   -- ModuleWare signal declarations(v1.12) for instance 'U_3' of 'split'
101
   signal mw_U_3temp_din : std_logic_vector(15 downto 0);
102
 
103
   -- ModuleWare signal declarations(v1.12) for instance 'U_5' of 'split'
104
   signal mw_U_5temp_din : std_logic_vector(15 downto 0);
105
 
106
 
107
begin
108
 
109
   -- ModuleWare code(v1.12) for instance 'U_2' of 'add'
110
   u_2combo_proc: process (adr_pc_low_o_i, val_o_i)
111
   variable temp_din0 : std_logic_vector(8 downto 0);
112
   variable temp_din1 : std_logic_vector(8 downto 0);
113
   variable temp_sum : unsigned(8 downto 0);
114
   variable temp_carry : std_logic;
115
   begin
116
      temp_din0 := '0' & adr_pc_low_o_i;
117
      temp_din1 := '0' & val_o_i;
118
      temp_carry := '0';
119
      temp_sum := unsigned(temp_din0) + unsigned(temp_din1) + temp_carry;
120
      adr_nxt_pc_o_internal(7 DOWNTO 0) <= conv_std_logic_vector(temp_sum(7 downto 0),8);
121
      cout_pc_o_i <= temp_sum(8) ;
122
   end process u_2combo_proc;
123
 
124
   -- ModuleWare code(v1.12) for instance 'U_11' of 'add'
125
   u_11combo_proc: process (adr_pc_high_o_i, offset_high_o_i, cout_pc_o_i)
126
   variable temp_din0 : std_logic_vector(8 downto 0);
127
   variable temp_din1 : std_logic_vector(8 downto 0);
128
   variable temp_sum : unsigned(8 downto 0);
129
   variable temp_carry : std_logic;
130
   begin
131
      temp_din0 := '0' & adr_pc_high_o_i;
132
      temp_din1 := '0' & offset_high_o_i;
133
      temp_carry := cout_pc_o_i;
134
      temp_sum := unsigned(temp_din0) + unsigned(temp_din1) + temp_carry;
135
      adr_nxt_pc_o_internal(15 DOWNTO 8) <= conv_std_logic_vector(temp_sum(7 downto 0),8);
136
   end process u_11combo_proc;
137
 
138
   -- ModuleWare code(v1.12) for instance 'U_0' of 'adff'
139
   adr_pc_o_internal(7 DOWNTO 0) <= mw_U_0reg_cval;
140
   u_0seq_proc: process (clk_clk_i, rst_rst_n_i)
141
   begin
142
      if (rst_rst_n_i = '0') then
143
         mw_U_0reg_cval <= "00000000";
144
      elsif (clk_clk_i'event and clk_clk_i='1') then
145
         if (load_o_i = '1') then
146
            mw_U_0reg_cval <= adr_nxt_pc_o_internal(7 DOWNTO 0);
147
         end if;
148
      end if;
149
   end process u_0seq_proc;
150
 
151
   -- ModuleWare code(v1.12) for instance 'U_4' of 'adff'
152
   adr_pc_o_internal(15 DOWNTO 8) <= mw_U_4reg_cval;
153
   u_4seq_proc: process (clk_clk_i, rst_rst_n_i)
154
   begin
155
      if (rst_rst_n_i = '0') then
156
         mw_U_4reg_cval <= "00000000";
157
      elsif (clk_clk_i'event and clk_clk_i='1') then
158
         if (load3_o_i = '1') then
159
            mw_U_4reg_cval <= adr_nxt_pc_o_internal(15 DOWNTO 8);
160
         end if;
161
      end if;
162
   end process u_4seq_proc;
163
 
164
   -- ModuleWare code(v1.12) for instance 'U_6' of 'and'
165
   load_o_i <= ld_pc_i and ld_i(0);
166
 
167
   -- ModuleWare code(v1.12) for instance 'U_7' of 'and'
168
   load3_o_i <= ld_pc_i and ld_i(1);
169
 
170
   -- ModuleWare code(v1.12) for instance 'U_1' of 'constval'
171
   val_zero <= "00000000";
172
 
173
   -- ModuleWare code(v1.12) for instance 'U_9' of 'constval'
174
   val_one <= "00000001";
175
 
176
   -- ModuleWare code(v1.12) for instance 'U_8' of 'mux'
177
   u_8combo_proc: process(adr_pc_o_internal, adr_i, sel_pc_in_i)
178
   begin
179
      case sel_pc_in_i is
180
      when '0' => adr_pc_o_i <= adr_pc_o_internal;
181
      when '1' => adr_pc_o_i <= adr_i;
182
      when others => adr_pc_o_i <= (others => 'X');
183
      end case;
184
   end process u_8combo_proc;
185
 
186
   -- ModuleWare code(v1.12) for instance 'U_13' of 'mux'
187
   u_13combo_proc: process(val_one, val_zero, offset_low_o_i,
188
                           sel_pc_val_i)
189
   begin
190
      case sel_pc_val_i is
191
      when "00" => val_o_i <= val_one;
192
      when "01" => val_o_i <= val_zero;
193
      when "10" => val_o_i <= offset_low_o_i;
194
      when "11" => val_o_i <= val_zero;
195
      when others => val_o_i <= (others => 'X');
196
      end case;
197
   end process u_13combo_proc;
198
 
199
   -- ModuleWare code(v1.12) for instance 'U_3' of 'split'
200
   mw_U_3temp_din <= adr_pc_o_i;
201
   u_3combo_proc: process (mw_U_3temp_din)
202
   variable temp_din: std_logic_vector(15 downto 0);
203
   begin
204
      temp_din := mw_U_3temp_din(15 downto 0);
205
      adr_pc_low_o_i <= temp_din(7 downto 0);
206
      adr_pc_high_o_i <= temp_din(15 downto 8);
207
   end process u_3combo_proc;
208
 
209
   -- ModuleWare code(v1.12) for instance 'U_5' of 'split'
210
   mw_U_5temp_din <= offset_i;
211
   u_5combo_proc: process (mw_U_5temp_din)
212
   variable temp_din: std_logic_vector(15 downto 0);
213
   begin
214
      temp_din := mw_U_5temp_din(15 downto 0);
215
      offset_low_o_i <= temp_din(7 downto 0);
216
      offset_high_o_i <= temp_din(15 downto 8);
217
   end process u_5combo_proc;
218
 
219
   -- Instance port mappings.
220
 
221
   -- Implicit buffered output assignments
222
   adr_nxt_pc_o <= adr_nxt_pc_o_internal;
223
   adr_pc_o     <= adr_pc_o_internal;
224
 
225
end struct;

powered by: WebSVN 2.1.0

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