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 24

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

Line No. Rev Author Line
1 24 fpga_is_fu
-- VHDL Entity R6502_TC.Reg_SP.symbol
2
--
3
-- Created:
4
--          by - eda.UNKNOWN (ENTW1)
5
--          at - 14:13:51 08.03.2010
6
--
7
-- Generated by Mentor Graphics' HDL Designer(TM) 2009.1 (Build 12)
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_low_i   : IN     std_logic_vector (7 DOWNTO 0);
16
      clk_clk_i   : IN     std_logic;
17
      ld_low_i    : IN     std_logic;
18
      ld_sp_i     : IN     std_logic;
19
      rst_rst_n_i : IN     std_logic;
20
      sel_sp_as_i : IN     std_logic;
21
      sel_sp_in_i : IN     std_logic;
22
      adr_sp_o    : OUT    std_logic_vector (15 DOWNTO 0)
23
   );
24
 
25
-- Declarations
26
 
27
END Reg_SP ;
28
 
29
-- Jens-D. Gutschmidt     Project:  R6502_TC  
30
-- scantara2003@yahoo.de                      
31
-- COPYRIGHT (C) 2008-2010 by Jens Gutschmidt and OPENCORES.ORG                                                                                
32
--                                                                                                                                             
33
-- 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   
34
-- the Free Software Foundation, either version 3 of the License, or any later version.                                                        
35
--                                                                                                                                             
36
-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of              
37
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.                                  
38
--                                                                                                                                             
39
-- You should have received a copy of the GNU General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>.     
40
--                                                                                                                                             
41
-- CVS Revisins History                                                                                                                        
42
--                                                                                                                                             
43
-- $Log: struct.bd,v $                                                                                                                         
44
--   <<-- more -->>                                                                                                                            
45
-- Title:  Stack Pointer Logic  
46
-- Path:  R6502_TC/Reg_SP/struct  
47
-- Edited:  by eda on 21 Feb 2010  
48
--
49
-- VHDL Architecture R6502_TC.Reg_SP.struct
50
--
51
-- Created:
52
--          by - eda.UNKNOWN (ENTW1)
53
--          at - 14:13:52 08.03.2010
54
--
55
-- Generated by Mentor Graphics' HDL Designer(TM) 2009.1 (Build 12)
56
--
57
LIBRARY ieee;
58
USE ieee.std_logic_1164.all;
59
USE ieee.std_logic_arith.all;
60
 
61
 
62
ARCHITECTURE struct OF Reg_SP IS
63
 
64
   -- Architecture declarations
65
 
66
   -- Internal signal declarations
67
   SIGNAL adr_sp_low_o_i  : std_logic_vector(7 DOWNTO 0);
68
   SIGNAL load_o_i        : std_logic;
69
   SIGNAL result_low1_o_i : std_logic_vector(7 DOWNTO 0);
70
   SIGNAL result_low_o_i  : std_logic_vector(7 DOWNTO 0);
71
   SIGNAL sp_as_n_o_i     : std_logic;
72
   SIGNAL val_one         : std_logic_vector(7 DOWNTO 0);
73
 
74
   -- Implicit buffer signal declarations
75
   SIGNAL adr_sp_o_internal : std_logic_vector (15 DOWNTO 0);
76
 
77
 
78
   -- ModuleWare signal declarations(v1.9) for instance 'U_0' of 'adff'
79
   SIGNAL mw_U_0reg_cval : std_logic_vector(7 DOWNTO 0);
80
 
81
 
82
BEGIN
83
 
84
   -- ModuleWare code(v1.9) for instance 'U_11' of 'addsub'
85
   u_11combo_proc: PROCESS (adr_sp_low_o_i, val_one, sp_as_n_o_i)
86
   VARIABLE temp_din0 : std_logic_vector(8 DOWNTO 0);
87
   VARIABLE temp_din1 : std_logic_vector(8 DOWNTO 0);
88
   VARIABLE temp_sum : unsigned(8 DOWNTO 0);
89
   VARIABLE temp_carry : std_logic;
90
   BEGIN
91
      temp_din0 := '0' & adr_sp_low_o_i;
92
      temp_din1 := '0' & val_one;
93
      temp_carry := '0';
94
      IF (sp_as_n_o_i = '1') THEN
95
         temp_sum := unsigned(temp_din0) + unsigned(temp_din1) + temp_carry;
96
      ELSE
97
         temp_sum := unsigned(temp_din0) - unsigned(temp_din1) - temp_carry;
98
      END IF;
99
      result_low_o_i <= conv_std_logic_vector(temp_sum(7 DOWNTO 0),8);
100
   END PROCESS u_11combo_proc;
101
 
102
   -- ModuleWare code(v1.9) for instance 'U_0' of 'adff'
103
   adr_sp_o_internal(7 DOWNTO 0) <= mw_U_0reg_cval;
104
   u_0seq_proc: PROCESS (clk_clk_i, rst_rst_n_i)
105
   BEGIN
106
      IF (rst_rst_n_i = '0') THEN
107
         mw_U_0reg_cval <= "00000000";
108
      ELSIF (clk_clk_i'EVENT AND clk_clk_i='1') THEN
109
         IF (load_o_i = '1') THEN
110
            mw_U_0reg_cval <= result_low1_o_i;
111
         END IF;
112
      END IF;
113
   END PROCESS u_0seq_proc;
114
 
115
   -- ModuleWare code(v1.9) for instance 'U_6' of 'and'
116
   load_o_i <= ld_sp_i AND ld_low_i;
117
 
118
   -- ModuleWare code(v1.9) for instance 'U_3' of 'buff'
119
   adr_sp_o_internal(15 DOWNTO 8) <= val_one;
120
 
121
   -- ModuleWare code(v1.9) for instance 'U_4' of 'constval'
122
   val_one <= "00000001";
123
 
124
   -- ModuleWare code(v1.9) for instance 'U_2' of 'inv'
125
   sp_as_n_o_i <= NOT(sel_sp_as_i);
126
 
127
   -- ModuleWare code(v1.9) for instance 'U_8' of 'mux'
128
   u_8combo_proc: PROCESS(result_low_o_i, adr_low_i, sel_sp_in_i)
129
   BEGIN
130
      CASE sel_sp_in_i IS
131
      WHEN '0' => result_low1_o_i <= result_low_o_i;
132
      WHEN '1' => result_low1_o_i <= adr_low_i;
133
      WHEN OTHERS => result_low1_o_i <= (OTHERS => 'X');
134
      END CASE;
135
   END PROCESS u_8combo_proc;
136
 
137
   -- ModuleWare code(v1.9) for instance 'U_10' of 'tap'
138
   adr_sp_low_o_i <= adr_sp_o_internal(7 DOWNTO 0);
139
 
140
   -- Instance port mappings.
141
 
142
   -- Implicit buffered output assignments
143
   adr_sp_o <= adr_sp_o_internal;
144
 
145
END struct;

powered by: WebSVN 2.1.0

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