2012年10月12日 星期五

P5-33 1bit減法器 適用於DE2-70 實驗板



module Sub1bits (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 X, Y, Bin;
wire  Dif, Bout;
   
    //mapping to hardware 
    assign LEDR = SW;
    //assign SW to input 
    assign X=SW[2];
    assign Y=SW[1];
    assign Bin=SW[0];
    
    //  X - Y -Bin = Bout , Dif       

//Assign difference and borrow
assign Dif = (((~X)&(~Y)&Bin)|((~X)&(Y)&(~Bin))|(X&(~Y)&(~Bin))|(X & Y & Bin));
assign Bout = (((~X)&Y)|((~X)&Bin)|(Y & Bin));


    assign LEDG[0]=Dif;
    assign LEDG[1]=Bout;

endmodule

/*original program
//-------------------------------------
//Filename : fadd1_df.v
//-------------------------------------
module fadd1_df(X, Y, Bin, Dif, Bout);
input X, Y, Bin;
output Dif, Bout;
//Assign difference and borrow
assign Dif = (((~X)&(~Y)&Bin)|((~X)&(Y)&(~Bin))|(X&(~Y)&(~Bin))|(X & Y & Bin));
assign Bout = (((~X)&Y)|((~X)&Bin)|(Y & Bin));

endmodule
*/


沒有留言:

張貼留言

Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --3

  Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --3 AngularJS 實例 <!DOCTYPE html> <html> <head> <meta charse...