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

Subversion Repositories mlite

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

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
   case pc_source is
40
   when from_inc4 =>
41
      if pause_in = '0' then
42
         pc_next := pc_inc;
43 47 rhoads
      else
44
             pc_next := pc_reg;
45 2 rhoads
      end if;
46
   when from_opcode25_0 =>
47
      pc_next := pc_reg(31 downto 28) & opcode25_0;
48 47 rhoads
   when others =>   --from_branch | from_lbranch =>
49 2 rhoads
      if take_branch = '1' then
50
         pc_next := pc_new;
51
      else
52
         pc_next := pc_inc;
53
      end if;
54
   end case;
55
   if reset_in = '1' then
56 59 rhoads
      pc_reg <= ZERO(31 downto 2);
57
   elsif rising_edge(clk) then
58 2 rhoads
      pc_reg <= pc_next;
59
   end if;
60
 
61
   pc_out <= pc_reg & "00";
62 6 rhoads
   pc_out_plus4 <= pc_inc & "00";
63 2 rhoads
end process;
64
 
65
end; --logic
66
 

powered by: WebSVN 2.1.0

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