Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
progkrets
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Solveig Langbakk
progkrets
Commits
c258e3fd
Commit
c258e3fd
authored
7 months ago
by
Nils
Browse files
Options
Downloads
Patches
Plain Diff
Kontrolerer databuzz til å bli z ellers
parent
01e1eaa6
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Tx.vhd
+9
-3
9 additions, 3 deletions
Tx.vhd
Tx_tb.vhd
+31
-6
31 additions, 6 deletions
Tx_tb.vhd
with
40 additions
and
9 deletions
Tx.vhd
+
9
−
3
View file @
c258e3fd
...
...
@@ -87,7 +87,7 @@ architecture Behavioral of Tx is
begin
p_bit_send
:
TxD
<=
bit_to_send
;
process
(
clk
,
rst_n
)
is
p_seq
:
process
(
clk
,
rst_n
)
is
begin
if
rst_n
=
'0'
then
--resetter systemet
...
...
@@ -99,7 +99,9 @@ begin
tx_state
<=
tx_state_type
'left
;
bit_count
<=
0
;
data_reg
<=
(
others
=>
'0'
);
ready_to_send
<=
'0'
;
elsif
rising_edge
(
clk
)
then
Data_bus
<=
(
others
=>
'Z'
);
case
adresse
is
when
"000"
=>
-- Konfigurasjonsinnstillinger
if
Wr_sig
=
'1'
then
...
...
@@ -118,8 +120,12 @@ begin
if
tx_state
=
IDLE
then
Data_bus
<=
(
others
=>
'0'
);
else
-- Sett LSB til 1 når ikke IDLE
Data_bus
<=
(
others
=>
'0'
);
Data_bus
(
0
)
<=
'1'
;
-- Sett LSB til 1 når ikke IDLE
Data_bus
(
0
)
<=
'1'
;
--(0 => '1', others => '0');
--Data_bus <= (others => '0');
--evt std_logic_vector(unsigned(others => '0') + 1);
end
if
;
else
null
;
end
if
;
...
...
@@ -177,7 +183,7 @@ begin
end
process
;
-- baud_rate Generator Process
process
(
clk
,
rst_n
)
p_baud_gen
:
process
(
clk
,
rst_n
)
begin
if
rst_n
=
'0'
then
baud_count
<=
0
;
...
...
This diff is collapsed.
Click to expand it.
Tx_tb.vhd
+
31
−
6
View file @
c258e3fd
...
...
@@ -90,26 +90,44 @@ begin
Data_bus
<=
"00000001"
;
-- Sett baud rate til 57600 (001) og ingen paritet (00)
wait
for
CLK_PERIOD
;
Wr_sig
<=
'0'
;
Data_bus
<=
(
others
=>
'Z'
);
adresse
<=
(
others
=>
'Z'
);
wait
for
CLK_PERIOD
;
end
config
;
-- Test Case 1: Konfigurasjon av baud rate og paritet
procedure
config2
is
begin
Wr_sig
<=
'1'
;
adresse
<=
"000"
;
-- Konfigurer baud rate og paritet
Data_bus
<=
"00011000"
;
-- Sett baud rate til 57600 (000) og ingen paritet (11)
wait
for
CLK_PERIOD
;
Wr_sig
<=
'0'
;
Data_bus
<=
(
others
=>
'Z'
);
adresse
<=
(
others
=>
'Z'
);
wait
for
CLK_PERIOD
;
end
config2
;
procedure
send
is
begin
Wr_sig
<=
'1'
;
adresse
<=
"001"
;
-- Sender data til Tx
Data_bus
<=
"10101010"
;
-- data
wait
for
CLK_PERIOD
;
wait
for
2
*
CLK_PERIOD
;
Wr_sig
<=
'0'
;
wait
for
20
*
CLK_PERIOD
;
wait
for
0
.
18
ms
;
adresse
<=
(
others
=>
'Z'
);
Data_bus
<=
(
others
=>
'Z'
);
wait
for
CLK_PERIOD
;
wait
for
0
.
05
ms
;
end
send
;
procedure
test_busy
is
begin
Rd_sig
<=
'1'
;
adresse
<=
"010"
;
--
K
on
figur
er
B
er om status
adresse
<=
"010"
;
--
C
on
troll
er
b
er om status
wait
for
2
*
CLK_PERIOD
;
Rd_sig
<=
'0'
;
adresse
<=
(
others
=>
'Z'
);
wait
for
CLK_PERIOD
;
wait
for
0
.
1
ms
;
end
test_busy
;
...
...
@@ -117,9 +135,16 @@ begin
begin
tb_init
;
wait
for
0
.
01
ms
;
config
;
wait
for
0
.
01
ms
;
send
;
test_busy
;
wait
for
0
.
05
ms
;
test_busy
;
config2
;
send
;
wait
for
0
.
1
ms
;
wait
for
100
ns
;
assert
false
report
"Testbench finished"
severity
failure
;
...
...
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