Salta al contenuto
Note per Studenti Digital Systems - Signals, Binary Information and Abstraction Levels Report

Digital Systems - Signals, Binary Information and Abstraction Levels

In questa pagina 7

Analog and digital quantities

Physical quantities (temperature, speed, microphone voltage) vary continuously: between any two values there are infinitely many others. An analog signal can take any value in an interval.

A set is discrete if every element has a neighbourhood containing no other element of the set (the steps of a staircase, the letters of an alphabet). A digital system stores, moves and processes only information made of discrete elements. Ramp = analog (you can stand anywhere), staircase = digital (only on a step).

A continuous quantity must be digitalized (made discrete): a digital thermometer showing one decimal between 0.00.0 and 40.0 ∘C40.0\,\mathrm{^\circ C} has 401401 possible values. "Digital" does not mean "numeric" but "with discrete values".

Why binary

A binary signal takes only two values, written 0 and 1 (OFF/ON, FALSE/TRUE, low/high). A binary digit is a bitbinary digit: the minimum amount of information, either 0 or 1.

The reason is robustness to noise. On a 1 V1\,\mathrm V range, two levels are 1 V1\,\mathrm V apart; ten equally spaced levels (decimal digits) are 19≈0.11 V\tfrac19\approx0.11\,\mathrm V apart, so a small disturbance already reads the adjacent digit. The price is that more digits are needed to write the same number.

Two voltage ranges, not two voltages

In real chips "0" and "1" are ranges separated by a forbidden zone. Example (supply about 1 V1\,\mathrm V):

low (0) high (1)
input recognized as −0.1 V<VIN<0.4 V-0.1\,\mathrm V<V_{IN}<0.4\,\mathrm V 0.6 V<VIN<1 V0.6\,\mathrm V<V_{IN}<1\,\mathrm V
output produced −0.1 V≤VOUT≤0.1 V-0.1\,\mathrm V\le V_{OUT}\le0.1\,\mathrm V 0.9 V≤VOUT≤1.1 V0.9\,\mathrm V\le V_{OUT}\le1.1\,\mathrm V

Between 0.40.4 and 0.6 V0.6\,\mathrm V lies the forbidden region. The accepted input range is wider than the produced output range: a gate emits clean levels but tolerates dirty ones. The noise margins are

NMH=VOH,min⁡−VIH,min⁡=0.9−0.6=0.3 V,NML=VIL,max⁡−VOL,max⁡=0.4−0.1=0.3 V.NM_H=V_{OH,\min}-V_{IH,\min}=0.9-0.6=0.3\,\mathrm V,\qquad NM_L=V_{IL,\max}-V_{OL,\max}=0.4-0.1=0.3\,\mathrm V .

Another example: VOH,min⁡=2.4V_{OH,\min}=2.4, VIH,min⁡=2.0V_{IH,\min}=2.0, VOL,max⁡=0.4V_{OL,\max}=0.4, VIL,max⁡=0.8V_{IL,\max}=0.8 (volts) give NMH=NML=0.4 VNM_H=NM_L=0.4\,\mathrm V.

A disturbance up to the margin is absorbed. This is the regenerative property: the next gate outputs a cleaned signal, so noise does not accumulate stage after stage (in an analog circuit each stage adds its noise to the previous one).

In this course transitions 0→10\to1 and 1→01\to0 are treated as instantaneous, reasoning only on logic values; real delays are in Logic Gates, Gate Delay and Universal GatesAND, OR, NOT implement the Boolean operations; NAND, NOR, XOR and XNOR derive from them. Every function is described by a truth table with 2^n rows. Multi-input XOR is the odd-parity function. An ideal gate has zero delay; a real gate has a propagation delay t_G (different for 0 to 1 and 1 to 0), so the output changes t_G after the input. NAND and NOR are each universal.Logic Gates, Gate Delay and Universal Gates →.

Representing information with bits

nn bits give 2n2^n distinct combinations, hence can represent 2n2^n elements:

bits 1 2 3 4 8 10 16
combinations 2 4 8 16 256 1024 65536

To distinguish 401401 values 99 bits are needed, since 28=256<401≤29=5122^8=256<401\le2^9=512. Three ideas are used: a single bit (lamp on/off); elements of a set (8 colours with 3 bits; characters, see Binary Codes - BCD, ASCII, Unicode, Parity and GrayAn n-bit code distinguishes 2^n elements. BCD encodes each decimal digit on 4 bits (1010 to 1111 unused; it differs from the plain binary of the number). ASCII uses 7 bits for 128 characters; Unicode UTF-8 uses 1 to 4 bytes and is ASCII compatible. A parity bit detects errors on an odd number of bits. Hamming distance is the number of differing bits. Gray code makes consecutive numbers differ by one bit and is built by reflection or with g_i = b_i xor b_(i+1).Binary Codes - BCD, ASCII, Unicode, Parity and Gray →); quantized continuous quantities (the 401 temperature values).

Precision depends on the number of bits (more bits, smaller steps), not on the voltage amplitude of the bit (which affects noise) nor on the clock frequency (which affects speed).

Units (decimal): 1 kB=1031\,\mathrm{kB}=10^3 B, 1 MB=1061\,\mathrm{MB}=10^6, 1 GB=1091\,\mathrm{GB}=10^9, 1 TB=10121\,\mathrm{TB}=10^{12}, 1 PB=10151\,\mathrm{PB}=10^{15}. Powers of 2 are close but different: 210=1024≈1032^{10}=1024\approx10^3, 220≈1062^{20}\approx10^6, 230≈1092^{30}\approx10^9, 240≈10122^{40}\approx10^{12}.

