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

Subversion Repositories mlite

[/] [mlite/] [trunk/] [vhdl/] [pc_next.vhd] - Blame information for rev 128

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 128 rhoads
   signal pc_reg : std_logic_vector(31 downto 2);
30 2 rhoads
begin
31
 
32
pc_next: process(clk, reset_in, pc_new, take_branch, pause_in,
33 6 rhoads
                 opcode25_0, pc_source, pc_reg)
34 2 rhoads
   variable pc_inc, pc_next : std_logic_vector(31 downto 2);
35
begin
36
   pc_inc := bv_increment(pc_reg);  --pc_reg+1
37 76 rhoads
 
38 2 rhoads
   case pc_source is
39 128 rhoads
   when FROM_INC4 =>
40 76 rhoads
      pc_next := pc_inc;
41 128 rhoads
   when FROM_OPCODE25_0 =>
42 2 rhoads
      pc_next := pc_reg(31 downto 28) & opcode25_0;
43 128 rhoads
   when FROM_BRANCH | FROM_LBRANCH =>
44 2 rhoads
      if take_branch = '1' then
45
         pc_next := pc_new;
46
      else
47
         pc_next := pc_inc;
48
      end if;
49 128 rhoads
   when others =>
50
      pc_next := pc_inc;
51 2 rhoads
   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.