Altifigence Academy

5 / 36 · Konsep

Bits, signals and ports

Identify inputs, outputs and the meaning of one-bit values.

Terjemahan belum tersedia. Pelajaran asli ditampilkan. (English)

Learning goals

  • Identify inputs and outputs in a port declaration
  • Explain data signals and the selection signal

Start at the circuit boundary

Module ports connect the circuit to its surroundings. An input receives a value; an output exposes a value computed inside. a and b carry data, while sel chooses which one to use.

Here a, b and sel are each one bit. We work with values 0 and 1. A select value of 1 means choose b; it does not mean the selected data must be 1.

SignalDirectionRole
a / binputData
selinputSelect
clkinputClock
youtputCombinational result
sampled_youtputStored observation

A declaration does not imply storage

logic declares a signal type, not a storage policy. In this example y is calculated by an assign expression; sampled_y is stored at a rising edge.

Mark each port direction and width, then find the statement that drives it. The assignments and clock conditions tell you more about the circuit than the signal names do.

SystemVerilog
input logic a, b, sel;
output logic y;
assign y = sel ? b : a;

Coba sendiri

What is y when a=1, b=0 and sel=1?

Baca penjelasan

sel=1 chooses b, so y=0. Keep the selector separate from the selected data.

Pilihan berlaku di peramban ini. Ubah kapan saja di bagian bawah halaman.