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

Subversion Repositories diogenes

[/] [diogenes/] [trunk/] [vhdl/] [cpu/] [execute.vhd] - Blame information for rev 236

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 162 fellnhofer
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    10:32:09 02/11/2007 
6
-- Design Name: 
7
-- Module Name:    execute - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
use IEEE.STD_LOGIC_ARITH.ALL;
23
use IEEE.STD_LOGIC_UNSIGNED.ALL;
24
 
25
use work.types.all;
26
 
27
---- Uncomment the following library declaration if instantiating
28
---- any Xilinx primitives in this code.
29
library UNISIM;
30
use UNISIM.VComponents.all;
31
 
32
entity execute is
33
    Port ( clk : in STD_LOGIC;
34
           reset : in STD_LOGIC;
35
                          big_op : in std_logic_VECTOR(15 downto 0);
36
                          op1 : in slv_32;
37
                          fwop1: in std_logic;
38
                          op2 : in slv_32;
39
                          fwop2: in std_logic;
40
           fwshiftop: in std_logic;
41
 
42
                          destreg : in std_logic_VECTOR(3 downto 0);
43
                          regaddr : out std_logic_VECTOR(3 downto 0);
44
                          result : out slv_32;
45
                          fb_result : out slv_32;
46
 
47
                          extrd: out std_logic;
48
                          extwr: out std_logic;
49
                          extaddr: out slv_16;
50
                          extdin: in slv_16;
51
                          extdout: out slv_16
52
                        );
53
end execute;
54
 
55
architecture Behavioral of execute is
56
 
57
component dmem
58
        port (
59
                addr: IN std_logic_VECTOR(9 downto 0);
60
                clk: IN std_logic;
61
                din: IN std_logic_VECTOR(31 downto 0);
62
                dout: OUT std_logic_VECTOR(31 downto 0);
63
                we: IN std_logic
64
        );
65
end component;
66
 
67
component alu is
68
        port (
69
                clk: IN std_logic;
70
                reset: in std_logic;
71
                alu_op : in std_logic_VECTOR(10 downto 0);
72
                a: IN slv_32;
73
                b: IN slv_32;
74
                s: OUT slv_32
75
        );
76
end component;
77
 
78
 
79
signal ain: slv_32;
80
signal bin: slv_32;
81
signal r: slv_32;
82
signal selected_r: slv_32;
83
signal feedback_r: slv_32;
84
 
85
 
86
signal memr: slv_32;
87
signal extr: slv_32;
88
 
89
signal wasmem: std_logic;
90
signal wasext: std_logic;
91
 
92
 
93
begin
94
 
95
 
96
cdmem: dmem
97
        port map( clk => clk, addr => ain(9 downto 0), dout => memr, din => bin, we => big_op(12));
98
calu: alu
99
        port map( clk => clk, reset => reset, alu_op => big_op(10 downto 0), a => ain, b => bin, s => r);
100
 
101
        extr(15 downto 0) <= extdin;
102
        extr(31 downto 16) <= (others => '0');
103
 
104
        -- forward result
105
        process (extr, r, memr, fwop1, fwop2, fwshiftop, selected_r, feedback_r, op2, op1, extdin, wasmem, wasext)
106
        begin
107
                if (wasext = '1') then selected_r <= extr;
108
                elsif (wasmem = '1') then selected_r <= memr;
109
--              elsif (needain = '1') then selected_r <= oldain;
110
                else selected_r <= r(31 downto 0);
111
                end if;
112
 
113
--              if (needain = '1') then feedback_r <= oldain;
114
                feedback_r <= r(31 downto 0);
115
--              end if;
116
 
117
 
118
                if (fwop2='1') then ain <= feedback_r(31 downto 0);
119
                elsif (fwshiftop='1') then
120
                        ain(31 downto 8) <= feedback_r(23 downto 0);
121
                        ain(7 downto 0) <= (others => '0');
122
                else
123
                        ain <= op2;
124
                end if;
125
 
126
                if (fwop1='1') then bin <= feedback_r(31 downto 0);
127
                else bin <= op1; end if;
128
  end process;
129
 
130
 
131
        extrd <= big_op(13);
132
        extwr <= big_op(11);
133
        extaddr <= ain(15 downto 0);
134
        extdout <= bin(15 downto 0);
135
 
136
        result <= selected_r;
137
        fb_result <= feedback_r;
138
 
139
        process (clk, reset)
140
        begin
141
                if (reset='0') then
142
                   regaddr <= (others => '0');
143
                        wasmem <= '0';
144
                        wasext <= '0';
145
                elsif(rising_edge(clk)) then
146
                        regaddr <= destreg;
147
                        wasmem <= big_op(14);
148
                        wasext <= big_op(13);
149
                end if;
150
        end process;
151
end Behavioral;
152
 

powered by: WebSVN 2.1.0

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