-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBranch.vhd
71 lines (60 loc) · 1.84 KB
/
Branch.vhd
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
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 17:51:24 05/23/2016
-- Design Name:
-- Module Name: Branch - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity Branch2 is
Port ( Branch1 : in STD_LOGIC;
Z : in STD_LOGIC;
Adderout : in STD_LOGIC_VECTOR(31 downto 0);
SignExt : in STD_LOGIC_VECTOR(31 downto 0);
R : out STD_LOGIC_vector(31 downto 0)
);
end Branch2;
architecture Behavioral of Branch2 is
Signal SLLout,ADDout,BranchOut: STD_LOGIC_VECTOR(31 downto 0);
Signal MUXSIGNAL : STD_LOGIC;
component Adder
port (
A,B :in STD_LOGIC_VECTOR(31 downto 0);
Cin :in STD_LOGIC;
R :out STD_LOGIC_VECTOR(31 downto 0)
);
end component;
component MUX2
Port ( A : in STD_LOGIC_vector(31 downto 0);
B : in STD_LOGIC_vector(31 downto 0);
C : in STD_LOGIC;
R : out STD_LOGIC_vector(31 downto 0)
);
end component;
begin
SLLout<=SignExt(29 downto 0)&"00";
Adder1: Adder port map(A=>SLLout,Cin=>'0',B=>Adderout,R=>ADDout);
MUXSIGNAL<=Z and Branch1;
BranchMux: MUX2 port map(A=>Adderout,B=>ADDout,C=>MUXSIGNAL,R=>BranchOut);
R<=BranchOut;
end Behavioral;