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

Subversion Repositories plasma

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

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
   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 76 rhoads
 
40 2 rhoads
   case pc_source is
41
   when from_inc4 =>
42 76 rhoads
      pc_next := pc_inc;
43 2 rhoads
   when from_opcode25_0 =>
44
      pc_next := pc_reg(31 downto 28) & opcode25_0;
45 47 rhoads
   when others =>   --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
   end case;
52 76 rhoads
 
53
   if pause_in = '1' then
54
      pc_next := pc_reg;
55
   end if;
56
 
57 2 rhoads
   if reset_in = '1' then
58 59 rhoads
      pc_reg <= ZERO(31 downto 2);
59
   elsif rising_edge(clk) then
60 2 rhoads
      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.