Skip to content

Commit b157031

Browse files
committedMar 9, 2015
uart/sim: add pty (optional, to use flterm)
1 parent 6cbf130 commit b157031

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎misoclib/com/uart/phy/sim.py

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os, pty, time
2+
13
from migen.fhdl.std import *
24
from migen.flow.actor import Sink, Source
35

@@ -15,3 +17,14 @@ def __init__(self, pads, *args, **kwargs):
1517
self.source.data.eq(pads.sink_data),
1618
pads.sink_ack.eq(self.source.ack)
1719
]
20+
21+
m, s = pty.openpty()
22+
name = os.ttyname(s)
23+
print("UART tty: "+name)
24+
time.sleep(0.5) # pause for user
25+
f = open("/tmp/simserial", "w")
26+
f.write(os.ttyname(s))
27+
f.close()
28+
29+
def do_exit(self, *args, **kwargs):
30+
os.remove("/tmp/simserial")

0 commit comments

Comments
 (0)
Please sign in to comment.