Scratch VHDL

Logo

The purpose of "Scratch VHDL" is to make reprogrammable logic design into child's play. Sounds ambitious.

View the Project on GitHub house-of-abbey/scratch_vhdl

Sum of Buttons Pressed (Adder)

These come in two variations, but as the title suggests, each will count the number of buttons pressed and display the result with the LEDs.

Binary

The number of buttons pressed is displayed in binary of the LEDs. It may be useful to have tried the binary counter) demonstration first to ensure familiarity with how computers and electronics count.

One Hot

As each additional button is pressed, the LED to the left is lit, and with each release the LED lit moves right. It should not be necessary to push the buttons in order, any order will do.

This introduced the concept of “One Hot” encoding visually. Only one LED is lit at any one time. This can be a way of encoding state variables too, so that only one bit drives an action, making decoding cheaper at the expense of the number of registers in the state variable.

Note

The interactive demos show an implementation with logic gates (other solutions may be available). But importantly they show how much work needs to be done to derive the desired implementation. Karnaugh maps and Boolean equations were used in the derivation of the gates, and possibly in a non-optimal way too.

The whole point of a specification language like VHDL (or Verilog) is to alleviate the burden of this level of implementation and allow the developer to work at a higher level of abstraction (specification), knowing that a tool can produce the solution (implementation) on their behalf from a readable description of what is required.