Advertisement
teleias

2bit CLA Verilog Example

Feb 27th, 2015
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module main;
  2. reg[0:0] c_in = 0;
  3. reg[1:0] a = 11;
  4. reg[1:0] b = 10;
  5. reg[1:0] p;
  6. reg[1:0] g;
  7. reg[1:0] s;
  8. reg[1:0] c;
  9. initial
  10.     begin
  11.         $monitor("s = %d%d, c = %d%d", s[1], s[0], c[1], c[0]);
  12.         #1
  13.         g[0] = a[0]&b[0];
  14.         p[0] = a[0]^b[0];
  15.         g[1] = a[1]&b[1];
  16.         p[1] = a[1]^b[1];
  17.         #1
  18.         c[0] = g[0];
  19.         s[0] = p[0]^c_in;
  20.         c[1] = g[1]+(p[1]&g[0]);
  21.         s[1] = p[1]^g[0];
  22.     end
  23.  
  24. initial
  25.     $monitor("s = %d%d, c = %d%d", s[1], s[0], c[1], c[0]);
  26.  
  27. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement