-
Notifications
You must be signed in to change notification settings - Fork 0
/
WBStage.vhdl
95 lines (70 loc) · 2.43 KB
/
WBStage.vhdl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
USE ieee.numeric_std.all;
ENTITY WBEnt IS
GENERIC(
n : integer := 32
);
PORT(
-- For entity
Clk,Enable: IN std_logic;
-- Signals
ControlSignals : IN std_logic_vector(27 DOWNTO 0);
Int: IN std_logic;
-- SP
SP : IN std_logic_vector(n-1 DOWNTO 0);
-- Data
MemOut,ALUResult: IN std_logic_vector(n-1 DOWNTO 0);
RDesData : IN std_logic_vector(31 DOWNTO 0);
RSrc2Data : IN std_logic_vector(31 DOWNTO 0);
RDes : IN std_logic_vector(2 DOWNTO 0);
RSrc1 : IN std_logic_vector(2 DOWNTO 0);
RSrc2 : IN std_logic_vector(2 DOWNTO 0);
-- Outputs
RDesDataOut : OUT std_logic_vector(31 DOWNTO 0);
RSrc2DataOut : OUT std_logic_vector(31 DOWNTO 0);
RDesOut : OUT std_logic_vector(2 DOWNTO 0);
RSrcOut1 : OUT std_logic_vector(2 DOWNTO 0);
RSrcOut2 : OUT std_logic_vector(2 DOWNTO 0);
ControlSignalsOut : OUT std_logic_vector(27 DOWNTO 0);
IntOut : OUT std_logic;
Mux10Out, SPOut : OUT std_logic_vector(n-1 DOWNTO 0)
-- WRE : OUT std_logic
);
END ENTITY;
ARCHITECTURE WBArch OF WBEnt IS
COMPONENT Mux21Ent IS
PORT (
s0: IN STD_LOGIC ;
IN0,IN1 : IN std_logic_vector(n-1 DOWNTO 0);
F : OUT std_logic_vector(n-1 DOWNTO 0)
);
END COMPONENT;
SIGNAL SPDecrement: std_logic_vector(n-1 DOWNTO 0);
SIGNAL SMux9 : std_logic;
-- CONTROL SIGNALS
SIGNAL IncOrDec,MemToReg: std_logic;
BEGIN
-- MUXES
Mux9 : Mux21Ent port map(SMux9,SPDecrement,SP,SPOut);
Mux10 : Mux21Ent port map(MemToReg,ALUResult,MemOut,Mux10Out);
-- PROCESS(Clk) BEGIN
-- IF(rising_edge(Clk) AND Enable='1') THEN
-- Signals
IncOrDec <= ControlSignals(17);
MemToReg <= ControlSignals(8);
SMux9 <= Int OR IncOrDec;
SPDecrement <= SP-1;
-- Outputs
RDesDataOut <= RDesData;
RSrc2DataOut <= RSrc2Data;
RDesOut <= RDes;
RSrcOut1 <= RSrc1;
RSrcOut2 <= RSrc2;
IntOut <= Int;
ControlSignalsOut <= ControlSignals;
-- WRE <= ControlSignals(10);
-- END IF;
-- END PROCESS;
END ARCHITECTURE;