Designing The Logic
CoddyのVerilogジャーニー「基礎」セクションの一部。レッスン 44/90。
チャレンジ
論理を設計するとは、真理値表に基づいて回路に必要な方程式を明らかにすることです。
真理値表:
| a | b | sum | carry |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
ステップ 2:sum のパターンを見つける
- a=0,b=1 または a=1,b=0 のとき、sum = 1
- a と b が異なるとき、sum = 1
- 異なる = XOR →
sum = a ^ b
ステップ 3:carry のパターンを見つける
- a=1 かつ b=1 のときにのみ、carry = 1
- 両方 = AND →
carry = a & b
ステップ 4:方程式を書く
sum = a ^ b
carry = a & b
行うこと:
あなたの課題は、module 内に不足している論理方程式を追加することです。
1. sum(a XOR b)の assign 文を追加する
2. carry(a AND b)の assign 文を追加する
自分で試してみよう
module half_adder (
input a,
input b,
output sum,
output carry
);
endmodule基礎のすべてのレッスン
4Operators Part 1
Arithmetic OperatorsModulo OperatorComparison OperatorsRecap - Simple MathBitwise Operators7Assign And Gates
Continuous AssignmentAssign With OperatorsBuilt In Gate PrimitivesAND OR NOT GatesXOR XNOR GatesRecap - Logic Gate Circuit10Decision Making
If StatementIf - ElseRecap - Simple ComparatorCase StatementCasex And CasezRecap - ALU Design5Operators Part 2
Logical OperatorsReduction OperatorsShift OperatorsConcatenation OperatorConditional OperatorRecap - Operator Challenge3Number System
Binary RepresentationSized NumbersUnsized NumbersNegative NumbersSpecial Values X And ZRecap - Number Formats6Modules
Module StructureInput And Output PortsInout PortsModule InstantiationPort Mapping By NamePort Mapping By OrderRecap - Build A Module9Procedural Blocks
Always BlockInitial BlockSensitivity ListBlocking AssignmentNon Blocking AssignmentRecap - Always vs Initial15Traffic Light Controller
Defining The StatesState Machine Logic自分で練習してみよう: Verilogオンラインコンパイラ