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.