{"id":21675181,"url":"https://github.com/alokmenghrajani/adventofcode2018","last_synced_at":"2025-10-30T10:34:06.828Z","repository":{"id":144928911,"uuid":"160024456","full_name":"alokmenghrajani/adventofcode2018","owner":"alokmenghrajani","description":"Advent of Code 2018. Solutions using Verilog + icestick fpga! ☃️🎄🎁🦌🎅","archived":false,"fork":false,"pushed_at":"2018-12-26T04:27:56.000Z","size":19780,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-20T09:19:00.715Z","etag":null,"topics":["2018","advent-of-code-2018","advent-of-code-2018-fpga","adventofcode","adventofcode2018","fpga","solutions","upping-the-ante","verilog"],"latest_commit_sha":null,"homepage":"https://adventofcode.com/2018","language":"Verilog","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alokmenghrajani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-02T07:37:10.000Z","updated_at":"2024-04-01T05:50:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"5761af31-325a-46a6-8bac-34b442ce85b9","html_url":"https://github.com/alokmenghrajani/adventofcode2018","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alokmenghrajani/adventofcode2018","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokmenghrajani%2Fadventofcode2018","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokmenghrajani%2Fadventofcode2018/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokmenghrajani%2Fadventofcode2018/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokmenghrajani%2Fadventofcode2018/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alokmenghrajani","download_url":"https://codeload.github.com/alokmenghrajani/adventofcode2018/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokmenghrajani%2Fadventofcode2018/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279009755,"owners_count":26084645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2018","advent-of-code-2018","advent-of-code-2018-fpga","adventofcode","adventofcode2018","fpga","solutions","upping-the-ante","verilog"],"created_at":"2024-11-25T13:51:22.321Z","updated_at":"2025-10-12T01:23:36.584Z","avatar_url":"https://github.com/alokmenghrajani.png","language":"Verilog","readme":"# adventofcode2018\nMy attempt at solving [Advent of Code 2018](https://adventofcode.com/2018) using Verilog + icestick fpga.\n\n![icestick](icestick/board.jpg)\n\nThe Lattice icestick is a [cheap](https://www.digikey.com/product-detail/en/lattice-semiconductor-corporation/ICE40HX1K-STICK-EVN/220-2656-ND/4289604) (~$25) FPGA development board with a complete [open source](http://www.clifford.at/icestorm/) toolkit. The board works on Linux, Mac OS X and Windows.\n\nI was initially planning to just use the plain board, but it seems I'm going to need a flash?\n\n## Why?\nWhy not!\n_(also, a good excuse for me to learn some Verilog)_\n\n## Goal\nSolve each day's puzzle using Verilog and the icestick FPGA. I initially was planning to use the actual puzzle\ninputs, but getting things to work on this FPGA is tricky because there's a limited number of logic cells (about 1000) and also a very limited amount of ram (8kB).\n\nThe FPGA tooling is also not designed with performance in mind. E.g. iverilog is extremely slow, yosys fails with\nsome large inputs, etc.\n\nUsing the smaller sample inputs makes it potentially possible to solve each day's puzzle.\n\n## Input / Ouput\nThe puzzle input is encoded either as ram or logic cells (depending on the puzzle input). A custom ruby script [gen.rb](https://github.com/alokmenghrajani/adventofcode2018/blob/master/gen.rb) is used to convert the ascii input into something more useful at an electrical/logic level.\n\nFor the output, there are two solutions. The first solution is to use various I/O pins and to connect external LEDs (or a simple LCD display). The second solution is to use the same USB port which is used to program the FPGA but as a UART.\n\nI initially picked external LEDs (because it's simpler) but then got the UART to work.\n\n## Build\nThere's a Makefile, with various rules per day. Everything gets built inside Docker; iceprog is however required on the host machine to program the FPGA.\n\n```\ngit clone https://github.com/alokmenghrajani/adventofcode2018\ncd adventofcode2018\nmake simulate-day01-part1\nmake simulate-day01-part2\n...\n```\n\n## Results\n| day | iverilog    | icestick                        |\n| --- | ----------- | ------------------------------- |\n| 01  | parts 1 \u0026 2 |                                 |\n| 02  | parts 1 \u0026 2 |                                 |\n| 03  | parts 1 \u0026 2 | parts 1 \u0026 2 using external LEDs |\n| 18  | part 1      |                                 |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falokmenghrajani%2Fadventofcode2018","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falokmenghrajani%2Fadventofcode2018","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falokmenghrajani%2Fadventofcode2018/lists"}