alokmenghrajani/adventofcode2018

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My attempt at solving Advent of Code 2018 using Verilog + icestick fpga.

icestick

The Lattice icestick is a cheap (~$25) FPGA development board with a complete open source toolkit. The board works on Linux, Mac OS X and Windows.

I was initially planning to just use the plain board, but it seems I'm going to need a flash?

Why not! (also, a good excuse for me to learn some Verilog)

Solve each day's puzzle using Verilog and the icestick FPGA. I initially was planning to use the actual puzzle inputs, 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).

The FPGA tooling is also not designed with performance in mind. E.g. iverilog is extremely slow, yosys fails with some large inputs, etc.

Using the smaller sample inputs makes it potentially possible to solve each day's puzzle.

The puzzle input is encoded either as ram or logic cells (depending on the puzzle input). A custom ruby script gen.rb is used to convert the ascii input into something more useful at an electrical/logic level.

For 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.

I initially picked external LEDs (because it's simpler) but then got the UART to work.

There'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.

git clone https://.com/alokmenghrajani/adventofcode2018
cd adventofcode2018
make simulate-day01-part1
make simulate-day01-part2
...
dayiverilogicestick
01parts 1 & 2
02parts 1 & 2
03parts 1 & 2parts 1 & 2 using external LEDs
18part 1

About

Advent of Code 2018. Solutions using Verilog + icestick fpga! β˜ƒοΈπŸŽ„πŸŽπŸ¦ŒπŸŽ…

Topics

Resources

License

Stars

Watchers

Forks

Languages