On 10/27/2016 03:33 AM, Martin Strubel wrote:
[snip]
> $ ./sim --interactive --port=2016
> 
> Python:
>> import ghdlex
>> def cond(signals):
>>    return True
>> ...
>> sim = ghdlex.connect(":2016")
>> sim.set("Timescale", "1ns")
>> s0 = ghdlex.StopCondition(cond)
>> sim.stop_conditions.insert(s0)
>> sim.start()
>> while sim.state() == ghdlex.RUNNING:
>>     time.sleep(0.1)
> 

Excellent idea. Like the saying "a picture is worth a thousand words",
so is an example or a demonstration. I think I understand now - many of
the people on this list are actually willing to use Python as a command
line shell interface. (I sometimes forget that Windows and GUI users
aren't steeped in [The Tao of Unix][1]).

[1]: https://gist.github.com/wmayner/d3a0ebf059982abbe3ad

> Well, if you'd embed the python interpreter as a cli which would fire up
> everything behind as a separate (asynchronous) thread, you could
> probably have both (a) and (b) using callbacks.
[snip]
> The ugly side of it (from an engineering side of view) is: I wouldn't
> know how Ada can interface with Python except going through a C API.

I think that road is well traveled [2]. Considering what is available,
embedding a big complicated Python interpreter might actually be easier
than embedding a simple little Tcl interpreter.

[2]:
http://www.adacore.com/adaanswers/gems/gem-106-lady-ada-kisses-python-part-2/


_______________________________________________
Ghdl-discuss mailing list
Ghdl-discuss@gna.org
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to