AND OR NOT Gates
Coddy'nin Verilog Journey'sinin Temeller bölümünün bir parçası. Ders 40 / 90.
Bu derste en temel üç mantık kapısı ele alınmaktadır: AND, OR ve NOT. Bu kapılar, dijital mantık tasarımının temelini oluşturur.
AND Kapısı
AND kapısı, yalnızca tüm girişler 1 olduğunda 1 çıktısı verir.
Doğruluk Tablosu (2 girişli):
| a | b | out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Verilog kapı ilkel elemanı:
and(out, a, b);Sürekli atama eşdeğeri:
assign out = a & b;OR Kapısı
OR kapısı, en az bir input 1 olduğunda 1 çıktısı verir.
Doğruluk Tablosu (2-input):
| a | b | out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Verilog kapı ilkel öğesi:
or(out, a, b);Sürekli atama eşdeğeri:
assign out = a | b;NOT Kapısı
NOT kapısı, tek girişinin tersini verir. Ayrıca inverter olarak da adlandırılır.
Doğruluk Tablosu:
| a | out |
|---|---|
| 0 | 1 |
| 1 | 0 |
Verilog kapı ilkeli:
not(out, a);Sürekli atama eşdeğeri:
assign out = ~a;Birden Çok Giriş
AND ve OR kapılarının 2'den fazla girişi olabilir:
and(out, a, b, c); // 3 girişli AND (out = a & b & c)
or(out, x, y, z, w); // 4 girişli ORNOT kapılarının her zaman tam olarak 1 girişi vardır.
Kod Örneği
module and_or_not (
input a, b,
output and_out,
output or_out,
output not_out
);
and(and_out, a, b); // AND kapısı
or(or_out, a, b); // OR kapısı
not(not_out, a); // NOT kapısı (evirici)
endmoduleGörev
Görevlere göre eksik kapı primitiflerini ekleyin.
Yapılacaklar:
and_resultçıkışına vepileqgirişlerine sahip bir AND kapısı oluşturunor_resultçıkışına vepileqgirişlerine sahip bir OR kapısı oluşturun-
not_resultçıkışına vepgirişine sahip bir NOT kapısı oluşturun
Kendin dene
module gates_challenge (
input p,
input q,
output and_result,
output or_result,
output not_result
);
// TODO: AND kapısı ekle (and_result = p & q)
// TODO: OR kapısı ekle (or_result = p | q)
// TODO: NOT kapısı ekle (not_result = ~p)
endmoduleBu ders kısa bir quiz içerir. Soruları yanıtlamak ve ilerlemeni kaydetmek için derse başla.
Temeller bölümündeki tüm dersler
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 LogicKendi başına pratik yap: Online Verilog derleyicisi