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



沒有留言:

張貼留言

台中公車雙向即時資訊系統 (TaichungBusLiveQuery)- Node-red 程式

  台中公車雙向即時資訊系統 ( TaichungBusLiveQuery )   Node-red 程式 Python Tkinter 是單機桌面 UI 程式,主動發起 API 請求並渲染視窗。 Node-RED 是基於事件驅動的流程(Flow-based)系統,適合在背...