2012年10月11日 星期四

P5-16 移位 Shift << , >> 範例:除8 適合於DE2-70實驗板



// p5-16 Divided by 8 shift right operator ">>  
// for DE2=70 experiment board"

module Divided8 (SW, LEDR, LEDG);
input [17:0] SW; // toggle switches
output [17:0] LEDR; // red  LEDS   
  output [7:0] LEDG; // green LEDs
  
//set original program input , output 
wire [7:0]div;  //Dividend
wire [7:0]quot; //Quotient , Remainder

assign div=SW[7:0];

parameter sh_bit=3;
assign quot = div >> sh_bit;

assign LEDG[7:0]=quot;
     
endmodule     


/*original program 
module div_8(div,quot);
input [7:0]div;
output[7:0]quot;
parameter sh_bit=3;
assign quot = din >> sh_bit;
endmodule
*/

沒有留言:

張貼留言

RFID TI 培訓影片系列

RFID TI 培訓影片系列  https://www.ti.com/zh-tw/video/series/rfid.html 培訓影片系列 RFID 隨著創新技術日益發展,RFID 和 RF 術語越來越容易讓人混淆。本訓練系列詳細介紹了使用案例、權衡技術優缺點,讓您清楚知道該選...