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

Subversion Repositories plasma

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

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
-- PROJECT: MIPS CPU core
7
-- 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
use work.mips_pack.all;
15
 
16
entity pc_next is
17
   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 6 rhoads
        pc_out       : out std_logic_vector(31 downto 0);
25
        pc_out_plus4 : out std_logic_vector(31 downto 0));
26 2 rhoads
end; --pc_next
27
 
28
architecture logic of pc_next is
29
--   type pc_source_type is (from_inc4, from_opcode25_0, from_branch, 
30
--      from_lbranch);
31
   signal pc_reg : std_logic_vector(31 downto 2); --:= ZERO(31 downto 2);
32
begin
33
 
34
pc_next: process(clk, reset_in, pc_new, take_branch, pause_in,
35 6 rhoads
                 opcode25_0, pc_source, pc_reg)
36 2 rhoads
   variable pc_inc, pc_next : std_logic_vector(31 downto 2);
37
begin
38
   pc_inc := bv_increment(pc_reg);  --pc_reg+1
39
   pc_next := pc_reg;
40
   case pc_source is
41
   when from_inc4 =>
42
      if pause_in = '0' then
43
         pc_next := pc_inc;
44
      end if;
45
   when from_opcode25_0 =>
46
      pc_next := pc_reg(31 downto 28) & opcode25_0;
47
   when from_branch | from_lbranch =>
48
      if take_branch = '1' then
49
         pc_next := pc_new;
50
      else
51
         pc_next := pc_inc;
52
      end if;
53
   when others =>
54
   end case;
55
   if reset_in = '1' then
56
      pc_next := ZERO(31 downto 2);
57
   end if;
58
 
59
   if rising_edge(clk) then
60
      pc_reg <= pc_next;
61
   end if;
62
 
63
   pc_out <= pc_reg & "00";
64 6 rhoads
   pc_out_plus4 <= pc_inc & "00";
65 2 rhoads
end process;
66
 
67
end; --logic
68
 

powered by: WebSVN 2.1.0

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