2012年10月11日 星期四

P5-13 Half Adder for DE2-70 Experiment Board


//1bit adder Half Adder

//1bit adder Half Adder



module Hadder (SW, LEDR, LEDG);
input [17:0] SW; // toggle switches
output [17:0] LEDR; // red     
  output [7:0] LEDG; // green LEDs
  
//set original program input , output 
wire a,b;
wire s,cout;

   
    //mapping to hardware 
    assign LEDR = SW;
    
    
assign a = SW[0];
assign b = SW[1];

//program body

assign s=a^b;
assign cout=a&b;

//setting output
assign LEDG[0]=s;
assign LEDG[1]=cout;

endmodule


/* original  program
module half_adder(a,b,s,cout);
input a,b;
output s,cout;
assign s=a^b;
assign cout=a&b;
endmodule
*/

沒有留言:

張貼留言

零成本學 ESP32!在 Wokwi 打造你的第一個微型氣象站 (ESP32 + DHT22 + 1602 LCD)

零成本學 ESP32!在 Wokwi 打造你的第一個微型氣象站(溫度 濕度) (ESP32 + DHT22 + 1602 LCD) 想學物聯網(IoT)與 ESP32 電子實作,卻擔心接線與電壓規範搞砸嗎?透過強大的線上模擬器 Wokwi ,我們不需要花費任何硬體費用,打開瀏覽器...