2020年4月21日 星期二

Dataflow 3 bits Majority in Verilog

Dataflow 3 bits Majority in Verilog



//========================
//Dataflow 3 bits Majority in Verilog
//========================
`timescale 10ns/10ps 
module major_3bit(I,Maj);
input [2:0]I;
output Maj;

assign Maj= (I[1] & I[0]) | ( I[2] & (I[1] | I[0]) ) ;

endmodule


//===============================
// 時間單位 1ns, 時間精確度10 ps
`timescale 10ns/10ps 
module TB;
/*
module major_3bit(I,Maj);
input [2:0]I;
output Maj;
*/
reg [2:0]I= 3'b000;   //  暫存器資料初值為‘000’
wire Maj;

integer i;

major_3bit UUT(I,Maj);

initial begin
    for (i=0; i<9; i=i+1) begin
         {I} = i;
         #20;
    end
    #20
     $stop;
end

endmodule


沒有留言:

張貼留言

Telegram +ESP32自動發報機

  Telegram   +ESP32自動發報機 這套系統是一個典型的 IoT(物聯網)架構 ,結合了遠端配置(Python)、通訊中介(MQTT)與硬體執行(ESP32)。 以下我為您拆解這兩支程式的核心運作原理: 一、 系統架構流程 Python 端 (控制台) :使用者輸入...