File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
from amaranth import *
4
4
from amaranth .lib .cdc import *
5
- from amaranth_stdio .serial import AsyncSerial
5
+ from amaranth_stdio .serial import AsyncSerial , AsyncSerialTX
6
6
7
7
from .time .timer import *
8
8
from ..interface import stream
9
9
10
10
11
11
__all__ = [
12
12
"AsyncSerialStream" ,
13
+ "AsyncSerialTXStream" ,
13
14
"AsyncSerialStreamHalfDuplex" ,
14
15
]
15
16
16
17
18
+ class AsyncSerialTXStream (Elaboratable ):
19
+ def __init__ (self , o , * args , ** kwargs ):
20
+ self ._serial = AsyncSerialTX (* args , ** kwargs )
21
+ self ._o = o
22
+ dw = len (self ._serial .data )
23
+ self .sink = stream .Endpoint ([("data" , dw )])
24
+
25
+ def elaborate (self , platform ):
26
+ m = Module ()
27
+ m .submodules += self ._serial
28
+
29
+ m .d .comb += [
30
+ self ._serial .data .eq (self .sink .data ),
31
+ self ._serial .ack .eq (self .sink .valid ),
32
+ self .sink .ready .eq (self ._serial .rdy ),
33
+ self ._o .eq (self ._serial .o ),
34
+ ]
35
+
36
+ return m
37
+
38
+
17
39
class AsyncSerialStream (Elaboratable ):
18
40
""" Stream wrapper around AsyncSerial.
19
41
You can’t perform that action at this time.
0 commit comments