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

Subversion Repositories cpu6502_true_cycle

[/] [cpu6502_true_cycle/] [trunk/] [rtl/] [vhdl/] [reg_sp.vhd] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 fpga_is_fu
-- VHDL Entity R6502_TC.Reg_SP.symbol
2
--
3
-- Created:
4
--          by - eda.UNKNOWN (ENTWICKL4-XP-PR)
5
--          at - 19:06:53 08.04.2008
6
--
7
-- Generated by Mentor Graphics' HDL Designer(TM) 2007.1a (Build 13)
8
--
9
LIBRARY ieee;
10
USE ieee.std_logic_1164.all;
11
USE ieee.std_logic_arith.all;
12
 
13
entity Reg_SP is
14
   port(
15
      adr_i        : in     std_logic_vector (15 downto 0);
16
      clk_clk_i    : in     std_logic;
17
      ld_i         : in     std_logic_vector (1 downto 0);
18
      ld_sp_i      : in     std_logic;
19
      rst_rst_i    : in     std_logic;
20
      sel_sp_as_i  : in     std_logic;
21
      sel_sp_in_i  : in     std_logic;
22
      sel_sp_val_i : in     std_logic;
23
      adr_nxt_sp_o : out    std_logic_vector (15 downto 0);
24
      adr_sp_o     : out    std_logic_vector (15 downto 0)
25
   );
26
 
27
-- Declarations
28
 
29
end Reg_SP ;
30
 
31
-- Jens-D. Gutschmidt     Project:  R6502_TC  
32
-- scantara2003@yahoo.de                      
33
-- COPYRIGHT (C) 2008 by Jens Gutschmidt and OPENCORES.ORG                                                                                     
34
--                                                                                                                                             
35
-- 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   
36
-- the Free Software Foundation, either version 3 of the License, or any later version.                                                        
37
--                                                                                                                                             
38
-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of              
39
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.                                  
40
--                                                                                                                                             
41
-- You should have received a copy of the GNU General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>.     
42
--                                                                                                                                             
43
-- CVS Revisins History                                                                                                                        
44
--                                                                                                                                             
45
-- $Log: not supported by cvs2svn $                                                                                                                                       
46
--                                                                                                                                             
47
-- Title:  Stack Pointer Logic  
48
-- Path:  R6502_TC/Reg_SP/struct  
49
-- Edited:  by eda on 08 Apr 2008  
50
--
51
-- VHDL Architecture R6502_TC.Reg_SP.struct
52
--
53
-- Created:
54
--          by - eda.UNKNOWN (ENTWICKL4-XP-PR)
55
--          at - 19:06:53 08.04.2008
56
--
57
-- Generated by Mentor Graphics' HDL Designer(TM) 2007.1a (Build 13)
58
--
59
LIBRARY ieee;
60
USE ieee.std_logic_1164.all;
61
USE ieee.std_logic_arith.all;
62
 
63
 
64
architecture struct of Reg_SP is
65
 
66
   -- Architecture declarations
67
 
68
   -- Internal signal declarations
69
   signal d        : std_logic_vector(7 downto 0);
70
   signal dout1    : std_logic_vector(7 downto 0);
71
   signal dout2    : std_logic_vector(7 downto 0);
72
   signal dout3    : std_logic;
73
   signal load     : std_logic;
74
   signal load3    : std_logic;
75
   signal val_one  : std_logic_vector(7 downto 0);
76
   signal val_two  : std_logic_vector(7 downto 0);
77
   signal val_zero : std_logic_vector(7 downto 0);
78
 
79
   -- Implicit buffer signal declarations
80
   signal adr_sp_o_internal : std_logic_vector (15 downto 0);
81
 
82
 
83
   -- ModuleWare signal declarations(v1.9) for instance 'U_0' of 'adff'
84
   signal mw_U_0reg_cval : std_logic_vector(7 downto 0);
85
 
86
   -- ModuleWare signal declarations(v1.9) for instance 'U_4' of 'adff'
87
   signal mw_U_4reg_cval : std_logic_vector(7 downto 0);
88
 
89
 
90
begin
91
   -- Architecture concurrent statements
92
   -- HDL Embedded Text Block 2 eb2
93
   -- eb1 1
94
   val_zero (7 downto 0) <= X"00";
