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.vhd
Go to the documentation of this file.
1
-- $Id: serport_xontx.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 - syn
7
-- Description: serial port: xon/xoff logic tx path
8
--
9
-- Dependencies: -
10
-- Test bench: -
11
-- Target Devices: generic
12
-- Tool versions: ise 13.1-14.7; viv 2014.4; ghdl 0.29-0.31
13
-- Revision History:
14
-- Date Rev Version Comment
15
-- 2011-11-13 425 1.0 Initial version
16
-- 2011-10-22 417 0.5 First draft
17
------------------------------------------------------------------------------
18
-- Note: for test bench usage a copy of all serport_* entities, with _tb
19
-- appended to the name, has been created in the /tb sub folder.
20
-- Ensure to update the copy when this file is changed !!
21
22
library
ieee
;
23
use
ieee.std_logic_1164.
all
;
24
use
ieee.numeric_std.
all
;
25
26
use
work.
slvtypes
.
all
;
27
use
work.
serportlib
.
all
;
28
29
entity
serport_xontx
is
-- serial port: xon/xoff logic tx path
30
port
(
31
CLK
:
in
slbit
;
-- clock
32
RESET
:
in
slbit
;
-- reset
33
ENAXON
:
in
slbit
;
-- enable xon/xoff handling
34
ENAESC
:
in
slbit
;
-- enable xon/xoff escaping
35
UART_TXDATA
:
out
slv8
;
-- uart data in
36
UART_TXENA
:
out
slbit
;
-- uart data enable
37
UART_TXBUSY
:
in
slbit
;
-- uart data busy
38
TXDATA
:
in
slv8
;
-- user data in
39
TXENA
:
in
slbit
;
-- user data enable
40
TXBUSY
:
out
slbit
;
-- user data busy
41
RXOK
:
in
slbit
;
-- rx channel ok
42
TXOK
:
in
slbit
-- tx channel ok
43
)
;
44
end
serport_xontx
;
45
46
47
architecture
syn
of
serport_xontx
is
48
49
type
regs_type
is
record
50
ibuf
:
slv8
;
-- input buffer
51
ival
:
slbit
;
-- ibuf has valid data
52
obuf
:
slv8
;
-- output buffer
53
oval
:
slbit
;
-- obuf has valid data
54
rxok
:
slbit
;
-- rx channel ok state
55
enaxon_1
:
slbit
;
-- last enaxon
56
escpend
:
slbit
;
-- escape pending
57
end
record
regs_type
;
58
59
constant
regs_init
:
regs_type
:=
(
60
(
others
=
>
'
0
'
)
,
'
0
'
,
-- ibuf,ival
61
(
others
=
>
'
0
'
)
,
'
0
'
,
-- obuf,oval
62
'
1
'
,
-- rxok (startup default is ok !!)
63
'
0
'
,
-- enaxon_1
64
'
0
'
-- escpend
65
)
;
66
67
signal
R_REGS
:
regs_type
:=
regs_init
;
-- state registers
68
signal
N_REGS
:
regs_type
:=
regs_init
;
-- next value state regs
69
70
begin
71
72
proc_regs:
process
(
CLK
)
73
begin
74
75
if
rising_edge
(
CLK
)
then
76
if
RESET
=
'
1
'
then
77
R_REGS
<=
regs_init
;
78
else
79
R_REGS
<=
N_REGS
;
80
end
if
;
81
end
if
;
82
83
end
process
proc_regs
;
84
85
proc_next:
process
(
R_REGS
,
ENAXON
,
ENAESC
,
UART_TXBUSY
,
86
TXDATA
,
TXENA
,
RXOK
,
TXOK
)
87
88
variable
r
:
regs_type
:=
regs_init
;
89
variable
n
:
regs_type
:=
regs_init
;
90
91
begin
92
93
r
:=
R_REGS
;
94
n
:=
R_REGS
;
95
96
if
TXENA
=
'
1
'
and
r
.
ival
=
'
0
'
then
97
n
.
ibuf
:=
TXDATA
;
98
n
.
ival
:=
'
1
'
;
99
end
if
;
100
101
if
r
.
oval
=
'
0
'
then
102
if
ENAXON
=
'
1
'
and
r
.
rxok
/=
RXOK
then
103
n
.
rxok
:=
RXOK
;
104
n
.
oval
:=
'
1
'
;
105
if
r
.
rxok
=
'
0
'
then
106
n
.
obuf
:=
c_serport_xon
;
107
else
108
n
.
obuf
:=
c_serport_xoff
;
109
end
if
;
110
elsif
TXOK
=
'
1
'
then
111
if
r
.
escpend
=
'
1
'
then
112
n
.
obuf
:=
not
r
.
ibuf
;
113
n
.
oval
:=
'
1
'
;
114
n
.
escpend
:=
'
0
'
;
115
n
.
ival
:=
'
0
'
;
116
elsif
r
.
ival
=
'
1
'
then
117
if
ENAESC
=
'
1
'
and
(
r
.
ibuf
=
c_serport_xon
or
118
r
.
ibuf
=
c_serport_xoff
or
119
r
.
ibuf
=
c_serport_xesc
)
120
then
121
n
.
obuf
:=
c_serport_xesc
;
122
n
.
oval
:=
'
1
'
;
123
n
.
escpend
:=
'
1
'
;
124
else
125
n
.
obuf
:=
r
.
ibuf
;
126
n
.
oval
:=
'
1
'
;
127
n
.
ival
:=
'
0
'
;
128
end
if
;
129
end
if
;
130
end
if
;
131
end
if
;
132
133
if
r
.
oval
=
'
1
'
and
UART_TXBUSY
=
'
0
'
then
134
n
.
oval
:=
'
0
'
;
135
end
if
;
136
137
-- FIXME: document this hack
138
n
.
enaxon_1
:=
ENAXON
;
139
if
ENAXON
=
'
1
'
and
r
.
enaxon_1
=
'
0
'
then
140
n
.
rxok
:=
not
RXOK
;
141
end
if
;
142
143
N_REGS
<=
n
;
144
145
TXBUSY
<=
r
.
ival
;
146
UART_TXDATA
<=
r
.
obuf
;
147
UART_TXENA
<=
r
.
oval
;
148
149
end
process
proc_next
;
150
151
end
syn;
serport_xontx.syn
Definition:
serport_xontx.vhd:47
serport_xontx.syn.N_REGS
regs_type := regs_init N_REGS
Definition:
serport_xontx.vhd:68
serport_xontx.syn.regs_type
regs_type
Definition:
serport_xontx.vhd:49
serport_xontx.syn.R_REGS
regs_type := regs_init R_REGS
Definition:
serport_xontx.vhd:67
serport_xontx.syn.regs_init
regs_type :=(( others => '0'), '0',( others => '0'), '0', '1', '0', '0') regs_init
Definition:
serport_xontx.vhd:59
serport_xontx
Definition:
serport_xontx.vhd:29
serport_xontx.RESET
in RESET slbit
Definition:
serport_xontx.vhd:32
serport_xontx.TXENA
in TXENA slbit
Definition:
serport_xontx.vhd:39
serport_xontx.UART_TXENA
out UART_TXENA slbit
Definition:
serport_xontx.vhd:36
serport_xontx.TXOK
in TXOK slbit
Definition:
serport_xontx.vhd:43
serport_xontx.ENAESC
in ENAESC slbit
Definition:
serport_xontx.vhd:34
serport_xontx.ENAXON
in ENAXON slbit
Definition:
serport_xontx.vhd:33
serport_xontx.TXDATA
in TXDATA slv8
Definition:
serport_xontx.vhd:38
serport_xontx.CLK
in CLK slbit
Definition:
serport_xontx.vhd:31
serport_xontx.UART_TXDATA
out UART_TXDATA slv8
Definition:
serport_xontx.vhd:35
serport_xontx.RXOK
in RXOK slbit
Definition:
serport_xontx.vhd:41
serport_xontx.TXBUSY
out TXBUSY slbit
Definition:
serport_xontx.vhd:40
serport_xontx.UART_TXBUSY
in UART_TXBUSY slbit
Definition:
serport_xontx.vhd:37
serportlib
Definition:
serportlib.vhd:36
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
serport_xontx.vhd
Generated on Thu Feb 9 2023 12:41:06 for w11 - vhd by
1.9.6