The computer as a digital system

A digital computer has three parts connected by buses:

  • memory: data (input, output, intermediate) and instructions;
  • CPU (Central Processing Unit), split into the control unit, which manages the flow of information among blocks, and the datapath, which performs the operations on data according to the program;
  • input/output devices: keyboard, microphone, camera (input); screen, printer, speakers (output); USB sticks (both).
          +---------------- CPU -----------------+
          |  control unit  <--->  datapath       |
          +--------^----------------^------------+
                   |      buses     |
        +----------v--+       +-----v--------+
        |   memory    |       |  input/output |
        +-------------+       +---------------+

The same structure appears in reduced form in microprocessors, microcontrollers and DSPs, often on a single chip and embedded in larger systems (cars, smartphones, TVs, satellites): a car contains tens or hundreds of microcontrollers (ABS, engine, gearbox, steering, lighting). The CPU coordinates complex operations; the GPU performs simple operations on large amounts of data (graphics, AI).

Milestones: first working transistor 1948 (Bell Laboratories, germanium); first integrated circuit 1958 (Texas Instruments); first commercial microprocessor 1971 (Intel 4004).

Levels of abstraction

From the most abstract to the most concrete:

  1. algorithms: finite sequence of steps, independent of the language;
  2. programming languages (Python, C++, Java);
  3. operating systems;
  4. ISA (Instruction Set Architecture): the elementary machine instructions of a processor;
  5. microarchitecture: how a given processor implements the ISA;
  6. register transfer (RTL): micro-operations as movements of groups of bits between registers;
  7. logic gates: elementary operations on bits (logical, not electrical, level);
  8. transistor circuit: electrical description, transistors as switches.

Each level hides the details of the one below, so a level can be changed leaving the upper ones unchanged. For sum = A + B (level 2), level 7 is the gate circuit of the adder with inputs and outputs in {0,1}\{0,1\}; level 8 is the circuit where currents flow through transistors, with inputs {VIL,VIH}\{V_{IL},V_{IH}\} and outputs {VOL,VOH}\{V_{OL},V_{OH}\}. The course covers the intermediate levels: gates, register transfer, microarchitecture and ISA.

Top-down: start from high-level specifications as a black box and split into smaller blocks until they can be built; good overview. Bottom-up: start from elementary, fully specified components and connect them into larger ones; blocks can be tested individually but the whole system is verified only at the end. In practice both are combined; the course proceeds bottom-up.

Design flow

  1. Specification: what the circuit must do (text or HDL code), not how.
  2. Formulation: truth tables, Boolean equations or state diagrams.
  3. Optimization: fewer gates, transistors, silicon area, within constraints (maximum gate inputs, delays, clock). It is iterative.
  4. Technology mapping: blocks are replaced with components available in the chosen technology.
  5. Verification: simulation and correctness checks.

Circuits are described with VHDL, a hardware description language: not a programming language. In a program instructions run one at a time on a CPU; in VHDL all statements are active at the same time, because they describe hardware blocks working in parallel.

Common mistakes

  • Saying precision depends on the bit voltage amplitude or the clock: it depends on the number of bits.
  • Reversing the ranges: it is the input range that is wider than the output one.
  • Confusing "digital" with "numeric".
  • Believing noise does not exist in digital circuits: it exists but the noise margins absorb it.
  • Thinking VHDL is sequential like Python.

Versione ripasso

  • Analog vs digital: analog takes any value of an interval; digital only discrete values. "Digital" is not "numeric". Digitalizing = quantizing.
  • Binary: two levels, more robust to noise (on 1 V: 1 V apart for two levels, 19≈0.11\tfrac19\approx0.11 V for ten).
  • Two ranges, not two voltages: input low <0.4<0.4 V, high >0.6>0.6 V; output low ≤0.1\le0.1 V, high ≥0.9\ge0.9 V; forbidden region in between. The input range is wider than the output range.
  • Noise margins: NMH=VOH,min⁡−VIH,min⁡=0.3NM_H=V_{OH,\min}-V_{IH,\min}=0.3 V, NML=VIL,max⁡−VOL,max⁡=0.3NM_L=V_{IL,\max}-V_{OL,\max}=0.3 V. Regenerative property: noise does not accumulate.
  • Bits: nn bits give 2n2^n combinations; 401 values need 9 bits (28=256<401≤5122^8=256<401\le512). Precision = number of bits, not voltage or clock. 210≈1032^{10}\approx10^3, 230≈1092^{30}\approx10^9.
  • Computer: memory, CPU (control unit + datapath), I/O, connected by buses. Embedded: microprocessor, microcontroller, DSP. CPU = complex operations, GPU = simple operations on large data.
  • Milestones: transistor 1948, integrated circuit 1958, microprocessor (Intel 4004) 1971.
  • Abstraction levels: algorithm, language, OS, ISA, microarchitecture, RTL, gates, transistors; each hides the lower ones. The course covers gates to ISA.
  • Top-down (specification into blocks) vs bottom-up (from elementary components, used in the course).
  • Design flow: specification, formulation, optimization (iterative), technology mapping, verification.
  • VHDL describes hardware: statements are concurrent, not sequential.
  • Mistakes: precision tied to voltage or clock; input/output ranges swapped; digital read as numeric; noise ignored; VHDL read as sequential.