Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module demux_12(a,s,c);
- input a;
- input s;
- output [1:0]c;
- assign c[1] = (a & ~s);
- assign c[0] = (a & s);
- endmodule
- module demux_14(a,s,c);
- input a;
- input[1:0]s;
- output [3:0] c;
- wire [1:0] c1;
- demux_12 intermediate(.a(a),.s(~s[1]),.c(c1));
- demux_12 out (.a(c1[0]),.s(~s[0]),.c(c[1:0]));
- demux_12 out2(.a(c1[1]),.s(~s[0]),.c(c[3:2]));
- endmodule
- module demux_18(a,s,c);
- input a;
- input[2:0]s;
- output [7:0]c;
- wire [1:0] c1;
- demux_12 intermediate(.a(a),.s(~s[2]),.c(c1));
- demux_14 out1(.a(c1[0]),.s(~s[1:0]),.c(c[7:4]));
- demux_14 out2(.a(c1[1]),.s(~s[1:0]),.c(c[3:0]));
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement