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



沒有留言:

張貼留言

  清除項目編譯快取 執行 flutter clean 重新取得套件依賴 執行 flutter pub get 完整重新編譯並執行 flutter run 1. 新增專案套件 (pubspec.yaml) 在 Flutter 專案根目錄下的 pubspec.yaml 中,新增 ...