[HN Gopher] Show HN: Verilog2factorio
       ___________________________________________________________________
        
       Show HN: Verilog2factorio
        
       Author : linux_is_nice
       Score  : 293 points
       Date   : 2021-04-25 00:31 UTC (22 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | linux_is_nice wrote:
       | Repo updated with examples.
        
       | fredley wrote:
       | I would love the inverse as well: Factorio2Verilog. Then I can
       | use Factorio as an IDE.
        
       | spicybright wrote:
       | They couldn't put in a sentence stating what this actually does?
        
         | smoldesu wrote:
         | I'm no expert on the topic, but it looks like a protocol for
         | interpreting hardware logic into a Factorio game board.
        
         | pinum wrote:
         | I'd imagine the target audience for this consists entirely of
         | people who already know what Verilog and Factorio are. And if
         | you're part of that intersection then it's instantly obvious
         | what it does from the title alone.
        
         | avereveard wrote:
         | They managed to describe fully what it does in the project name
         | and post title.
         | 
         | Unless you want an explanation of what verilog and factorio
         | are, but then that sounds like it's another question from "what
         | this project does".
        
         | dvfjsdhgfv wrote:
         | Verilog is a hardware description language. So for example you
         | could use it to program your FPGA (FPGA is a digital circuit
         | you program from scratch). Factorio is an interesting video
         | game where you basically use limited resources to construct
         | factories that build different objects, the success depending
         | on how well you design and optimize your factories.
        
       | Mister_Snuggles wrote:
       | I would love to see some screenshots added to the README.
       | 
       | I get that it compiles a Verilog design into a Factorio
       | Blueprint, but what does the resulting factory look like? Is it
       | just a bunch of wires and combinators?
        
         | dmoy wrote:
         | > but what does the resulting factory look like? Is it just a
         | bunch of wires and combinators?
         | 
         | It seems like... yes?
         | 
         | https://user-images.githubusercontent.com/35386456/115978429...
        
           | tasogare wrote:
           | Kinda looks like the shape of Africa, I wonder if it's ln
           | purpose.
        
           | Mister_Snuggles wrote:
           | Cool! The screenshots added since I commented definitely help
           | make this understandable!
           | 
           | I can definitely see some players building parts of their
           | factories using this.
        
       | nickysielicki wrote:
       | I did not expect this to be written in TypeScript.
       | 
       | The intersection of people who really understand Factorio,
       | Verilog, and TypeScript has to be less than 250,000 people on
       | entire planet -- in the entire universe.
        
         | nexuist wrote:
         | If you write your own language the only people who know how to
         | use it is 1 :)
        
         | ummonk wrote:
         | I think "250,000" is still orders of magnitude too high - I
         | would bet you that the number of people who simply know verilog
         | is lower than 250,000.
        
           | VWWHFSfQ wrote:
           | I would bet it's less than 10,000 in the entire world.
        
             | userbinator wrote:
             | This feels a bit like that classic estimation interview
             | question...
             | 
             | Verilog originated in 1984 and educational institutions
             | have been teaching it roughly as long, multiply by how many
             | students graduate each year in an EE-related field and I'm
             | pretty sure the number is far more than that in India
             | alone.
             | 
             | Of course, the number of people who know Verilog (and
             | Factorio) enough to implement something like this is going
             | to be a fraction of that.
        
               | ummonk wrote:
               | I don't consider "took a class in it" sufficient to
               | constitute "really understand" in most subjects. Classes
               | often don't actually teach actual understanding of the
               | subject, and even when they do, most people end up
               | forgetting it afterwards.
        
               | jakear wrote:
               | Sure, but there's a difference between "had a couple
               | courses using it in college" and "have an understanding
               | of the language sufficient to develop a novel backend".
        
               | devit wrote:
               | You don't need much understanding in advance to develop a
               | novel backend, since you are forced and guided to learn
               | the whole language as you try to write the backend and
               | start pattern matching on the data structures.
        
               | themulticaster wrote:
               | This project actually uses Yosys. From a quick glance at
               | the code, this tool essentially uses Yosys for the heavy-
               | duty logic stuff [1], resulting in a JSON-based logic
               | definition using a couple of standard cells (DFF, MUX,
               | arithmetic, etc.) that verilog2factorio parses [2] and
               | translates into predefined Factorio blueprints. The only
               | part that I couldn't find would be laying out the cells
               | into the overall blueprint (and performing routing).
               | 
               | [1] https://github.com/Redcrafter/verilog2factorio/blob/9
               | 691b702...
               | 
               | [2] https://github.com/Redcrafter/verilog2factorio/blob/9
               | 691b702...
        
               | linux_is_nice wrote:
               | It does simulated annealing in src/sim.ts, I think.
        
               | harry8 wrote:
               | Some saw/earnt vhdl someone after it emerged. ~half?
               | Verilog had a popularity ramp up time of a few years too.
               | I'm going with a much smaller number than you there.
               | Could be way wrong!
        
               | pjmlp wrote:
               | VHDL/Verilog is a bit like Pascal/C division used to be,
               | with VHDL having more fans in Europe and Verilog on US,
               | and then the respective countries that do business with
               | them.
               | 
               | At least that is how I understand the market division, it
               | might also be that one of them has already won, not sure
               | about that.
        
               | RugnirViking wrote:
               | Can confirm was taught vhdl in my robotics master's
               | degree this year, studying in Europe
        
               | themulticaster wrote:
               | I think the apparent increase in Verilog popularity is
               | due to pretty much all FOSS toolchains (i.e. mostly
               | Yosys) only supporting Verilog [1], so most of the
               | content publicly visible on blogs etc. uses Verilog.
               | 
               | And I guess the reason that most tooling focuses on
               | Verilog is that the VHDL standard is a little bit of a
               | mess from a parsing point of view. Essentially, in order
               | to correctly parse some VHDL file A you first need to
               | parse _every other_ file that A might depend on. [2]
               | Source: Tried writing a VHDL parser a few years ago.
               | 
               | [1] AFAIK you can buy a license for a VHDL frontend from
               | one of the companies contributing to Yosys, but that's a
               | different story.
               | 
               | [2] Example: What is f(1)? It could be a) calling a
               | function called f with a parameter_association_list
               | consisting of 1 or b) an indexed name, accessing an array
               | called f at index 1, or c) some other things if we're not
               | currently in an expression context. The only way to parse
               | this correctly is to know what f is, but if f is not
               | defined in the file you're currently parsing, there's no
               | way to know other than parsing all other files...
        
         | iamgopal wrote:
         | I bet it's less than 10000.
        
         | username90 wrote:
         | TypeScript pays better than verilog, so I bet quite a lot of
         | people who learned verilog knows it.
        
         | pjmlp wrote:
         | I love it, because we are finally getting into the state that
         | people don't cargo cult C and C++ as being the only path to
         | write compiler related tools.
        
         | tobyjsullivan wrote:
         | But the number of people who understand verilog, but not
         | typescript (or at least javascript), is probably close to zero.
        
           | methyl wrote:
           | But to use TS as a language of choice? Different story.
        
           | oldgradstudent wrote:
           | You haven't met a lot of electrical engineers.
        
           | oxymoron wrote:
           | That seems unlikely. Plenty of electronics engineers working
           | in Verilog, who haven't ever glanced at Javascript.
        
         | [deleted]
        
       | MisterBiggs wrote:
       | Always thought programmatically generating Factorio blueprints
       | was a really cool idea and Verilog seems like a great language to
       | model blueprints, but this repo definitely needs more work before
       | being shared with the world.
       | 
       | One of my favorite tools that shows what's possible:
       | https://autotorio.com/example/outpost
        
         | ddlsmurf wrote:
         | Oh yeah, it's not production ready, to all who depend on it be
         | warned !
        
         | ac42 wrote:
         | Great idea to comment on someone else's post on HN by pointing
         | to related work, but the communication standards of the parent
         | definitely need some work before being unleashed to the world.
        
           | MisterBiggs wrote:
           | > Great idea to comment on someone else's post on HN by
           | pointing to related work
           | 
           | Almost every Show HN has references to other similar works in
           | the comments. The point is to have a good discussion and I
           | think talking about similar works is highly relevant.
        
             | boomlinde wrote:
             | Hence GP earnestly calling it a great idea.
        
         | thurn wrote:
         | Neat, I'd never seen outpost generator before, quite useful. I
         | wish it were possible to generate blueprints directly from mods
         | so stuff like that could be directly integrated into the game.
        
         | codetrotter wrote:
         | > this repo definitely needs more work before being shared with
         | the world
         | 
         | No, don't say that :( I see way too many people that don't want
         | to share their code because they don't think it's tidy enough
         | or complete enough and that they just need to clean it up or
         | adding some more features. But the thing is that they never get
         | around to cleaning it up or adding those features and therefore
         | they never share it. And often times I have seen this happen
         | with stuff that is really good and usable.
         | 
         | "Perfect is the enemy of good" applies 100% in such cases.
        
           | MisterBiggs wrote:
           | The repo totally stands on its own now but when I made the
           | comment it was only a few sample files and a readme with a
           | few lines on how to install the project without any mention
           | of what the project actually was besides its name. Now with a
           | proper readme and some pictures I think it's much better.
        
         | lytedev wrote:
         | No reason not to share works on progress with the world!
        
       | celeritascelery wrote:
       | I love this! would love to see this used in a introduction to
       | hardware course.
        
       | interrealmedium wrote:
       | That's it, I am done. No more serious IT work for me. I am going
       | to become a gamers consultant. If there are people who care
       | enough to make things like this, there must be people who would
       | pay decent money for "professionals" to come in and optimize
       | their factorio game, or their minecraft builds, or to make them
       | feel good about their solution to a Zachtronics puzzle.
        
         | emteycz wrote:
         | The key is in streaming your work.
        
         | meristohm wrote:
         | I'm guessing you're mostly not serious, though I acknowledge
         | there may be a market for what you describe.
         | 
         | As a lifelong gamer since the Commodore 64 (since parenthood
         | scaling it way back to mostly crewing a tank in Hell Let Loose
         | with two friends, or a ttrpg with same), looking back it feels
         | like I took refuge in a medium (single-player games) ultimately
         | less valuable than other-format stories, like books, film, and
         | radioplays. What I'm driving at is a feeling that I've enjoyed
         | elevated layers of luxury that may be an indicator of too much
         | idle time for too many people in US culture. Is this a common
         | mindshift with age?
         | 
         | Escape has a place, but a whole industry built around spending
         | so much time in abstraction layers feels like a problem if it's
         | not helping us relate to each other better.
        
           | scrollaway wrote:
           | Video games are just a younger medium than books and movies.
           | Even TV needed more time to be seen at a similar level to
           | movies in terms of art.
           | 
           | We're getting there though. The past 15 years have given us
           | many masterpieces of gaming that can absolutely be considered
           | art, and they're becoming more and more common. As this
           | happens more and more, the medium is taken more and more
           | seriously.
           | 
           | Many games still suffer from feature-creep by way of trying
           | to please users demanding "content". This incidentally make
           | them feel like the primary goal _is_ to waste time rather
           | than to experience a high quality story. In other words,
           | there are still too many  "Big Bang Theory" and not enough
           | "Breaking Bad" so that is why it still feels less valuable.
           | 
           | Because I told you I just binged The Queen's Gambit, you
           | wouldn't look at me like I wasted my time, you'd ask me about
           | the story. If I told you I just binged TBBT, you'd just think
           | I'm nuts. (No offense if you like TBBT, it was a decent
           | sitcom for a couple seasons, but ... hey, you do you).
           | 
           | For example, I just finished Control. A wonderful, high
           | quality game. Great storytelling, great mechanics, and ... a
           | crapton of completely useless busywork that is just there
           | because it's expected to be there. A talent tree, repeat
           | random side-missions, a crafting system, etc. None of this is
           | useful to the core game. It's a shame because I believe if it
           | had done _less_ in terms of busywork mechanics and maybe
           | focused a tiny bit more on puzzles, that game could have been
           | a masterpiece of the same caliber as Portal and Portal 2.
           | (Can you imagine if Portal 2 had a talent tree and a crafting
           | system?)
           | 
           | Instead, it's a Season 7 of Game of Thrones. Great production
           | value, but so hit and miss in terms of final quality because
           | of avoidable mistakes. Could have been so good, you know?
        
         | avereveard wrote:
         | > minecraft builds
         | 
         | Yeah that's the whole point of Roblox bucks for example, paying
         | creatives for their builds
        
           | interrealmedium wrote:
           | No doubt, gaming support has been a serious business for a
           | while. Far beyond the gold farming, item trade, and "pay me
           | for voice chat" underground. I'd take a bet that almost
           | everybody reading this who cares about cloud providers has
           | come into contact with companies who started out by providing
           | servers and administration services for Counter Strike or
           | Minecraft.
        
       | Animats wrote:
       | There's also Verilog to Minecraft.[1]
       | 
       | [1] https://github.com/itsFrank/MinecraftHDL
        
       | derekja wrote:
       | wow, this is pretty cool!
        
       | 29athrowaway wrote:
       | Someone needs to make a video about this.
        
       | [deleted]
        
       | userbinator wrote:
       | Seeing that 6502 reminds me that ARM also provides a free
       | (restricted license) version of the Cortex-M0 and M3 cores in
       | Verilog format...
        
       | naikrovek wrote:
       | well how many man-hours do you need to intentionally waste before
       | it is a good reason to not share? where's that line, for you?
       | 
       | one of the worst things about open source is all the absolute
       | crap that is claiming to be useful. how many man-millennia have
       | been wasted because of the armies of people who have posted
       | something they're proud of, but is complete rubbish, on
       | npmjs.org?
        
         | scrollaway wrote:
         | Wow please stop with this gatekeeping. Seriously, people
         | "posting their crap" is a great thing about open source. More
         | should be encouraged to do so. If you look at my github profile
         | you'll find the crap I wrote when I was 15 and still learning
         | lua and python. The repos are of course archived and not
         | claiming to be "web scale and enterprise ready", but nobody
         | should shy away from learning in the open.
         | 
         | You know what the worst thing about open source actually is?
         | People who aren't owed anything, demanding to only see high
         | quality code for their free enjoyment.
         | 
         | Seriously, this is a neat clearly proof of concept tool for a
         | video game that is entirely about wasting time.
        
           | naikrovek wrote:
           | you think _I 'm_ the one gatekeeping, here? holy cow. look in
           | a mirror.
           | 
           | it is not the crap out there that I was complaining about.
           | read my comment again. it is the crap (read: non-useful
           | stuff) _claiming to be useful_.
           | 
           | please publish all the stuff you want. useful or not. I don't
           | care. nor does anyone else.
           | 
           | don't publish anything crappy (again, I mean non-useful) and
           | claim it is useful. that is my beef.
           | 
           | reading comprehension is important.
        
             | TylerE wrote:
             | Where is this code ever claimed to be useful?
        
               | naikrovek wrote:
               | am not talking about this code, and never was.
        
             | scrollaway wrote:
             | I understood your comment just fine. Yes you are the one
             | gatekeeping. No, people still don't owe you high quality
             | code.
             | 
             | If a repo claims to be something that it isn't, you can
             | complain (to the extent that it's polite and that your
             | complaint might well be ignored regardless). Better yet
             | would be to contribute.
             | 
             | The last repository whose quality-to-claimed-usefulness
             | ratio was bad enough that it got me to complain, I now
             | maintain. Be the change you want to see, instead of
             | muttering about man-hours.
        
           | dang wrote:
           | Please don't respond by taking threads further into flamewar.
           | I get that your intention is positive but when you do it this
           | way it does at least as much harm as good. If you took out
           | the swipes it would work much better.
           | 
           | In fact, if the entire comment were just the third paragraph,
           | it would be just fine.
           | 
           | https://news.ycombinator.com/newsguidelines.html
        
             | scrollaway wrote:
             | Ok, I've edited my comment to make it less hostile.
        
               | dang wrote:
               | If you still open with "Wow please stop with this
               | gatekeeping" then you're still breaking the site
               | guidelines. Please do better. Threads deteriorate more
               | from people's reactions to bad comments then they do from
               | the bad comments themselves. Much more, actually, because
               | flamewars wouldn't spread at all if the only reactions
               | were downvotes and flags.
        
               | scrollaway wrote:
               | I've removed the inflammatory stuff, it was out of line.
               | But calling people out on gatekeeping others from
               | contributing in open source is not that, i disagree.
               | 
               | I usually just flag and move on, i probably should have
               | done that here too, but i stand by what's left of my
               | comment post-edit.
        
               | dang wrote:
               | If you're tempted to use the phrase "calling out", you're
               | probably not in the intended spirit of this site.
               | 
               | https://hn.algolia.com/?dateRange=all&page=0&prefix=true&
               | que...
               | 
               | That kind of thing has poisonous systemic effects. It's
               | not worth it.
               | 
               | https://hn.algolia.com/?dateRange=all&page=0&prefix=true&
               | que...
               | 
               | Btw, I agree with you on the underlying point. But how
               | one goes about making _right_ points is exceedingly
               | important. It may be more important than wrongness,
               | although that 's an unfashionable perspective at the
               | moment.
        
               | scrollaway wrote:
               | Fair enough.
        
         | paulv wrote:
         | > how many man-millennia have been wasted because of the armies
         | of people who have posted something they're proud of, but is
         | complete rubbish, on npmjs.org?
         | 
         | None. If someone is proud of something they worked hard on, why
         | shouldn't they post it? What is the harm their hard work being
         | public causes? It hurts literally no one.
        
         | [deleted]
        
         | dang wrote:
         | Please follow the site guidelines that ask you (a) not to take
         | HN threads on flamewar tangents, and (b) not to fulminate.
         | Those things lead to less interesting conversation.
         | 
         | https://news.ycombinator.com/newsguidelines.html
         | 
         | We detached this subthread from
         | https://news.ycombinator.com/item?id=26929780.
        
       ___________________________________________________________________
       (page generated 2021-04-25 23:02 UTC)