95
   val_one (7 downto 0) <= X"01";
96
   val_two (7 downto 0) <= X"02";
97
   adr_nxt_sp_o (15 downto 8) <= X"01";
98
 
99
   -- HDL Embedded Text Block 3 eb3
100
   -- eb1 1
101
   adr_nxt_sp_o (7 DOWNTO 0) <= d;
102
 
103
 
104
   -- ModuleWare code(v1.9) for instance 'U_11' of 'addsub'
105
   u_11combo_proc: process (adr_sp_o_internal(7 DOWNTO 0), dout1, dout3, val_zero(0))
106
   variable temp_din0 : std_logic_vector(8 downto 0);
107
   variable temp_din1 : std_logic_vector(8 downto 0);
108
   variable temp_sum : unsigned(8 downto 0);
109
   variable temp_carry : std_logic;
110
   begin
111
      temp_din0 := '0' & adr_sp_o_internal(7 DOWNTO 0);
112
      temp_din1 := '0' & dout1;
113
      temp_carry := val_zero(0);
114
      if (dout3 = '1') then
115
         temp_sum := unsigned(temp_din0) + unsigned(temp_din1) + temp_carry;
116
      else
117
         temp_sum := unsigned(temp_din0) - unsigned(temp_din1) - temp_carry;
118
      end if;
119
      dout2 <= conv_std_logic_vector(temp_sum(7 downto 0),8);
120
   end process u_11combo_proc;
121
 
122
   -- ModuleWare code(v1.9) for instance 'U_0' of 'adff'
123
   adr_sp_o_internal(7 DOWNTO 0) <= mw_U_0reg_cval;
124
   u_0seq_proc: process (clk_clk_i, rst_rst_i)
125
   begin
126
      if (rst_rst_i = '1') then
127
         mw_U_0reg_cval <= "00000000";
128
      elsif (clk_clk_i'event and clk_clk_i='1') then
129
         if (load = '1') then
130
            mw_U_0reg_cval <= d;
131
         end if;
132
      end if;
133
   end process u_0seq_proc;
134
 
135
   -- ModuleWare code(v1.9) for instance 'U_4' of 'adff'
136
   adr_sp_o_internal(15 DOWNTO 8) <= mw_U_4reg_cval;
137
   u_4seq_proc: process (clk_clk_i, rst_rst_i)
138
   begin
139
      if (rst_rst_i = '1') then
140
         mw_U_4reg_cval <= "00000000";
141
      elsif (clk_clk_i'event and clk_clk_i='1') then
142
         if (load3 = '1') then
143
            mw_U_4reg_cval <= val_one;
144
         end if;
145
      end if;
146
   end process u_4seq_proc;
147
 
148
   -- ModuleWare code(v1.9) for instance 'U_6' of 'and'
149
   load <= ld_sp_i and ld_i(0);
150
 
151
   -- ModuleWare code(v1.9) for instance 'U_7' of 'and'
152
   load3 <= ld_sp_i and ld_i(1);
153
 
154
   -- ModuleWare code(v1.9) for instance 'U_2' of 'inv'
155
   dout3 <= not(sel_sp_as_i);
156
 
157
   -- ModuleWare code(v1.9) for instance 'U_5' of 'mux'
158
   u_5combo_proc: process(val_one, val_two, sel_sp_val_i)
159
   begin
160
      case sel_sp_val_i is
161
      when '0' => dout1 <= val_one;
162
      when '1' => dout1 <= val_two;
163
      when others => dout1 <= (others => 'X');
164
      end case;
165
   end process u_5combo_proc;
166
 
167
   -- ModuleWare code(v1.9) for instance 'U_8' of 'mux'
168
   u_8combo_proc: process(dout2, adr_i(7 DOWNTO 0), sel_sp_in_i)
169
   begin
170
      case sel_sp_in_i is
171
      when '0' => d <= dout2;
172
      when '1' => d <= adr_i(7 DOWNTO 0);
173
      when others => d <= (others => 'X');
174
      end case;
175
   end process u_8combo_proc;
176
 
177
   -- Instance port mappings.
178
 
179
   -- Implicit buffered output assignments
180
   adr_sp_o <= adr_sp_o_internal;
181
 
182
end struct;

powered by: WebSVN 2.1.0

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