Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
lab-2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yann Roberge
lab-2
Commits
3ffa1133
Commit
3ffa1133
authored
3 years ago
by
8304_9
Browse files
Options
Downloads
Patches
Plain Diff
TB de l'additionneur complété (mais pas exhaustif)
parent
472974cd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sources/riscv_adder_tb.vhd
+36
-3
36 additions, 3 deletions
sources/riscv_adder_tb.vhd
with
36 additions
and
3 deletions
sources/riscv_adder_tb.vhd
+
36
−
3
View file @
3ffa1133
...
...
@@ -31,7 +31,7 @@ architecture tb of riscv_adder_tb is
signal
sub
:
std_logic
;
signal
sum
:
std_logic_vector
(
N
downto
0
);
constant
PERIOD
:
time
:
=
1
25
0
p
s
;
constant
PERIOD
:
time
:
=
10
n
s
;
begin
...
...
@@ -54,15 +54,48 @@ begin
-- Vecteurs de tests
report
"BEGIN SIMULATION"
;
report
"Unsigned addition"
;
a
<=
std_logic_vector
(
to_unsigned
(
12345
,
a
'length
));
b
<=
std_logic_vector
(
to_unsigned
(
2345
,
b
'length
));
sign
<=
'0'
;
sub
<=
'0'
;
wait
for
PERIOD
;
assert
sum
=
std_logic_vector
(
to_unsigned
(
12345
+
2345
,
sum
'length
));
report
"sum error"
severity
error
;
assert
sum
=
std_logic_vector
(
to_unsigned
(
12345
+
2345
,
sum
'length
))
report
"unsigned addition error"
severity
error
;
wait
for
PERIOD
;
report
"Signed addition"
;
a
<=
std_logic_vector
(
to_signed
(
12345
,
a
'length
));
b
<=
std_logic_vector
(
to_signed
(
-2346
,
b
'length
));
sign
<=
'1'
;
sub
<=
'0'
;
wait
for
PERIOD
;
assert
sum
=
std_logic_vector
(
to_signed
(
12345
-
2346
,
sum
'length
))
report
"signed addition error"
severity
error
;
wait
for
PERIOD
;
report
"Unsigned subtraction"
;
a
<=
std_logic_vector
(
to_unsigned
(
12345
,
a
'length
));
b
<=
std_logic_vector
(
to_unsigned
(
2346
,
b
'length
));
sign
<=
'0'
;
sub
<=
'1'
;
wait
for
PERIOD
;
assert
sum
=
std_logic_vector
(
to_unsigned
(
12345
-
2346
,
sum
'length
))
report
"signed addition error"
severity
error
;
wait
for
PERIOD
;
report
"Signed subtraction"
;
a
<=
std_logic_vector
(
to_signed
(
12345
,
a
'length
));
b
<=
std_logic_vector
(
to_signed
(
-2346
,
b
'length
));
sign
<=
'1'
;
sub
<=
'1'
;
wait
for
PERIOD
;
assert
sum
=
std_logic_vector
(
to_signed
(
12345
+
2346
,
sum
'length
))
report
"signed addition error"
severity
error
;
wait
for
PERIOD
;
report
"SIMULATION DONE"
;
wait
;
end
process
p_main
;
...
...
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