Advertisement
JakubKot01

Pracownia - zadanie 1

Mar 31st, 2021
626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module compare(input[0:3] a, b, output[0:3] c, d);
  2.   always_comb begin
  3.   if(a > b)
  4.     {c, d} = {a, b};
  5.   else
  6.     {c, d} = {b, a};
  7.   end
  8. endmodule
  9. module circuit(input[0:15] s, output [0:15] o);
  10.   logic[0:3] l1, l2, l3, l4, pom1, pom2;
  11.   compare c1(.a(s[0:3]), .b(s[7:11]), .c(l1), .d(l3));
  12.   compare c2(.a(s[4:7]), .b(s[12:15]), .c(l2), .d(l4));
  13.   compare c3(.a(l1), .b(l2), .c(o[0:3]), .d(pom2));
  14.   compare c4(.a(l3), .b(l4), .c(pom3), .d(o[12:15]));
  15.   compare c5(.a(pom2), .b(pom3), .c(o[4:7]), .d(o[7:11]));
  16. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement