-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheecs361.vhd
130 lines (118 loc) · 2.9 KB
/
eecs361.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
-- This package is used for EECS 361 from Northwestern University.
-- by Kaicheng Zhang (kaichengz@gmail.com)
library ieee;
use ieee.std_logic_1164.all;
use work.eecs361_gates.all;
package eecs361 is
-- Decoders
component dec_n
generic (
-- Widths of the inputs.
n : integer
);
port (
src : in std_logic_vector(n-1 downto 0);
z : out std_logic_vector((2**n)-1 downto 0)
);
end component dec_n;
-- Multiplexors
component mux
port (
sel : in std_logic;
src0 : in std_logic;
src1 : in std_logic;
z : out std_logic
);
end component mux;
component mux_n
generic (
-- Widths of the inputs.
n : integer
);
port (
sel : in std_logic;
src0 : in std_logic_vector(n-1 downto 0);
src1 : in std_logic_vector(n-1 downto 0);
z : out std_logic_vector(n-1 downto 0)
);
end component mux_n;
component mux_32
port (
sel : in std_logic;
src0 : in std_logic_vector(31 downto 0);
src1 : in std_logic_vector(31 downto 0);
z : out std_logic_vector(31 downto 0)
);
end component mux_32;
-- Flip-flops
-- D Flip-flops from Figure C.8.4 with a falling edge trigger.
component dff
port (
clk : in std_logic;
d : in std_logic;
q : out std_logic
);
end component dff;
-- D Flip-flops from Figure C.8.4 with a rising edge trigger.
component dffr
port (
clk : in std_logic;
d : in std_logic;
q : out std_logic
);
end component dffr;
-- D Flip-flops from Example 13-40 in http://www.altera.com/literature/hb/qts/qts_qii51007.pdf
component dffr_a
port (
clk : in std_logic;
arst : in std_logic;
aload : in std_logic;
adata : in std_logic;
d : in std_logic;
enable : in std_logic;
q : out std_logic
);
end component dffr_a;
-- A 32bit SRAM from Figure C.9.1. It can only be used for simulation.
component sram
generic (
mem_file : string
);
port (
-- chip select
cs : in std_logic;
-- output enable
oe : in std_logic;
-- write enable
we : in std_logic;
-- address line
addr : in std_logic_vector(31 downto 0);
-- data input
din : in std_logic_vector(31 downto 0);
-- data output
dout : out std_logic_vector(31 downto 0)
);
end component sram;
-- Synchronous SRAM with asynchronous reset.
component syncram
generic (
mem_file : string
);
port (
-- clock
clk : in std_logic;
-- chip select
cs : in std_logic;
-- output enable
oe : in std_logic;
-- write enable
we : in std_logic;
-- address line
addr : in std_logic_vector(31 downto 0);
-- data input
din : in std_logic_vector(31 downto 0);
-- data output
dout : out std_logic_vector(31 downto 0)
);
end component syncram;
end;