AMC13
Firmwares for the different applications of the AMC13 uTCA board made at Boston University
Main Page
Design Unit List
Files
File List
All
Classes
Variables
src
common
TTC
thresholdNew.vhd
1
----------------------------------------------------------------------------------
2
-- Company:
3
-- Engineer:
4
--
5
-- Create Date:
11
:
53
:
01
07/21/2011
6
-- Design Name:
7
-- Module Name:
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
library
IEEE
;
20
use
IEEE.STD_LOGIC_1164.
ALL
;
21
use
IEEE.STD_LOGIC_ARITH.
ALL
;
22
use
IEEE.STD_LOGIC_UNSIGNED.
ALL
;
23
use
IEEE.std_logic_misc.
all
;
24
25
-- Uncomment the following
library
declaration
if
using
26
-- arithmetic functions
with
Signed
or
Unsigned
values
27
--use IEEE.NUMERIC_STD.
ALL
;
28
29
-- Uncomment the following
library
declaration
if
instantiating
30
-- any Xilinx primitives
in
this code.
31
library
UNISIM
;
32
use
UNISIM.VComponents.
all
;
33
Library
UNIMACRO
;
34
use
UNIMACRO.vcomponents.
all
;
35
36
entity
Threshold
is
37
Port
(
clk
:
in
STD_LOGIC
;
-- clk input
38
din
:
in
STD_LOGIC_VECTOR
(
15
downto
0
)
;
39
nongap_size
:
in
STD_LOGIC_VECTOR
(
11
downto
0
)
;
40
dout
:
out
STD_LOGIC_VECTOR
(
31
downto
0
)
)
;
41
end
Threshold
;
42
43
architecture
Behavioral
of
Threshold
is
44
signal
old_din
:
std_logic_vector
(
15
downto
0
)
:=
(
others
=
>
'
0
'
)
;
45
signal
old_nongap_size
:
std_logic_vector
(
11
downto
0
)
:=
(
others
=
>
'
0
'
)
;
46
signal
start
:
std_logic
:=
'
0
'
;
47
signal
busy
:
std_logic
:=
'
0
'
;
48
signal
CEP
:
std_logic
:=
'
0
'
;
49
signal
divide
:
std_logic
:=
'
0
'
;
50
signal
shift
:
std_logic
:=
'
0
'
;
51
signal
check_denom
:
std_logic
:=
'
0
'
;
52
signal
denom
:
std_logic_vector
(
12
downto
0
)
:=
(
others
=
>
'
0
'
)
;
53
signal
div_cntr
:
std_logic_vector
(
4
downto
0
)
:=
(
others
=
>
'
0
'
)
;
54
signal
nom
:
std_logic_vector
(
16
downto
0
)
:=
(
others
=
>
'
0
'
)
;
55
signal
divident
:
std_logic_vector
(
29
downto
0
)
:=
(
others
=
>
'
0
'
)
;
56
signal
Mult_P
:
std_logic_vector
(
47
downto
0
)
:=
(
others
=
>
'
0
'
)
;
57
begin
58
dout
<=
Mult_P
(
41
downto
10
)
;
59
process
(clk)
60
begin
61
if
(
clk
'
event
and
clk
=
'
1
'
)
then
62
if
(
start
=
'
1
'
)
then
63
old_nongap_size
<=
nongap_size
;
64
old_din
<=
din
;
65
end
if
;
66
if
(
start
=
'
1
'
)
then
67
busy
<=
'
1
'
;
68
elsif
(
or_reduce
(
div_cntr
)
=
'
0
'
and
divide
=
'
1
'
)
then
69
busy
<=
'
0
'
;
70
end
if
;
71
if
(
(
din
/=
old_din
or
nongap_size
/=
old_nongap_size
)
and
busy
=
'
0
'
and
start
=
'
0
'
)
then
72
start
<=
'
1
'
;
73
else
74
start
<=
'
0
'
;
75
end
if
;
76
if
(
start
=
'
1
'
)
then
77
--
if
(or_reduce(nongap_size(
11
downto
5
)) = '0')
then
78
-- denom(
11
downto
0
) <= x"020";
79
if
(
or_reduce
(
nongap_size
(
11
downto
8
)
)
=
'
0
'
)
then
80
denom
(
11
downto
0
)
<=
x
"100"
;
81
else
82
denom
(
11
downto
0
)
<=
nongap_size
;
83
end
if
;
84
div_cntr
<=
"10001"
;
85
check_denom
<=
'
1
'
;
86
nom
<=
'
0
'
&
din
;
87
divident
<=
(
others
=
>
'
0
'
)
;
88
shift
<=
'
0
'
;
89
elsif
(
check_denom
=
'
1
'
)
then
90
if
(
denom
(
11
)
=
'
0
'
)
then
91
div_cntr
<=
div_cntr
+
1
;
92
denom
(
11
downto
0
)
<=
denom
(
10
downto
0
)
&
'
0
'
;
93
else
94
check_denom
<=
'
0
'
;
95
divide
<=
'
1
'
;
96
end
if
;
97
elsif
(
divide
=
'
1
'
)
then
98
if
(
shift
=
'
0
'
)
then
99
div_cntr
<=
div_cntr
-
1
;
100
if
(
nom
(
16
downto
4
)
>=
denom
)
then
101
nom
(
16
downto
4
)
<=
nom
(
16
downto
4
)
-
denom
;
102
-- divident(
0
) <= '1';
103
divident
(
3
)
<=
'
1
'
;
104
end
if
;
105
shift
<=
'
1
'
;
106
else
107
nom
<=
nom
(
15
downto
0
)
&
'
0
'
;
108
-- divident(
23
downto
0
) <= divident(
22
downto
0
) & '0';
109
divident
(
26
downto
3
)
<=
divident
(
25
downto
3
)
&
'
0
'
;
110
shift
<=
'
0
'
;
111
if
(
or_reduce
(
div_cntr
)
=
'
0
'
)
then
112
divide
<=
'
0
'
;
113
end
if
;
114
end
if
;
115
end
if
;
116
CEP
<=
divide
and
not
or_reduce
(
div_cntr
)
;
117
end
if
;
118
end
process
;
119
DSP48E1_inst : DSP48E1
120
generic
map
(
121
-- Feature Control Attributes: Data Path Selection
122
A_INPUT =>
"DIRECT"
,
-- Selects A input source,
"DIRECT"
(A
port
)
or
"CASCADE"
(ACIN
port
)
123
B_INPUT =>
"DIRECT"
,
-- Selects B input source,
"DIRECT"
(B
port
)
or
"CASCADE"
(BCIN
port
)
124
USE_DPORT => FALSE,
--
Select
D
port
usage (TRUE
or
FALSE)
125
USE_MULT =>
"MULTIPLY"
,
--
Select
multiplier usage (
"MULTIPLY"
,
"DYNAMIC"
,
or
"NONE"
)
126
USE_SIMD =>
"ONE48"
,
-- SIMD selection (
"ONE48"
,
"TWO24"
,
"FOUR12"
)
127
-- Pattern Detector Attributes: Pattern Detection
Configuration
128
AUTORESET_PATDET =>
"NO_RESET"
,
--
"NO_RESET"
,
"RESET_MATCH"
,
"RESET_NOT_MATCH"
129
MASK => X"3fffffffffff",
-- 48-bit mask value
for
pattern detect (1=ignore)
130
PATTERN => X"000000000000",
-- 48-bit pattern match
for
pattern detect
131
SEL_MASK =>
"MASK"
,
--
"C"
,
"MASK"
,
"ROUNDING_MODE1"
,
"ROUNDING_MODE2"
132
SEL_PATTERN =>
"PATTERN"
,
--
Select
pattern value (
"PATTERN"
or
"C"
)
133
USE_PATTERN_DETECT =>
"NO_PATDET"
,
-- Enable pattern detect (
"PATDET"
or
"NO_PATDET"
)
134
--
Register
Control Attributes: Pipeline
Register
Configuration
135
ACASCREG =>
0
,
-- Number
of
pipeline stages between A/ACIN
and
ACOUT (
0
,
1
or
2
)
136
ADREG =>
0
,
-- Number
of
pipeline stages
for
pre-adder (
0
or
1
)
137
ALUMODEREG =>
0
,
-- Number
of
pipeline stages
for
ALUMODE (
0
or
1
)
138
AREG =>
0
,
-- Number
of
pipeline stages
for
A (
0
,
1
or
2
)
139
BCASCREG =>
0
,
-- Number
of
pipeline stages between B/BCIN
and
BCOUT (
0
,
1
or
2
)
140
BREG =>
0
,
-- Number
of
pipeline stages
for
B (
0
,
1
or
2
)
141
CARRYINREG =>
0
,
-- Number
of
pipeline stages
for
CARRYIN (
0
or
1
)
142
CARRYINSELREG =>
0
,
-- Number
of
pipeline stages
for
CARRYINSEL (
0
or
1
)
143
CREG =>
0
,
-- Number
of
pipeline stages
for
C (
0
or
1
)
144
DREG =>
0
,
-- Number
of
pipeline stages
for
D (
0
or
1
)
145
INMODEREG =>
0
,
-- Number
of
pipeline stages
for
INMODE (
0
or
1
)
146
MREG =>
0
,
-- Number
of
multiplier pipeline stages (
0
or
1
)
147
OPMODEREG =>
0
,
-- Number
of
pipeline stages
for
OPMODE (
0
or
1
)
148
PREG =>
1
-- Number
of
pipeline stages
for
P (
0
or
1
)
149
)
150
port
map
(
151
-- Cascade: 30-bit (each) output: Cascade Ports
152
ACOUT =>
open
,
-- 30-bit output: A
port
cascade output
153
BCOUT =>
open
,
-- 18-bit output: B
port
cascade output
154
CARRYCASCOUT =>
open
,
-- 1-bit output: Cascade carry output
155
MULTSIGNOUT =>
open
,
-- 1-bit output: Multiplier sign cascade output
156
PCOUT =>
open
,
-- 48-bit output: Cascade output
157
-- Control: 1-bit (each) output: Control Inputs/Status Bits
158
OVERFLOW =>
open
,
-- 1-bit output: Overflow
in
add/acc output
159
PATTERNBDETECT =>
open
,
-- 1-bit output: Pattern bar detect output
160
PATTERNDETECT =>
open
,
-- 1-bit output: Pattern detect output
161
UNDERFLOW =>
open
,
-- 1-bit output: Underflow
in
add/acc output
162
-- Data: 4-bit (each) output: Data Ports
163
CARRYOUT =>
open
,
-- 4-bit output: Carry output
164
P => Mult_P,
-- 48-bit output: Primary data output
165
-- Cascade: 30-bit (each) input: Cascade Ports
166
ACIN =>
(
others
=> '0'
)
,
-- 30-bit input: A cascade data input
167
BCIN =>
(
others
=> '0'
)
,
-- 18-bit input: B cascade input
168
CARRYCASCIN => '0',
-- 1-bit input: Cascade carry input
169
MULTSIGNIN => '0',
-- 1-bit input: Multiplier sign input
170
PCIN =>
(
others
=> '0'
)
,
-- 48-bit input: P cascade input
171
-- Control: 4-bit (each) input: Control Inputs/Status Bits
172
ALUMODE => "
0000
",
-- 4-bit input: ALU control input
173
CARRYINSEL => "
000
",
-- 3-bit input: Carry
select
input
174
CLK => clk,
-- 1-bit input: Clock input
175
INMODE => "
00000
",
-- 5-bit input: INMODE control input
176
OPMODE => "
0000101
",
-- 7-bit input: Operation mode input
177
-- Data: 30-bit (each) input: Data Ports
178
A => divident,
-- 30-bit input: A data input
179
B => "
010111010011101111
",
-- 18-bit input: B data input
180
C =>
(
others
=> '0'
)
,
-- 48-bit input: C data input
181
CARRYIN => '0',
-- 1-bit input: Carry input
signal
182
D =>
(
others
=> '0'
)
,
-- 25-bit input: D data input
183
-- Reset/Clock Enable: 1-bit (each) input: Reset/Clock Enable Inputs
184
CEA1 => '0',
-- 1-bit input: Clock enable input
for
1st stage AREG
185
CEA2 => '0',
-- 1-bit input: Clock enable input
for
2nd stage AREG
186
CEAD => '0',
-- 1-bit input: Clock enable input
for
ADREG
187
CEALUMODE => '0',
-- 1-bit input: Clock enable input
for
ALUMODE
188
CEB1 => '0',
-- 1-bit input: Clock enable input
for
1st stage BREG
189
CEB2 => '0',
-- 1-bit input: Clock enable input
for
2nd stage BREG
190
CEC => '0',
-- 1-bit input: Clock enable input
for
CREG
191
CECARRYIN => '0',
-- 1-bit input: Clock enable input
for
CARRYINREG
192
CECTRL => '0',
-- 1-bit input: Clock enable input
for
OPMODEREG
and
CARRYINSELREG
193
CED => '0',
-- 1-bit input: Clock enable input
for
DREG
194
CEINMODE => '0',
-- 1-bit input: Clock enable input
for
INMODEREG
195
CEM => '0',
-- 1-bit input: Clock enable input
for
MREG
196
CEP => CEP,
-- 1-bit input: Clock enable input
for
PREG
197
RSTA => '0',
-- 1-bit input: Reset input
for
AREG
198
RSTALLCARRYIN => '0',
-- 1-bit input: Reset input
for
CARRYINREG
199
RSTALUMODE => '0',
-- 1-bit input: Reset input
for
ALUMODEREG
200
RSTB => '0',
-- 1-bit input: Reset input
for
BREG
201
RSTC => '0',
-- 1-bit input: Reset input
for
CREG
202
RSTCTRL => '0',
-- 1-bit input: Reset input
for
OPMODEREG
and
CARRYINSELREG
203
RSTD => '0',
-- 1-bit input: Reset input
for
DREG
and
ADREG
204
RSTINMODE => '0',
-- 1-bit input: Reset input
for
INMODEREG
205
RSTM => '0',
-- 1-bit input: Reset input
for
MREG
206
RSTP => '0'
-- 1-bit input: Reset input
for
PREG
207
)
;
208
end
Behavioral
;
209
Generated on Wed Apr 18 2018 10:55:28 for AMC13 by
1.8.1