Most people who want to simulate logic ICs will use Verilog, VHDL, or System Verilog. Not [hsoft]. He wanted to use Python, and wrote a simple Python framework for doing just that. You can find the code on GitHub, and there is an ASCII video that won’t embed here at Hackaday, but which you can view at ASCIInema.
Below the break we have an example of “constructing” a circuit in Python using ICemu:
dec = SN74HC138() sr1 = CD74AC164() sr2 = CD74AC164() mcu_pin = OutputPin('PB4') sr1.pin_CP.wire_to(dec.pin_Y0) sr2.pin_CP.wire_to(dec.pin_Y1) sr1.pin_DS1.wire_to(mcu_pin) sr2.pin_DS1.wire_to(mcu_pin) print(dec.asciiart()) _______ A>|- U +|>Y7 B>|- +|>Y6 C>|- +|>Y5 G2A>|- +|>Y4 G2B>|- +|>Y3 G1>|+ +|>Y2 Y0<|-___+|>Y1
Note that the + and – signs show the current state of the pin.
Useful? Depends. If you are using Python anyway or trying to integrate with other Python code — or even another language that binds with Python — it might be useful. On the other hand, if you don’t have a reason to use Python, you will probably get more help, examples, and jobs by learning Verilog or another conventional hardware definition language. If you insist, you might consider using Python that can synthesize to an FPGA, at least.
I’m waiting for a command-line version of Logisim now.
Now I want to use a (mono-spaced) courier font and JavaScript to do something similar in a browser window just for the ‘retro’ look.
http://sensi.org/~svo/glasstty/
o;-)
…ok… it doesn’t scale well but for some special occasions of “nostalgeric atacks” it is just right…
Nice! I just installed the font and made a iTerm2 profile for a green 80×25 vt220 setup….
Anyone tried https://github.com/m-labs/migen? Its a toolbox for building complex digital hardware in Python instead oif Verliog or VHDL.
VHDL is not that bad. There’s a learning curve but any Hackaday person can get going on TTL type designs pretty quickly. For me the real challenge was getting going with Vivado, which takes some time. Lots of pieces and parts.
not that bad, but verilog is the best :) only joking, it’s depend on the person…
Vivado!!! I use Xilinx ISE,
For newbies I always recommend Altera Quartus for a number of reasons –
The chips FPGA/CPLD are not a lot different in cost
Xilinx hardware programmer $35 – Altera hardware programmer $5
Xilinx ISE (code environment) requires a hard to get registration key – Altera Quartus runs from install
Xilinx ISE is hard to use and generates a lot of confusing warnings/errors – Altera is easier to use.
Once your on your feet then you will be able to appreciate some of the advanced features of the Xilinx ISE but start with Altera Quartus first.
i would say: http://www.myhdl.org/ for logic ic simulation with python
That looks OK. I wonder what is a good choice to use with Jupyter/iPython Notebook.
Sadly, propagation times are not simulated in this python package.
Fortunately, there are other alternatives that do: https://github.com/FabriceSalvaire/PySpice
Oi! Emulation of anything in Python is really slow bad news. >_<;
Why would anyone use this instead of one of many modeling and simulation packages? For example LTSpice, Proteus, Yenka, Electronics Workbench, Crocodile Clips to name the few I used. Why would I write my own component descriptions when there are models ready to use in spice format?
I dunno about this Python thing, but SPICE is a PAIN when it comes to digital – it’s an analog user-land in SPICE. Taming transients in SPICE takes a lot of experience. But it can be done, and often it is the best way to solve problems via simulation (given proven device models of-course). LTSpice has logic libraries you can freely download and install from the LTSpice Yahoo group (yup, it’s still on Yahoo Groups, and IMO that’s OK for now).
Hi, author here.
I created this mainly because I wanted to explore the problem domain, but also because Verilog-based simulator seem to be used to design circuits. That’s not what I want. I want a tool to help me debug the software I’m flashing on MY MCU. I want to plug that software directly into a simulated circuit. I’ve updated the README to add clarity: https://github.com/hsoft/icemu#comparison-with-verilogvhdl
Also, I don’t use proprietary software, so that limits my choices a bit. The world of Verilog simulators seems to be dominated by proprietary software. Thanks for the reference to PySpice, I didn’t know about it. I’m looking it up now.
I am also using verilog in my academics. I am more used to Python and thus for me its a great news.