Doug Domke
Published © GPL3+

A Beginner's Guide to FPGAs

I've wanted to learn to program FPGAs for a long time, but I struggled with where to begin. Here's how I finally got started!

IntermediateFull instructions provided8 hours496

Things used in this project

Hardware components

Alchitry Au FPGA Kit
×1

Software apps and online services

Alchitry Labs
Vivado
Java Develpment Kit

Story

Read more

Code

Blinker Module

Verilog
Blinks each of 24 LEDs on the IO Element Board. Code is actually Lucid, not Verilog! Lucid wasn't an option. See text for details on how to use this module.
module blinker#(
    MAX_VALUE = 10000000 : MAX_VALUE > 0
  ) (
    input clk,  // clock
    input rst,  // reset
    output out,
    output bank[2],
    output ledNum[3]

  ) {
  
   .clk(clk) {
    .rst(rst) {
      dff ctr[$clog2(MAX_VALUE)];  
      dff led;
    }
  }
  
  dff ctr2[5](#INIT(0), .rst(rst), .clk(led.q));
  
  always {
    ctr.d = ctr.q + 1;
    if (ctr.q == MAX_VALUE-1) {
      ctr.d = 0;
      led.d = ~led.q;
      }
    ctr2.d=ctr2.q + 1;
    if (ctr2.q == 23) {
      ctr2.d = 0;
      } 
    out = ~led.q;
    bank  =  ctr2.q >>3;
    ledNum = ctr2.q & b00111; 
  }
}

Credits

Doug Domke
39 projects • 112 followers
Contact

Comments

Please log in or sign up to comment.