Docsity

Gray Code Counter - Intro to Advanced Digital Design - Lecture Slides, Slides of Digital Systems Design

Partial preview of the text

Download Gray Code Counter - Intro to Advanced Digital Design - Lecture Slides and more Slides Digital Systems Design in PDF only on Docsity!

Project 1

  • Two parts
    • Implement a 3 bit Gray Code Counter
    • Implement a 4-to-1 muxtiplexer
  • Can be done on Altera or Xilinx

The Gray Code counter

  • 1-bit Gray Code
    • Simply the sequence 0 --- 1
  • 2-bit Gray Code
    • 00 Can be generated from the
    • 01 1-bit by reflecting. On the top
    • 11 prepend 0 – on the bottom
    • 10 prepend 1

The VHDL Code for this

  • Can be accessed via the course web page
    • -- This is the description of a 3 bit SED counter.
    • ENTITY cnt3 IS
    • PORT (clk : IN bit;
    • cnt : OUT bit_vector(2 downto 0));
    • END cnt3;
    • ARCHITECTURE one OF cnt3 IS
    • SIGNAL state,next_state : bit_vector(2 downto 0) := "000";
    • BEGIN

VHDL CODE in architecture

  • Code to latch next_state to state
    • -- Latching logic specification
    • PROCESS
    • BEGIN
    • WAIT UNTIL clk='1' AND clk'event;
    • state <= next_state;
    • END PROCESS;

Output the state

  • -- Assign outputs
  • cnt >= state;
  • END one;
  • Here assigning the output is very

straightforward. Typically output assignment

is simple, especially from a Moore type

machine.

The 4-to-1 mux

  • A CMOS implementation G G G G A A’ B B’ G(A,B G (A,B) A B 4-to- Mux G G G G

What to do with HDL code?

  • Go to the lab
  • Enter the HDL into the FGPA software for the counter and the mux – 2 different projects
  • From the HDL generate the FPGA
  • Repeat the 4-to-1 mux only this time do a schematic capture implementation.
  • Create a report showing
    • The HDL you entered
    • The schematic of the generated circuit
    • Summarize the details of the synthesis – how many LUTs, how many F/Fs, and other details you consider significant.
    • Contrast the results from the HDL and the schematic source for the mux circuit.

Generated FPGA in XILINX

  • What the schematic looks like