2020年4月12日 星期日

divided by 8 with shif right operator ">>"

divided by 8 with shif right operator ">>"

// divided by 8 with shif right operator ">>"
//filename : divid_8
module divide8(quot, div);

input  [7:0] div;   //dividend
output [7:0] quot;  //quotient

parameter sh_bit = 3; //define the number of bits for shifting

assign quot = div >> sh_bit;

endmodule

// 時間單位 100ns, 時間精確度100 ps
`timescale 100ns/100ps 
module TB;
/*
module divide8(quot, div);
input  [7:0] div;   //dividend
output [7:0] quot;  //quotient
*/

reg [7:0] div;
wire[7:0] quot;

integer i;
 
divide8 UUT(quot, div);
 
initial begin  
   for ( i=150;i<=256;i=i+7) 
        begin
            div  = i;
            #10;
        end
end
endmodule



沒有留言:

張貼留言

Telegram +ESP32自動發報機

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