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

Subversion Repositories plasma

[/] [plasma/] [trunk/] [vhdl/] [pc_next.vhd] - Blame information for rev 366

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

Line No. Rev Author Line
1 2 rhoads
---------------------------------------------------------------------
2
-- TITLE: Program Counter Next
3
-- AUTHOR: Steve Rhoads (rhoadss@yahoo.com)
4
-- DATE CREATED: 2/8/01
5
-- FILENAME: pc_next.vhd
6 43 rhoads
-- PROJECT: Plasma CPU core
7 2 rhoads
-- COPYRIGHT: Software placed into the public domain by the author.
8
--    Software 'as is' without warranty.  Author liable for nothing.
9
-- DESCRIPTION:
10
--    Implements the Program Counter logic.
11
---------------------------------------------------------------------
12
library ieee;
13
use ieee.std_logic_1164.all;
14 39 rhoads
use work.mlite_pack.all;
15 2 rhoads
 
16
entity pc_next is
17 139 rhoads
   port(clk         : in std_logic;
18
        reset_in    : in std_logic;
19
        pc_new      : in std_logic_vector(31 downto 2);
20
        take_branch : in std_logic;
21
        pause_in    : in std_logic;
22
        opcode25_0  : in std_logic_vector(25 downto 0);
23
        pc_source   : in pc_source_type;
24
        pc_future   : out std_logic_vector(31 downto 2);
25
        pc_current  : out std_logic_vector(31 downto 2);
26
        pc_plus4    : out std_logic_vector(31 downto 2));
27 2 rhoads
end; --pc_next
28
 
29
architecture logic of pc_next is
30 128 rhoads
   signal pc_reg : std_logic_vector(31 downto 2);
31 2 rhoads
begin
32
 
33 139 rhoads
pc_select: process(clk, reset_in, pc_new, take_branch, pause_in,
34 6 rhoads
                 opcode25_0, pc_source, pc_reg)
35 139 rhoads
   variable pc_inc      : std_logic_vector(31 downto 2);
36
   variable pc_next : std_logic_vector(31 downto 2);
37 2 rhoads
begin
38
   pc_inc := bv_increment(pc_reg);  --pc_reg+1
39 76 rhoads
 
40 2 rhoads
   case pc_source is
41 128 rhoads
   when FROM_INC4 =>
42 76 rhoads
      pc_next := pc_inc;
43 128 rhoads
   when FROM_OPCODE25_0 =>
44 2 rhoads
      pc_next := pc_reg(31 downto 28) & opcode25_0;
45 128 rhoads
   when FROM_BRANCH | FROM_LBRANCH =>
46 2 rhoads
      if take_branch = '1' then
47
         pc_next := pc_new;
48
      else
49
         pc_next := pc_inc;
50
      end if;
51 128 rhoads
   when others =>
52
      pc_next := pc_inc;
53 2 rhoads
   end case;
54 76 rhoads
 
55
   if pause_in = '1' then
56
      pc_next := pc_reg;
57
   end if;
58
 
59 2 rhoads
   if reset_in = '1' then
60 59 rhoads
      pc_reg <= ZERO(31 downto 2);
61 139 rhoads
      pc_next := pc_reg;
62 59 rhoads
   elsif rising_edge(clk) then
63 2 rhoads
      pc_reg <= pc_next;
64
   end if;
65
 
66 139 rhoads
   pc_future <= pc_next;
67
   pc_current <= pc_reg;
68
   pc_plus4 <= pc_inc;
69 2 rhoads
end process;
70
 
71
end; --logic

powered by: WebSVN 2.1.0

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