Digital Logic

From XinCheJian
Jump to: navigation, search

Why learn digital logic?

Digital logic is the foundation of all the electronic devices you use. It's what expresses how electronic system behaves given particular digital input and outputs. In digital logic, electrical inputs (low and high, zero and ones) are translated and processed almost instaneously into outputs. This gives digital logic a fast response advantage on microcontrollers with software on top as it does not need to wait on a particular set of program instructions to be executed to produce an output.

Of course, keep in mind that microcontrollers and computers are themselves built on top of digital logic so understand these will also give you a better understanding on how microcontrollers and computers work.

Building blocks

The fundamental building blocks are transistors that are in turn used to produce logic operations such as AND, OR, NAND, NOR, INV, XOR...

These get assembled into larger logic blocks: MUX (multiplexer) and DEMUX (Demultiplexer), binary counter, shift registers, etc.

Learning with IC (integrated circuits)

XinCheJian has a bank of integrated circuits of the [7400 series] with an inventory currently sufficient for 25 kits. These were generously donated by our member Kirk Lau. These include:

  • AND2 (74HC08)
  • OR2 (74HC32)
  • NAND2 (74HC00)
  • NOR2 (74HC02)
  • INV (74HC04)
  • Schmitt trigger (74HC14)
  • XOR (74HC86)
  • MUX4 (74HC153)
  • binary counter (74HC193)
  • 4-16 Dec (74HC154)
  • 3-8 dec (74HC138)
  • DFF (74HC174)
  • Shift Register (74HC165)
  • BCD 7Seg (74LS247)

ICs are especially convenient when a design requires a bit of digital logic but cost is an issue. Having discrete components also helps with prototyping simple systems using breadboards that can be later expressed as part of a FPGA design.

Logisim lets you simulate designs using this digital logic. See: LED Matrix digital logic using Logisim

Learning with FPGA (Field Programmable Gate Array)

Imagine FPGA as initially a very large set of unspecified digital logic (gates). Gates can be turn into a large number of AND, OR, INV, XOR, etc.... and of course, bigger and better building blocks, themselves used to construct subsystems. Key benefit is that it is possible to process a very large number of digital of analog inputs almost instaneously to whatever logic the user wants. There's also "reusable core" or "intellectual property" that do high-level operations and can be assembled into complex systems that can range from compressing video in real-time to processing audio signals to acceleration communications.

FPGA are specified as software, either schematics (graphically) or more commonly VHDL (VHSIC hardware description language) and Verilog. The key thing to understand is that all the specified operations occur concurrently, which is quite different from the sequential set of operations found in software.

The upsides is enormous flexibility to accomplish tasks that are unthinkable using microcontrollers and would typically require to move to a full fledged computer to accomplish the same level of processing.

At the moment, some of the downsides are:

  • the development board is expensive (an order of magnitude more than microcontrollers)
  • the software is large and complex (Xilinx ISE WebPack is 5GB)
  • there's not yet as much hobbyist-friendly communities compared to platforms such as Arduino

However, these downsides at XinCheJian are being addressed thanks to donations from companies such as [Digilent] who are generously providing development boards such as the [Nexys3] and providing introductory classes to FPGA using [ISE WebPack].