SHARE
TWEET

additionneur

a guest Nov 12th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //additionneur 3bits
  2. module addition(SW,LEDLR,LEDG);
  3.     input[5:0]SW;
  4.     output[5:0]LEDLR;
  5.     output[3:0]LEDG;
  6.    
  7.     wire[2:0]A,B,S;
  8.     wire[3:1]C;
  9.    
  10.     assign A=SW[5:3];
  11.     assign B=SW[2:0];
  12.    
  13.     fa bit0 (A[0],B[0],l'b0,S[0],C[1]);
  14.     fa bit1 (A[1],B[1],C[1],S[1],C[2]);
  15.     fa bit2 (A[2],B[2],C[2],S[2],C[3]);
  16.    
  17.     assign LEDLR=SW;
  18.     assign LEDG=S;
  19.    
  20. endmodule
  21.  
  22. module fa(a,b,ci,s,co);
  23.     input a,b,ci;
  24.     output s,co;
  25.    
  26.     wirea_xor_b;
  27.    
  28.     assign a_wor_b=a^b;
  29.     assign s=~a&~b&c|~a&b&~c|a&~b&~c|a&b&c;
  30.     assign co=~a&b&c|a&~b&c|a&b&~c|a&b&c;
  31. endmodule
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top