1-CORE Technologies

The basics of digital circuit design

Xilinx XC9500 FPGA

FPGA design services

1-CORE Technologies provides FPGA design services of high quality since 2004. Outsourcing FPGA design to Russia will significantly reduce your design costs.

This FPGA design tutorial article is intended to provide an introduction to the area of digital circuit design. The information presented here can be applied not only to FPGA design, but to all types of digital circuit design.

Logic gates symbols

Logic gates symbols: OR, AND, NOR, NAND, XOR, XNOR

As you can see, small circles denote inversion.

Combinational and Sequential Circuits

Combinational circuit is a circuit containing no memory units (such as latches and flip-flops).

Sequential circuit is a therefore a circuit containing memory units. A register (block of flip-flops or latches) is an essential part of a typical sequential circuit. In a sequential circuit registers are controlled by a clock signal. The set of registers controlled by one clock signal is called a clock domain. Complex circuits can have multiple clock domains.

Complex logic designs can be split into combinational logic sub-circuits communicating via registers.

Sequential pipeline diagram

Timing requirements in synchronous circuits

The following rules apply to synchronous circuits:

  1. Setup time (ts). All register inputs must be constant during this time before a corresponding clock edge.
  2. Hold time (th). All register inputs must be constant during this time after a corresponding clock edge.
Setup and hold times diagram

There are two other effects that must be taken into account when elaborating sequential circuits:

Thus a maximum propagation delay of a combinational circuit must satisfy the following condition:

tpmaxtclk - ts - Δt,

where tclk is a clock period, ts is a setup time and Δt accounts for skew and jitter.

Typical Logic Primitives

There are many standard logic primitives used by almost all digital designs.

Multiplexer

A multiplexer is a device which selects from a number of input channels (selection is made based on special control signal).

A multiplexer designation

For example, the output of the multiplexer on the picture above is determined by a C signal: if C="00" then Z=D0, if C="01" then Z=D1 and so on.

Gate-level schematic of this multiplexer is shown below:

A multiplexer gate-level schematic

Shift register

A shift register can be implemented as a chain of flip-flops:

A serial shift register schematic

On a clock edge each flip-flop is assigned a value of the previous one (and zeros flip-flop is assigned a value of DIN). In order for this circuit to work, obviously, flip-flop switching delay plus propagation delay must be greater than flip-flop's hold time.

Adder

Let's have a look on a 1-bit adder, which generates 1-bit sum and a carry bit.

1-bit adder symbol and schematic

Several 1-bit adders in a chain make a n-bit adder (4-bit adder shown as an example):

4-bit adder symbol and schematic

COUT signal can be used to cascade multiple adders.

Example: an accumulator

Logic primitives can be used to create more complex circuits. For instance, let's consider an 4-bit accumulator (a synchronous device which adds input value to its internal value). Obviously, it can be made of a 4-bit adder and a 4-bit register.

Circuit schematic

Our accumulator should have the following ports:

4-bit accumulator schematic

VHDL description

Instead of drawing a schematic, one can write HDL (VHDL or Verilog) code to describe the device. VHDL code for our accumulator is below.

library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity accumulator is port ( DIN: in std_logic_vector(3 downto 0); DOUT: out std_logic_vector(3 downto 0); CLK: in std_logic; CLR: in std_logic ); end entity; architecture behavioral of accumulator is signal val: std_logic_vector(3 downto 0); begin process (CLK,CLR) is begin if CLR='1' then val<="0000"; elsif rising_edge(CLK) then val<=val+DIN; end if; end process; DOUT<=val; end behavioral;

One can see that VHDL is somewhat similar to conventional programming languages. Hardware description languages will be considered in more details in the further articles.


Copyright © 1-CORE Technologies, 2004-2009.

All product and company names mentioned here are trademarks or registered trademarks of their respective owners.

Materials from this site can be distributed freely as long as a link to the 1-CORE Technologies website is provided.