Skip to content

a rough curriculum to speed through digital electronics content - slightly modified version of tiny vision ai's course

Notifications You must be signed in to change notification settings

mikaelhaji/digital-electronics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

Digital Electronics: A Rough Curriculum

Inspired and Slightly Modified Version of the TinyVision.AI Course

Section 1: Introduction to digital electronics, FPGA’s and environment setup:

Material:

Suggested Setup:

  • TerosHDL Plugin Setup on VS Code
  • Set Up ICE Studio

Challenge:

  1. Write code to get various colors on the 3 color LED and program the board with it. Try out the UPduino FPGA tutorial to get your hands wet.
  2. Advanced challenge: Setup a command line compile using a Simple Makefile or a more Complex Makefile as an example. Go through the makefile and understand what it does.

Section 2: Getting started with logic design, Verilog simulations

Material:

Challenge:

  • Create a System Verilog design that combines what you learnt today. You can use the EDA Playground Example as a starting point and modify it:

    • An adder module
      • Inputs: Two 8 bit unsigned numbers to be added
      • Output: The sum of the 2 numbers.
    • Testbench to exercise the block and print the output to the console
    • Bitwidth analysis is an important part of designing a hardware system as well as algorithms, especially for digital processing. We will do some bitwidth analysis as part of this question. Note that these dont require simulations to be done and can be solved by analysis):
      • What is the range of unsigned numbers that can be represented by a variable with 2 bits? 3 bits? 8 bits? 16 bits?
      • What pattern do you see here?
      • What is the minimum number of bits it takes to represent the sum of the 2 numbers? eg. if two numbers are repesented by 2 bits each, how many bits does it take to represent their sum? What if the inputs are now 3 bits instead of 2 bits? What pattern do you see?
      • What if one of the above numbers is represented by 2 bits and the other by 3 bits?
      • What if the operation were the difference of the two numbers?
      • What if the operation were a multiplication of the 2 numbers?

    Advanced Challenges/Thought experiments:

    • What happens if there are too few bits to represent the result of the operation? eg. if you have the sum of 2 numbers, each represented by 2 bits and the output is represented by a 2 bit number. This is known as an overflow and is a common bug/feature.
      • Can you try simulating this with your Verilog design?
    • Signed and floating point numbers can also be represented in binary.

Section 3: Getting started with logic design, Verilog simulations Pt. 2

Material:

Challenge:

Challenge: Use Circuitverse or preferably SystemVerilog to create a 4-bit binary counter. This should count the following sequence: 0000, 0001, 0010 …, 1110, 1111, 0000

  1. Make the counter count up or down
  2. Can you make it so the counter will stop at a particular count?
  3. Try to make it count on negative edges
  4. What if you didn’t have a reset condition? Can you see what happens?

Solution in EDA playground

Advanced Challenges/Thought experiments:

  1. Can you create a clock signal from plain logic gates? What is the minimum number of gates you need to create a clock? What determines the frequency of the clock?
  2. How can you create a clock circuit from a NAND gate, resistor and a capacitor?

Section 4: State Machines

Material:

Challenge:

Code up a state machine for a traffic light. Here are the specifications:

  • Shall have 3 states: Red, Yellow and Green.
  • Start in the Red state on reset
  • When the Red timer expires, go to the Green state.
  • When the Green timer expires, go to the Yellow state.
  • When the Yellow timer expires, go to this Red state.
  • In case of roadwork, blink the Red light.
  • Identify the various inputs to the state machine
  • Identify the various outputs from the state machine
  • Identify what causes the system to change state.
  • Draw up the state transition diagram using diagrams.net or Graphviz
  • Pick a specific way to implement the state machine and code it up on EDA Playground or other tool.
  • Simulate the state machine and check whether this works.

Advanced Challenges/Thought experiments:

  • Practical systems often consist of nested simple state machines rather than a single large one. Larger state machines get harder to verify and corner cases can be tough to test. Extend your state machine so you have lights at all 4 roads at an intersection.
    • What does a single state machine for a 4 road intersection look like? How does this extend to cases where you may have intersections with 2, 3 or 5 roads as well as road crossing signals?
    • What if you used the same state machine at each intersection instead of a single large one? What information does one state machine need to communicate wiht the others so that the intersection is safe for traffic?

Section 5: Memories: RAM, ROM

Material:

Challenge: Digital Clock

  • Create a ROM module that maps hex digits to a 7 segment LED display. The module should take as input a 4 bit input and output a 7 bit vector.
  • Create a counter module with a programmable value at which it rolls over and also generates a carry output. Cascade multiple of these to create a seconds, minutes and hours counter.
  • Connect each of these modules to the ROM.
  • Add an oscillator and clock divider that generates a pulse every second as the input to the clock.
  • Add an alarm output that goes active when the clock reaches a particular time. Hint: See here for a nice introduction to how 7 segment displays work as well as how to drive a few of these critters.

Advanced Challenges/Thought experiments:

  • How can you use a small memory to build a bigger one? eg. if you want to build an 8kB memory from two 4kB memories.
  • What if you wanted double the bitwidth? How would you restructure the smaller memories?

Section 6: Blitz Wrap-Up

Material:

About

a rough curriculum to speed through digital electronics content - slightly modified version of tiny vision ai's course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published