Advertisement
Guest User

Untitled

a guest
Mar 4th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     Sumator 1 bitowy, który sumuje 2 bity.
  3.     a, b to są bity, które sumujemy,
  4.     cin to od carry input, co oznacza bit przeniesienia z poprzedniego,
  5.     s to to suma dodawania (sum)
  6.     cout to carry output, czyli bit przeniesienia dalej.
  7. */
  8.  
  9. module Zadanie_1_sumator_1_bit_assign (input cin, a, b,     // input - porty wejsciowe
  10.               output s, cout);      // output - porty wyjsciowe
  11.  
  12.     assign s = a ^ b ^ cin;         // opis funkcji sumy
  13.     /*
  14.     Suma s powstaje przez 2 bramki xor (jedna dla a, b, druga dla wyniku (a, b)
  15.         i Cin.
  16.     */
  17.     assign cout = a & b | (a ^ b) & cin;    // opis funkcji przeniesienia
  18. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement