w11 - vhd
0.794
W11 CPU core and support modules
Toggle main menu visibility
Main Page
Packages
Package List
Design Units
Design Unit List
Design Unit Index
Design Unit Hierarchy
Design Unit Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions/Procedures/Processes
b
c
d
e
g
h
i
n
o
p
r
s
t
w
x
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Files
File List
File Members
All
t
Variables
t
•
All
Classes
Namespaces
Files
Functions
Variables
Loading...
Searching...
No Matches
serport_xontx_tb.vhd
Go to the documentation of this file.
1
-- $Id: serport_xontx_tb.vhd 1181 2019-07-08 17:00:50Z mueller $
2
-- SPDX-License-Identifier: GPL-3.0-or-later
3
-- Copyright 2011-2016 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
5
------------------------------------------------------------------------------
6
-- Module Name: serport_xontx_tb - sim
7
-- Description: serial port: xon/xoff logic tx path (SIM only!)
8
--
9
-- Dependencies: -
10
-- Test bench: -
11
-- Target Devices: generic
12
-- Tool versions: ghdl 0.29-0.31
13
-- Revision History:
14
-- Date Rev Version Comment
15
-- 2016-01-03 724 1.0 Initial version (copied from serport_xontx)
16
------------------------------------------------------------------------------
17
18
library
ieee
;
19
use
ieee.std_logic_1164.
all
;
20
use
ieee.numeric_std.
all
;
21
22
use
work.
slvtypes
.
all
;
23
use
work.
serportlib_tb
.
all
;
24
25
entity
serport_xontx_tb
is
-- serial port: xon/xoff logic tx path
26
port
(
27
CLK
:
in
slbit
;
-- clock
28
RESET
:
in
slbit
;
-- reset
29
ENAXON
:
in
slbit
;
-- enable xon/xoff handling
30
ENAESC
:
in
slbit
;
-- enable xon/xoff escaping
31
UART_TXDATA
:
out
slv8
;
-- uart data in
32
UART_TXENA
:
out
slbit
;
-- uart data enable
33
UART_TXBUSY
:
in
slbit
;
-- uart data busy
34
TXDATA
:
in
slv8
;
-- user data in
35
TXENA
:
in
slbit
;
-- user data enable
36
TXBUSY
:
out
slbit
;
-- user data busy
37
RXOK
:
in
slbit
;
-- rx channel ok
38
TXOK
:
in
slbit
-- tx channel ok
39
)
;
40
end
serport_xontx_tb
;
41
42
43
architecture
sim
of
serport_xontx_tb
is
44
45
type
regs_type
is
record
46
ibuf
:
slv8
;
-- input buffer
47
ival
:
slbit
;
-- ibuf has valid data
48
obuf
:
slv8
;
-- output buffer
49
oval
:
slbit
;
-- obuf has valid data
50
rxok
:
slbit
;
-- rx channel ok state
51
enaxon_1
:
slbit
;
-- last enaxon
52
escpend
:
slbit
;
-- escape pending
53
end
record
regs_type
;
54
55
constant
regs_init
:
regs_type
:=
(
56
(
others
=
>
'
0
'
)
,
'
0
'
,
-- ibuf,ival
57
(
others
=
>
'
0
'
)
,
'
0
'
,
-- obuf,oval
58
'
1
'
,
-- rxok (startup default is ok !!)
59
'
0
'
,
-- enaxon_1
60
'
0
'
-- escpend
61
)
;
62
63
signal
R_REGS
:
regs_type
:=
regs_init
;
-- state registers
64
signal
N_REGS
:
regs_type
:=
regs_init
;
-- next value state regs
65
66
begin
67
68
proc_regs:
process
(
CLK
)
69
begin
70
71
if
rising_edge
(
CLK
)
then
72
if
RESET
=
'
1
'
then
73
R_REGS
<=
regs_init
;
74
else
75
R_REGS
<=
N_REGS
;
76
end
if
;
77
end
if
;
78
79
end
process
proc_regs
;
80
81
proc_next:
process
(
R_REGS
,
ENAXON
,
ENAESC
,
UART_TXBUSY
,
82
TXDATA
,
TXENA
,
RXOK
,
TXOK
)
83
84
variable
r
:
regs_type
:=
regs_init
;
85
variable
n
:
regs_type
:=
regs_init
;
86
87
begin
88
89
r
:=
R_REGS
;
90
n
:=
R_REGS
;
91
92
if
TXENA
=
'
1
'
and
r
.
ival
=
'
0
'
then
93
n
.
ibuf
:=
TXDATA
;
94
n
.
ival
:=
'
1
'
;
95
end
if
;
96
97
if
r
.
oval
=
'
0
'
then
98
if
ENAXON
=
'
1
'
and
r
.
rxok
/=
RXOK
then
99
n
.
rxok
:=
RXOK
;
100
n
.
oval
:=
'
1
'
;
101
if
r
.
rxok
=
'
0
'
then
102
n
.
obuf
:=
c_serport_xon
;
103
else
104
n
.
obuf
:=
c_serport_xoff
;
105
end
if
;
106
elsif
TXOK
=
'
1
'
then
107
if
r
.
escpend
=
'
1
'
then
108
n
.
obuf
:=
not
r
.
ibuf
;
109
n
.
oval
:=
'
1
'
;
110
n
.
escpend
:=
'
0
'
;
111
n
.
ival
:=
'
0
'
;
112
elsif
r
.
ival
=
'
1
'
then
113
if
ENAESC
=
'
1
'
and
(
r
.
ibuf
=
c_serport_xon
or
114
r
.
ibuf
=
c_serport_xoff
or
115
r
.
ibuf
=
c_serport_xesc
)
116
then
117
n
.
obuf
:=
c_serport_xesc
;
118
n
.
oval
:=
'
1
'
;
119
n
.
escpend
:=
'
1
'
;
120
else
121
n
.
obuf
:=
r
.
ibuf
;
122
n
.
oval
:=
'
1
'
;
123
n
.
ival
:=
'
0
'
;
124
end
if
;
125
end
if
;
126
end
if
;
127
end
if
;
128
129
if
r
.
oval
=
'
1
'
and
UART_TXBUSY
=
'
0
'
then
130
n
.
oval
:=
'
0
'
;
131
end
if
;
132
133
-- FIXME: document this hack
134
n
.
enaxon_1
:=
ENAXON
;
135
if
ENAXON
=
'
1
'
and
r
.
enaxon_1
=
'
0
'
then
136
n
.
rxok
:=
not
RXOK
;
137
end
if
;
138
139
N_REGS
<=
n
;
140
141
TXBUSY
<=
r
.
ival
;
142
UART_TXDATA
<=
r
.
obuf
;
143
UART_TXENA
<=
r
.
oval
;
144
145
end
process
proc_next
;
146
147
end
sim;
serport_xontx_tb.sim
Definition:
serport_xontx_tb.vhd:43
serport_xontx_tb.sim.N_REGS
regs_type := regs_init N_REGS
Definition:
serport_xontx_tb.vhd:64
serport_xontx_tb.sim.regs_type
regs_type
Definition:
serport_xontx_tb.vhd:45
serport_xontx_tb.sim.R_REGS
regs_type := regs_init R_REGS
Definition:
serport_xontx_tb.vhd:63
serport_xontx_tb.sim.regs_init
regs_type :=(( others => '0'), '0',( others => '0'), '0', '1', '0', '0') regs_init
Definition:
serport_xontx_tb.vhd:55
serport_xontx_tb
Definition:
serport_xontx_tb.vhd:25
serport_xontx_tb.RESET
in RESET slbit
Definition:
serport_xontx_tb.vhd:28
serport_xontx_tb.TXENA
in TXENA slbit
Definition:
serport_xontx_tb.vhd:35
serport_xontx_tb.UART_TXENA
out UART_TXENA slbit
Definition:
serport_xontx_tb.vhd:32
serport_xontx_tb.TXOK
in TXOK slbit
Definition:
serport_xontx_tb.vhd:39
serport_xontx_tb.ENAESC
in ENAESC slbit
Definition:
serport_xontx_tb.vhd:30
serport_xontx_tb.ENAXON
in ENAXON slbit
Definition:
serport_xontx_tb.vhd:29
serport_xontx_tb.TXDATA
in TXDATA slv8
Definition:
serport_xontx_tb.vhd:34
serport_xontx_tb.CLK
in CLK slbit
Definition:
serport_xontx_tb.vhd:27
serport_xontx_tb.UART_TXDATA
out UART_TXDATA slv8
Definition:
serport_xontx_tb.vhd:31
serport_xontx_tb.RXOK
in RXOK slbit
Definition:
serport_xontx_tb.vhd:37
serport_xontx_tb.TXBUSY
out TXBUSY slbit
Definition:
serport_xontx_tb.vhd:36
serport_xontx_tb.UART_TXBUSY
in UART_TXBUSY slbit
Definition:
serport_xontx_tb.vhd:33
serportlib_tb
Definition:
serportlib_tb.vhd:22
slvtypes
Definition:
slvtypes.vhd:28
slvtypes.slbit
std_logic slbit
Definition:
slvtypes.vhd:30
slvtypes.slv8
std_logic_vector( 7 downto 0) slv8
Definition:
slvtypes.vhd:40
vlib
serport
tb
serport_xontx_tb.vhd
Generated on Thu Feb 9 2023 12:41:06 for w11 - vhd by
1.9.6