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

Subversion Repositories minimips_superscalar

[/] [minimips_superscalar/] [trunk/] [sources/] [pps_pf.vhd] - Blame information for rev 24

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

Line No. Rev Author Line
1 7 mcafruni
--------------------------------------------------------------------------
2
--                                                                      --
3
--                                                                      --
4
-- miniMIPS Superscalar Processor : Address calculation stage           --
5
-- based on miniMIPS Processor                                          --
6
--                                                                      --
7
--                                                                      --
8
-- Author : Miguel Cafruni                                              --
9
-- miguel_cafruni@hotmail.com                                           --
10
--                                                      December 2018   --
11
--------------------------------------------------------------------------
12
 
13
 
14
library IEEE;
15
use IEEE.std_logic_1164.all;
16
use IEEE.numeric_std.all;
17
 
18
library work;
19
use work.pack_mips.all;
20
 
21
entity pps_pf is
22
port (
23
    clock       : in bus1;
24
    clock2      : in bus1;
25
    reset       : in bus1;
26
    stop_all    : in bus1;      -- Unconditionnal locking of the pipeline stage
27
    stop_all2    : in bus1;
28
 
29
    -- Asynchronous inputs
30
    bra_cmd     : in bus1;      -- Branch
31
    bra_adr     : in bus32;     -- Address to load when an effective branch
32
    exch_cmd    : in bus1;      -- Exception branch
33
    exch_adr    : in bus32;     -- Exception vector
34
    -- Asynchronous inputs 2
35
    bra_cmd2     : in bus1;     -- Branch
36
    bra_adr2     : in bus32;    -- Address to load when an effective branch
37
    exch_cmd2    : in bus1;     -- Exception branch
38
    exch_adr2    : in bus32;    -- Exception vector      
39
 
40
    stop_pf     : in bus1;      -- Lock the stage
41
    stop_pf2     : in bus1;     -- Lock the stage
42
    -- Synchronous output to EI stage
43
    PF_pc       : out bus32;     -- PC value
44
    PF_pc_4     : out bus32      -- PC+4 value
45
);
46
end pps_pf;
47
 
48
architecture rtl of pps_pf is
49
 
50
    signal suivant : bus32;     -- Preparation of the future pc
51
    signal suivant4 : bus32;    -- Preparation of the future pc
52
    signal pc_interne : bus32;  -- Value of the pc output, needed for an internal reading
53
    signal pc_interne4 : bus32; -- Value of the pc output, needed for an internal reading
54
    signal lock : bus1;         -- Specify the authorization of the pc evolution
55
    signal lock2 : bus1;        -- independente para o pipe 2, 06.02.18                 
56
 
57
begin
58
    -- Connexion the pc to the internal pc
59
    PF_pc <= pc_interne;
60
    PF_pc_4 <= pc_interne4;
61
 
62
    -- Elaboration of an potential future pc                            
63
    suivant <= exch_adr when exch_cmd  = '1'  else
64
               bra_adr  when bra_cmd   = '1'  else
65
               bus32(unsigned(pc_interne) + 8);
66
 
67
   suivant4 <= bus32(unsigned(exch_adr2) + 4) when exch_cmd2 = '1' else
68
                    bra_adr2 when bra_cmd2   = '1' else
69
                    bus32(unsigned(pc_interne4) + 8);
70
 
71
 
72
    lock <= '1' when stop_all  = '1' else -- Lock this stage when all the pipeline is locked   
73
            '0' when exch_cmd  = '1' else -- Exception
74
            '0' when bra_cmd   = '1' else -- Branch 
75
            '1' when stop_pf   = '1' else -- Wait for the branch hazard  
76
            '0';                         -- Normal evolution
77
 
78
   lock2 <= '1' when stop_all2 = '1' else -- Lock this stage when all the pipeline is locked
79
            '0' when exch_cmd2 = '1' else -- Exception
80
            '0' when bra_cmd2  = '1' else -- Branch
81
            '1' when stop_pf2  = '1' else -- Wait for the branch hazard 
82
            '0';                          -- Normal evolution   
83
 
84
    -- Synchronous evolution of the pc
85
    process(clock)
86
    begin
87
        if rising_edge(clock) then
88
            if reset='1' then
89
                -- PC reinitialisation with the boot address
90
                pc_interne <= ADR_INIT;
91
            elsif lock='0' then
92
                -- PC not locked
93
                pc_interne <= suivant;
94
            end if;
95
        end if;
96
    end process;
97
 
98
    process(clock2)
99
    begin
100
        if falling_edge(clock2) then
101
            if reset='1' then
102
                -- PC reinitialisation with the boot address
103
                                         pc_interne4 <= ADR_INIT4;
104
            elsif (lock2='0') then
105
                -- PC not locked
106
                                         pc_interne4 <= suivant4;
107
            end if;
108
        end if;
109
    end process;
110
 
111
end rtl;

powered by: WebSVN 2.1.0

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