OpenCores
URL https://opencores.org/ocsvn/am9080_cpu_based_on_microcoded_am29xx_bit-slices/am9080_cpu_based_on_microcoded_am29xx_bit-slices/trunk

Subversion Repositories am9080_cpu_based_on_microcoded_am29xx_bit-slices

[/] [am9080_cpu_based_on_microcoded_am29xx_bit-slices/] [trunk/] [Am9080/] [Am29XX/] [am2909.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 zpekic
-- VERSION: 1.0
2
-- MODULE: am2909
3
-- 13/1/2010
4
-- ************************************************************
5
-- Copyright (C) Stanisalw Deniziak
6
 
7
library ieee;
8
use ieee.std_logic_1164.all;
9
use ieee.numeric_std.all;
10
 
11
entity am2909 is
12
        port
13
        (
14
                -- Input ports
15
                S : in std_logic_vector(1 downto 0);
16
                R,D     : in std_logic_vector(3 downto 0);
17
                ORi     : in std_logic_vector(3 downto 0);
18
                nFE, PUP, nRE , nZERO, nOE, CN : in std_logic;
19
                CLK  : in std_logic;
20
                -- Output ports
21
                Y       : out std_logic_vector(3 downto 0);
22
                C4      : out std_logic
23
        );
24
end am2909;
25
 
26
architecture RTL of am2909 is
27
signal  XX, AR, F, PC, YY : std_logic_vector(3 downto 0);
28
begin
29
 
30
Sel: process (S, AR, F, PC, D)
31
begin
32
case S(1 downto 0) is
33
        when "00" =>
34
                XX <= PC;
35
        when "01" =>
36
                XX <= AR;
37
        when "10" =>
38
                XX <= F;
39
        when "11" =>
40
                XX <= D;
41
        when others =>
42
                null;
43
        end case;
44
end process;
45
 
46
stos: process (CLK)
47
variable STK0, STK1, STK2, STK3: std_logic_vector(3 downto 0);
48
begin
49
if (rising_edge(clk)) then
50
   if (nFE = '0') then
51
     if PUP = '0' then
52
        STK0 := STK1;
53
        STK1 := STK2;
54
        STK2 := STK3;
55
     else
56
        STK3 := STK2;
57
        STK2 := STK1;
58
        STK1 := STK0;
59
        STK0 := PC;
60
     end if;
61
    end if;
62
 end if;
63
 F <= STK0;
64
end process;
65
 
66
AReg: process (clk)
67
begin
68
if (rising_edge(clk)) then
69
  if nRE = '0' then
70
    AR <= R;
71
  end if;
72
 end if;
73
end process;
74
 
75
uPC: process (CLK, YY, CN)
76
variable res    : std_logic_vector(5 downto 0);
77
variable PCint  : std_logic_vector(5 downto 0);
78
begin
79
    PCint := '0' & YY & CN;
80
    res := std_logic_vector(unsigned(PCint) + 1);
81
    C4 <= res(5);
82
    if (rising_edge(clk)) then
83
      PC <= res(4 downto 1);
84
    end if;
85
end process;
86
 
87
output: process (nOE, nZERO, XX, ORi, YY)
88
begin
89
        if (nZERO = '0') then
90
                YY <= "0000";
91
        else
92
                YY <= XX or ORi;
93
        end if;
94
 
95
        if (nOE = '0') then
96
                Y <= YY;
97
        else
98
                Y <= "ZZZZ";
99
        end if;
100
 
101
end process;
102
 
103
end RTL;
104
 

powered by: WebSVN 2.1.0

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