Recap - Operator Challenge
Coddy'nin Verilog Journey'sinin Temeller bölümünün bir parçası. Ders 29 / 90.
Görev
Her görev için doğru ifadeleri yazarak kodu tamamla. Bu meydan okuma, bu bölümdeki tüm operatörleri kapsar.
Yapılacaklar:
- Logical: Hem
value1hem devalue2değerlerinin non-zero olup olmadığını kontrol et ve sonuculogic_outiçinde sakla - Reduction:
vectordeğerinin all bits değerlerinin 1 olup olmadığını kontrol et ve sonucureduction_outiçinde sakla - Shift:
datadeğerini 2 bit sola kaydır ve sonucushift_outiçinde sakla - Concatenation:
highvelowdeğerlerini 8 bitlik bir değer into birleştir ve sonucuconcat_outiçinde sakla - Conditional: `a` ve `b` değerlerinden larger olanı
cond_outiçinde sakla
Kendin dene
module operator_challenge;
reg [3:0] value1, value2;
reg logic_out;
reg [3:0] vector;
reg reduction_out;
reg [7:0] data;
reg [7:0] shift_out;
reg [3:0] high, low;
reg [7:0] concat_out;
reg [3:0] a, b;
reg [3:0] cond_out;
initial begin
// Mantıksal
value1 = 4'd6;
value2 = 4'd0;
logic_out = ______; // value1 ve value2'nin her ikisinin de sıfır olmadığını kontrol et
// İndirgeme
vector = 4'b1111;
reduction_out = ______; // Check if all bits of vector are 1
// Shift
data = 8'b00001111;
shift_out = ______; // data'yı 2 bit sola kaydır
// Birleştirme
high = 4'b1010;
low = 4'b1100;
concat_out = ______; // high ve low'u 8 bitlik bir değerde birleştir
// Koşullu
a = 4'd7;
b = 4'd12;
cond_out = ______; // `a` ve `b`'nin daha büyüğünü sakla
$display("6 && 0 = %d", logic_out);
$display("&4'b1111 = %d", reduction_out);
$display("00001111 << 2 = %b", shift_out);
$display("{1010, 1100} = %b", concat_out);
$display("max(7, 12) = %d", cond_out);
$finish;
end
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