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