Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module segment_zero (c3,c2,c1,c0,m);
- input c3;
- input c2;
- input c1;
- input c0;
- output m;
- assign m = ((~c2 & ~c0) | (~c3 & c1) | (c2 & c1) | (c3 & ~c0) | (~c3 & c2 & c0) | (c3 & ~c2 & ~c1));
- endmodule
- module segment_one (c3,c2,c1,c0,m);
- input c3;
- input c2;
- input c1;
- input c0;
- output m;
- assign m = ((~c3 & ~c2) | (~c2 & ~c0) | (~c3 & ~c1 & ~c0) | (~c3 & c1 & c0) | (c3 & ~c1 & c0));
- endmodule
- module segment_two (c3,c2,c1,c0,m);
- input c3;
- input c2;
- input c1;
- input c0;
- output m;
- assign m = ((~c3 & c2) | (c3 & ~c2) | (~c1 & c0) | (~c3 & ~c1) | (~c3 & c0));
- endmodule
- module segment_three (c3,c2,c1,c0,m);
- input c3;
- input c2;
- input c1;
- input c0;
- output m;
- assign m = ((~c3 & ~c2 & ~c0) | (c1 & c0 & ~c2) | (~c1 & c0 & c2) | (c1 & ~c0 & c2) | (~c1 & ~c0 & c3));
- endmodule
- module segment_four (c3,c2,c1,c0,m);
- input c3;
- input c2;
- input c1;
- input c0;
- output m;
- assign m = ((c1 & ~c0) | (c3 & c2) | (~c2 & ~c0) | (c3 & c1));
- endmodule
- module segment_five (c3,c2,c1,c0,m);
- input c3;
- input c2;
- input c1;
- input c0;
- output m;
- assign m = ((~c1 & ~c0) | (c3 & ~c2) | (c3 & c1) | (c2 & ~c0) | (~c3 & c2 & ~c1));
- endmodule
- module segment_six (c3,c2,c1,c0,m);
- input c3;
- input c2;
- input c1;
- input c0;
- output m;
- assign m = ((c3 & ~ c2) | (c1 & ~c0) | (c1 & ~c2) | (c3 & c0) | (~c3 & c2 & ~c1));
- endmodule
- module seven_segment_display (SW, HEX0);
- input [3:0] SW;
- output [6:0] HEX0;
- segment_zero zero(
- .c3(SW[3]),
- .c2(SW[2]),
- .c1(SW[1]),
- .c0(SW[0]),
- .m(HEX0[0])
- );
- segment_one one(
- .c3(SW[3]),
- .c2(SW[2]),
- .c1(SW[1]),
- .c0(SW[0]),
- .m(HEX0[1])
- );
- segment_two two(
- .c3(SW[3]),
- .c2(SW[2]),
- .c1(SW[1]),
- .c0(SW[0]),
- .m(HEX0[2])
- );
- segment_three three(
- .c3(SW[3]),
- .c2(SW[2]),
- .c1(SW[1]),
- .c0(SW[0]),
- .m(HEX0[3])
- );
- segment_four four(
- .c3(SW[3]),
- .c2(SW[2]),
- .c1(SW[1]),
- .c0(SW[0]),
- .m(HEX0[4])
- );
- segment_five five(
- .c3(SW[3]),
- .c2(SW[2]),
- .c1(SW[1]),
- .c0(SW[0]),
- .m(HEX0[5])
- );
- segment_six six(
- .c3(SW[3]),
- .c2(SW[2]),
- .c1(SW[1]),
- .c0(SW[0]),
- .m(HEX0[6])
- );
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement