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

Subversion Repositories c16

[/] [c16/] [trunk/] [vhdl/] [opcode_fetch.vhd] - Blame information for rev 26

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 jsauermann
library IEEE;
2
use IEEE.STD_LOGIC_1164.ALL;
3
use IEEE.STD_LOGIC_ARITH.ALL;
4
use IEEE.STD_LOGIC_UNSIGNED.ALL;
5
 
6
--  Uncomment the following lines to use the declarations that are
7
--  provided for instantiating Xilinx primitive components.
8
--library UNISIM;
9
--use UNISIM.VComponents.all;
10
 
11
use work.cpu_pack.ALL;
12
 
13
entity opcode_fetch is
14
        Port(   CLK_I  : in  std_logic;
15
                        T2     : in  std_logic;
16
                        CLR    : in  std_logic;
17
                        CE     : in  std_logic;
18
                        PC_OP  : in  std_logic_vector( 2 downto 0);
19
                        JDATA  : in  std_logic_vector(15 downto 0);
20
                        RR     : in  std_logic_vector(15 downto 0);
21
                        RDATA  : in  std_logic_vector( 7 downto 0);
22
 
23
                        PC     : out std_logic_vector(15 downto 0)
24
                );
25
end opcode_fetch;
26
 
27
architecture Behavioral of opcode_fetch is
28
 
29
        signal  LPC  : std_logic_vector(15 downto 0);
30
        signal  LRET : std_logic_vector( 7 downto 0);
31
 
32
begin
33
 
34
        PC <= LPC;
35
 
36 21 jsauermann
        process(CLK_I, CLR)
37 2 jsauermann
        begin
38 21 jsauermann
                if (CLR = '1') then
39
                        LPC     <= X"0000";
40
                elsif ((rising_edge(CLK_I) and T2 = '1') and CE = '1' ) then
41
                        case PC_OP is
42
                                when PC_NEXT =>         LPC  <= LPC + 1;                -- next address
43
                                when PC_JMP  =>         LPC  <= JDATA;                  -- jump address
44
                                when PC_RETL =>         LRET <= RDATA;                  -- return address L
45
                                                                        LPC  <= LPC + 1;
46
                                when PC_RETH =>         LPC  <= RDATA & LRET;   -- return address H
47
                                when PC_JPRR =>         LPC  <= RR;
48
                                when PC_WAIT =>
49
 
50
                                when others  =>         LPC  <= X"0008";                -- interrupt
51
                        end case;
52 2 jsauermann
                end if;
53
        end process;
54 21 jsauermann
 
55 2 jsauermann
end Behavioral;

powered by: WebSVN 2.1.0

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