Decoder Design
Coddy'nin Verilog Journey'sinin Temeller bölümünün bir parçası. Ders 85 / 90.
Görev
Bir decoder, input olarak ikili bir sayı alır ve bu sayıya göre tam olarak one output değerini etkinleştirir. Etkinleşen output, yalnızca bir bit sıcak (1) ve diğer tüm bitler soğuk (0) olduğu için "one-hot" olarak adlandırılır.
Doğruluk Tablosu (2'den 4'e Decoder)
| input (in) | out0 | out1 | out2 | out3 |
|---|---|---|---|---|
| 00 | 1 | 0 | 0 | 0 |
| 01 | 0 | 1 | 0 | 0 |
| 10 | 0 | 0 | 1 | 0 |
| 11 | 0 | 0 | 0 | 1 |
Module Arayüzü
| Port | Yön | Genişlik | Açıklama |
|---|---|---|---|
in | input | 2 bit | İkili input (0'dan 3'e) |
out0 | output | 1 bit | in = 00 olduğunda etkin |
out1 | output | 1 bit | in = 01 olduğunda etkin |
out2 | output | 1 bit | in = 10 olduğunda etkin |
out3 | output | 1 bit | in = 11 olduğunda etkin |
Görevin, aşağıdaki module'ü bir case ifadesi kullanarak tamamlamaktır.
Yapılacaklar:
in = 2'b00olduğunda,out0 = 1, diğerlerinin tümü 0in = 2'b01olduğunda,out1 = 1, diğerlerinin tümü 0in = 2'b10olduğunda,out2 = 1, diğerlerinin tümü 0in = 2'b11olduğunda,out3 = 1, diğerlerinin tümü 0
Kendin dene
module decoder (
input [1:0] in,
output reg out0,
output reg out1,
output reg out2,
output reg out3
);
// TODO: always @(*) bloğunu case (in) ile ekle
// 2'b00: out0=1, diğerleri 0
// 2'b01: out1=1, diğerleri 0
// 2'b10: out2=1, diğerleri 0
// 2'b11: out3=1, diğerleri 0
endmoduleTemeller 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