5 / 36 · 概念
Bits, signals and ports
Identify inputs, outputs and the meaning of one-bit values.
课时内容可免费阅读,选课后可保存学习进度。
译文尚未提供,以下显示课时原文。 (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.
| Signal | Direction | Role |
|---|---|---|
| a / b | input | Data |
| sel | input | Select |
| clk | input | Clock |
| y | output | Combinational result |
| sampled_y | output | Stored 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.
input logic a, b, sel;
output logic y;
assign y = sel ? b : a;自己试试
What is y when a=1, b=0 and sel=1?
阅读解释
sel=1 chooses b, so y=0. Keep the selector separate from the selected data.