Verilog HDL(HDLBits)
Verilog Language Basic
08-Module Declaration
module top_module (
input p1a, p1b, p1c, p1d, p1e, p1f,
output p1y,
input p2a, p2b, p2c, p2d,
output p2y );
/*自己写的太冗余
wire temp_2ab,temp_2cd,temp_2abcd; //left gate
wire temp_1abc,temp_1def,temp_1abcdef; //right gate
assign temp_2ab = p2a&p2b,temp_2cd = p2c&p2d; //left gate
assign temp_2abcd = temp_2ab|temp_2cd; //right gate
assign temp_1abc = p1a&p1b&p1c,temp_1def = p1d&p1e&p1f;
assign temp_1abcdef = temp_1abc|temp_1def;
assign p2y = temp_2abcd;
assign p1y = temp_1abcdef;
*/
assign p1y = (p1a & p1b & p1c)|(p1d & p1e & p1f); //right gate
assign p2y = (p2c & p2d)|(p2a & p2b); //left gate
endmodule