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

Subversion Repositories marca

[/] [marca/] [tags/] [INITIAL/] [vhdl/] [writeback.vhd] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 jeunes2
--  This file is part of the marca processor.
2
--  Copyright (C) 2007 Wolfgang Puffitsch
3
 
4
--  This program is free software; you can redistribute it and/or modify it
5
--  under the terms of the GNU Library General Public License as published
6
--  by the Free Software Foundation; either version 2, or (at your option)
7
--  any later version.
8
 
9
--  This program is distributed in the hope that it will be useful,
10
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
--  Library General Public License for more details.
13
 
14
--  You should have received a copy of the GNU Library General Public
15
--  License along with this program; if not, write to the Free Software
16
--  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
17
 
18
-------------------------------------------------------------------------------
19
-- MARCA write-back stage
20
-------------------------------------------------------------------------------
21
-- architecture of the write-back pipeline stage
22
-------------------------------------------------------------------------------
23
 
24
-------------------------------------------------------------------------------
25
-- Wolfgang Puffitsch
26
-- Computer Architecture Lab, Group 3
27
-------------------------------------------------------------------------------
28
 
29
library IEEE;
30
use IEEE.std_logic_1164.all;
31
 
32
use work.marca_pkg.all;
33
 
34
architecture behaviour of writeback is
35
 
36
signal pcchg_reg : std_logic;
37
signal pc_reg : std_logic_vector(REG_WIDTH-1 downto 0);
38
signal dest_reg : std_logic_vector(REG_COUNT_LOG-1 downto 0);
39
signal result_reg : std_logic_vector(REG_WIDTH-1 downto 0);
40
signal target_reg : TARGET_SELECTOR;
41
 
42
begin  -- behaviour
43
 
44
  syn_proc: process (clock, reset)
45
  begin  -- process syn_proc
46
    if reset = RESET_ACTIVE then                 -- asynchronous reset (active low)
47
      pcchg_reg <= '0';
48
      pc_reg <= (others => '0');
49
      dest_reg <= (others => '0');
50
      result_reg <= (others => '0');
51
      target_reg <= TARGET_NONE;
52
    elsif clock'event and clock = '1' then  -- rising clock edge
53
      if hold = '0' then
54
        pcchg_reg <= pcchg;
55
        pc_reg <= pc_in;
56
        dest_reg <= dest_in;
57
        target_reg <= target;
58
        result_reg <= result;
59
      end if;
60
    end if;
61
  end process syn_proc;
62
 
63
  dispatch: process (target_reg, pcchg_reg, pc_reg, result_reg, dest_reg)
64
  begin  -- process dispatch
65
 
66
    pcena <= '0';
67
    pc_out <= pc_reg;
68
 
69
    ena <= '0';
70
    dest_out <= dest_reg;
71
    val <= result_reg;
72
 
73
    case target_reg is
74
 
75
      when TARGET_REGISTER =>
76
        ena <= '1';
77
 
78
      when TARGET_PC =>
79
        if pcchg_reg = '1' then
80
          pcena <= '1';
81
          pc_out <= result_reg;
82
        end if;
83
 
84
      when TARGET_BOTH =>
85
        pcena <= '1';
86
        ena <= '1';
87
 
88
      when others => null;
89
    end case;
90
 
91
  end process dispatch;
92
 
93
end behaviour;

powered by: WebSVN 2.1.0

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