-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpu_0_mult_cell.vhd
181 lines (164 loc) · 6.5 KB
/
cpu_0_mult_cell.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
--Legal Notice: (C)2007 Altera Corporation. All rights reserved. Your
--use of Altera Corporation's design tools, logic functions and other
--software and tools, and its AMPP partner logic functions, and any
--output files any of the foregoing (including device programming or
--simulation files), and any associated documentation or information are
--expressly subject to the terms and conditions of the Altera Program
--License Subscription Agreement or other applicable license agreement,
--including, without limitation, that your use is for the sole purpose
--of programming logic devices manufactured by Altera and sold by Altera
--or its authorized distributors. Please refer to the applicable
--agreement for further details.
-- turn off superfluous VHDL processor warnings
-- altera message_level Level1
-- altera message_off 10034 10035 10036 10037 10230 10240 10030
library altera;
use altera.altera_europa_support_lib.all;
library altera_mf;
use altera_mf.all;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
library lpm;
use lpm.all;
entity cpu_0_mult_cell is
port (
-- inputs:
signal A_mul_src1 : IN STD_LOGIC_VECTOR (31 DOWNTO 0);
signal A_mul_src2 : IN STD_LOGIC_VECTOR (31 DOWNTO 0);
signal clk : IN STD_LOGIC;
signal reset_n : IN STD_LOGIC;
-- outputs:
signal A_mul_cell_result : OUT STD_LOGIC_VECTOR (31 DOWNTO 0)
);
end entity cpu_0_mult_cell;
architecture europa of cpu_0_mult_cell is
component altmult_add
GENERIC (
addnsub_multiplier_pipeline_aclr1 : STRING;
addnsub_multiplier_pipeline_register1 : STRING;
addnsub_multiplier_register1 : STRING;
dedicated_multiplier_circuitry : STRING;
input_register_a0 : STRING;
input_register_b0 : STRING;
input_source_a0 : STRING;
input_source_b0 : STRING;
intended_device_family : STRING;
lpm_type : STRING;
multiplier1_direction : STRING;
multiplier_aclr0 : STRING;
multiplier_register0 : STRING;
number_of_multipliers : NATURAL;
output_register : STRING;
port_addnsub1 : STRING;
port_signa : STRING;
port_signb : STRING;
representation_a : STRING;
representation_b : STRING;
signed_pipeline_aclr_a : STRING;
signed_pipeline_aclr_b : STRING;
signed_pipeline_register_a : STRING;
signed_pipeline_register_b : STRING;
signed_register_a : STRING;
signed_register_b : STRING;
width_a : NATURAL;
width_b : NATURAL;
width_result : NATURAL
);
PORT (
clock0 : IN STD_LOGIC;
result : OUT STD_LOGIC_VECTOR (width_result-1 DOWNTO 0);
ena0 : IN STD_LOGIC;
dataa : IN STD_LOGIC_VECTOR (width_a-1 DOWNTO 0);
datab : IN STD_LOGIC_VECTOR (width_b-1 DOWNTO 0);
aclr0 : IN STD_LOGIC
);
end component altmult_add;
signal A_mul_cell_result_part_1 : STD_LOGIC_VECTOR (31 DOWNTO 0);
signal A_mul_cell_result_part_2 : STD_LOGIC_VECTOR (15 DOWNTO 0);
signal mul_clr : STD_LOGIC;
begin
mul_clr <= NOT reset_n;
the_altmult_add_part_1 : altmult_add
generic map(
addnsub_multiplier_pipeline_aclr1 => "ACLR0",
addnsub_multiplier_pipeline_register1 => "CLOCK0",
addnsub_multiplier_register1 => "UNREGISTERED",
dedicated_multiplier_circuitry => "YES",
input_register_a0 => "UNREGISTERED",
input_register_b0 => "UNREGISTERED",
input_source_a0 => "DATAA",
input_source_b0 => "DATAB",
intended_device_family => "CYCLONEII",
lpm_type => "altmult_add",
multiplier1_direction => "ADD",
multiplier_aclr0 => "ACLR0",
multiplier_register0 => "CLOCK0",
number_of_multipliers => 1,
output_register => "UNREGISTERED",
port_addnsub1 => "PORT_UNUSED",
port_signa => "PORT_UNUSED",
port_signb => "PORT_UNUSED",
representation_a => "UNSIGNED",
representation_b => "UNSIGNED",
signed_pipeline_aclr_a => "ACLR0",
signed_pipeline_aclr_b => "ACLR0",
signed_pipeline_register_a => "CLOCK0",
signed_pipeline_register_b => "CLOCK0",
signed_register_a => "UNREGISTERED",
signed_register_b => "UNREGISTERED",
width_a => 16,
width_b => 16,
width_result => 32
)
port map(
aclr0 => mul_clr,
clock0 => clk,
dataa => A_mul_src1(15 DOWNTO 0),
datab => A_mul_src2(15 DOWNTO 0),
ena0 => std_logic'('1'),
result => A_mul_cell_result_part_1
);
the_altmult_add_part_2 : altmult_add
generic map(
addnsub_multiplier_pipeline_aclr1 => "ACLR0",
addnsub_multiplier_pipeline_register1 => "CLOCK0",
addnsub_multiplier_register1 => "UNREGISTERED",
dedicated_multiplier_circuitry => "YES",
input_register_a0 => "UNREGISTERED",
input_register_b0 => "UNREGISTERED",
input_source_a0 => "DATAA",
input_source_b0 => "DATAB",
intended_device_family => "CYCLONEII",
lpm_type => "altmult_add",
multiplier1_direction => "ADD",
multiplier_aclr0 => "ACLR0",
multiplier_register0 => "CLOCK0",
number_of_multipliers => 1,
output_register => "UNREGISTERED",
port_addnsub1 => "PORT_UNUSED",
port_signa => "PORT_UNUSED",
port_signb => "PORT_UNUSED",
representation_a => "UNSIGNED",
representation_b => "UNSIGNED",
signed_pipeline_aclr_a => "ACLR0",
signed_pipeline_aclr_b => "ACLR0",
signed_pipeline_register_a => "CLOCK0",
signed_pipeline_register_b => "CLOCK0",
signed_register_a => "UNREGISTERED",
signed_register_b => "UNREGISTERED",
width_a => 16,
width_b => 16,
width_result => 16
)
port map(
aclr0 => mul_clr,
clock0 => clk,
dataa => A_mul_src1(31 DOWNTO 16),
datab => A_mul_src2(15 DOWNTO 0),
ena0 => std_logic'('1'),
result => A_mul_cell_result_part_2
);
A_mul_cell_result <= A_EXT (Std_Logic_Vector'(((std_logic_vector'("0") & (A_mul_cell_result_part_1(31 DOWNTO 16))) + (std_logic_vector'("0") & (A_mul_cell_result_part_2))) & A_mul_cell_result_part_1(15 DOWNTO 0)), 32);
end europa;