Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tp-filtre-etudiant-t24andia
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
La purge estivale des projets de gitlab-df sera réalisée jeudi 10 juillet vers 10h.
Show more breadcrumbs
UEEE
sar-signal-audio
gr-vhdl-t24andia
tp-filtre-etudiant-t24andia
Commits
0b20d3fd
Commit
0b20d3fd
authored
1 month ago
by
Telmo ANDIA AGUIRREZABAL
Browse files
Options
Downloads
Patches
Plain Diff
Bonus réussi
parent
93395cec
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/hdl/operativeUnit.vhd
+46
-26
46 additions, 26 deletions
src/hdl/operativeUnit.vhd
src/hdl/tb_firUnit.vhd
+8
-8
8 additions, 8 deletions
src/hdl/tb_firUnit.vhd
with
54 additions
and
34 deletions
src/hdl/operativeUnit.vhd
+
46
−
26
View file @
0b20d3fd
...
...
@@ -53,7 +53,7 @@ entity operativeUnit is
end
entity
operativeUnit
;
architecture
arch_operativeUnit
of
operativeUnit
is
type
registerFile
is
array
(
0
to
15
)
of
signed
(
15
downto
0
);
type
registerFile
is
array
(
0
to
32
)
of
signed
(
15
downto
0
);
signal
SR_coefRegister
:
registerFile
;
...
...
@@ -64,7 +64,7 @@ architecture arch_operativeUnit of operativeUnit is
signal
SC_addResult
:
signed
(
35
downto
0
);
-- result of the accumulation addition
signal
SR_sum
:
signed
(
35
downto
0
);
-- Accumulation register
signal
SR_filteredSample
:
signed
(
15
downto
0
);
-- filtered sample storage register
signal
SR_readAddress
:
integer
range
0
to
15
;
-- register files read address
signal
SR_readAddress
:
integer
range
0
to
32
;
-- register files read address
...
...
@@ -73,10 +73,10 @@ begin
-- Low-pass filter provided with octave (or Matlab ;)) script :
-- pkg load signal
--
-- fs=4
41
00
-- fs=4
80
00
-- fn=fs/2
-- n=
16
-- fc=
3
00
-- n=
33
-- fc=
10
00
-- fLP=fir1(n-1,fc/fn,"low");
--
-- function quantized_signal = quantize(signal, q)
...
...
@@ -95,23 +95,39 @@ begin
-- endfor
-- Table to store the filter coefficients obtained with the previous script
SR_coefRegister
<=
(
to_signed
(
317
,
16
),
to_signed
(
476
,
16
),
to_signed
(
925
,
16
),
to_signed
(
1589
,
16
),
to_signed
(
2354
,
16
),
to_signed
(
3087
,
16
),
to_signed
(
3661
,
16
),
to_signed
(
3975
,
16
),
to_signed
(
3975
,
16
),
to_signed
(
3661
,
16
),
to_signed
(
3087
,
16
),
to_signed
(
2354
,
16
),
to_signed
(
1589
,
16
),
to_signed
(
925
,
16
),
to_signed
(
476
,
16
),
to_signed
(
317
,
16
)
);
SR_coefRegister
<=
(
to_signed
(
-46
,
16
),
to_signed
(
-58
,
16
),
to_signed
(
-84
,
16
),
to_signed
(
-126
,
16
),
to_signed
(
-187
,
16
),
to_signed
(
-266
,
16
),
to_signed
(
-364
,
16
),
to_signed
(
-477
,
16
),
to_signed
(
-602
,
16
),
to_signed
(
-733
,
16
),
to_signed
(
-865
,
16
),
to_signed
(
-991
,
16
),
to_signed
(
-1105
,
16
),
to_signed
(
-1202
,
16
),
to_signed
(
-1274
,
16
),
to_signed
(
-1320
,
16
),
to_signed
(
31477
,
16
),
to_signed
(
-1320
,
16
),
to_signed
(
-1274
,
16
),
to_signed
(
-1202
,
16
),
to_signed
(
-1105
,
16
),
to_signed
(
-991
,
16
),
to_signed
(
-865
,
16
),
to_signed
(
-733
,
16
),
to_signed
(
-602
,
16
),
to_signed
(
-477
,
16
),
to_signed
(
-364
,
16
),
to_signed
(
-266
,
16
),
to_signed
(
-187
,
16
),
to_signed
(
-126
,
16
),
to_signed
(
-84
,
16
),
to_signed
(
-58
,
16
),
to_signed
(
-46
,
16
));
-- Process to describe the shift register storing the input samples
shift
:
process
(
I_reset
,
I_clock
)
is
...
...
@@ -120,7 +136,7 @@ begin
SR_shiftRegister
<=
(
others
=>
(
others
=>
'0'
));
elsif
rising_edge
(
I_clock
)
then
if
(
I_loadShift
=
'1'
)
then
SR_shiftRegister
(
1
to
15
)
<=
SR_shiftRegister
(
0
to
1
4
);
SR_shiftRegister
(
1
to
32
)
<=
SR_shiftRegister
(
0
to
3
1
);
SR_shiftRegister
(
0
)
<=
signed
(
I_inputSample
);
end
if
;
...
...
@@ -138,7 +154,7 @@ begin
if
I_initAddress
=
'1'
then
SR_readAddress
<=
0
;
elsif
I_incrAddress
=
'1'
then
if
SR_readAddress
<
15
then
if
SR_readAddress
<
32
then
SR_readAddress
<=
SR_readAddress
+
1
;
end
if
;
end
if
;
...
...
@@ -149,7 +165,7 @@ begin
-- Signal detecting that the next cycle will be the one
-- providing the last product used to compute the convolution
O_processingDone
<=
'1'
when
SR_readAddress
=
1
4
else
'0'
;
O_processingDone
<=
'1'
when
SR_readAddress
=
3
1
else
'0'
;
-- Signals connected with multiplexers (SIMPLY inferred with table indices)
SC_multOperand1
<=
SR_shiftRegister
(
SR_readAddress
);
-- 16 bits
...
...
@@ -184,7 +200,11 @@ begin
SR_filteredSample
<=
(
others
=>
'0'
);
elsif
rising_edge
(
I_clock
)
then
if
I_loadOutput
=
'1'
then
SR_filteredSample
<=
signed
(
SC_addResult
(
30
downto
15
));
if
SC_addResult
(
14
)
=
'1'
then
SR_filteredSample
<=
(
SC_addResult
(
30
downto
15
))
+
1
;
elsif
SC_addResult
(
14
)
=
'0'
then
SR_filteredSample
<=
(
SC_addResult
(
30
downto
15
));
end
if
;
end
if
;
end
if
;
...
...
This diff is collapsed.
Click to expand it.
src/hdl/tb_firUnit.vhd
+
8
−
8
View file @
0b20d3fd
...
...
@@ -63,14 +63,14 @@ begin
SC_inputSample
<=
"0000000000000000"
,
"0111111111111111"
after
401
ns
,
"0000000000000000"
after
601
ns
,
"0000000000100100"
after
4
201
ns
,
"0000000001100100"
after
4
401
ns
,
"1111111110100010"
after
4
601
ns
,
"1111111111011011"
after
4
801
ns
,
"0000000000001011"
after
5
001
ns
,
"1111111110000000"
after
5
201
ns
,
"0000000001111111"
after
5
401
ns
,
"1111111110111010"
after
5
601
ns
;
"0000000000100100"
after
18
201
ns
,
"0000000001100100"
after
18
401
ns
,
"1111111110100010"
after
18
601
ns
,
"1111111111011011"
after
18
801
ns
,
"0000000000001011"
after
19
001
ns
,
"1111111110000000"
after
19
201
ns
,
"0000000001111111"
after
19
401
ns
,
"1111111110111010"
after
19
601
ns
;
-- the filter output on 16 bits is a sequence of signed numbers (with the assumption
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment