this post was submitted on 14 Jan 2025
35 points (100.0% liked)

Programming

17849 readers
164 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 2 years ago
MODERATORS
 

Weird title, sorry. Let me try and explain.

Goal: Convert simple higher level script into a low level logic gate mess. Basically, I want to build my own custom computers in Factorio with circuit networks. I can easily create any type of logic gate that I want, similar to how computers Minecraft have been built, but with more options.

It would be super nice to code in something similar to Python but have it "compile" into clusters of logic gates. Of course, functionality would be extremely limited, but that is OK and I don't need to boil the ocean.... yet...

(TBH, this sounds really close to what I know about programming FPGAs.)

top 9 comments
sorted by: hot top controversial new old
[–] FizzyOrange 5 points 3 days ago

Yeah Verilog. That's literally the language people use to design chips and FPGA bitstreams.

Someone has already done it: https://github.com/Redcrafter/verilog2factorio

[–] nikstarling 38 points 6 days ago (1 children)

Don't know about Python like languages but is sounds like something like Verilog or VHDL may be suitable for your case

[–] [email protected] 22 points 6 days ago

This is exactly it. The various *HDLs are explicitly written to create systems of logic gates.

[–] K2yfi 4 points 4 days ago

Sounds like you should take a look at https://www.nand2tetris.org/. Basically it walks through the process of building up a game like Tetris starting from logic gates. It has you write a very simple compiler for a mini language where you've built everything up from the base logic gates level, so it should be a pretty good guide for what you want.

[–] [email protected] 3 points 4 days ago* (last edited 4 days ago)

These guys are floating around berlin and its FOSS afaik.

Basicallly i think its a c++ library to help you write fgpa language for fgpa controllers (which are logic gates )

https://www.synogate.com/

https://github.com/synogate/gatery

Not sure how close it will get you to your needs but feels on topic.

[–] towerful 3 points 5 days ago

I stumbled across Amaranth a while ago. It's been years since I've done FPGA programming, and I haven't had a reason to get into it again.
But Amaranth seems like a cool paradigm instead of AHDL/VHDL.

https://github.com/amaranth-lang/amaranth

[–] [email protected] 4 points 5 days ago
[–] [email protected] 1 points 6 days ago (1 children)
[–] [email protected] 1 points 5 days ago

Not sure if that will help in this particular case, but that looks super neat anyway. I have been planning to build a custom modular synthesizer so I'll try that out anyway. (Thankfully, it's Kicad integration is free. Yay!)