




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Due Sep. 26, 2008
EE 231 Homework Assignment #4 http://www.ee.nmt.edu/~rison/ee231/hw/hw04.html 1 of 1 9/28/2008 3:37 PM
hw04_soln.v Page 1
// 3.
// (e) Note that the threeโinput gate is DeMorgan representation of a NOR gate
module Fig_3_26_gates (F, A, B, C, D, E); output F; input A, B, C, D, E; wire w1, w2, E_bar;
not (E_bar, E); nor (w1, A, B); nor (w2, C, D); nor (F, w1, w2, E_bar); endmodule
// (f) Note that all gates are NOR gates
module Fig_3_27_gates (F, A, B, C, D); output F; input A, B, C, D; wire w1, w2, w3, w4, A_bar, B_bar, D_bar;
not (A_bar, A); not (B_bar, B); not (D_bar, D); nor (w1, A_bar, B); nor (w2, A, B_Bar); nor (w3, C, D_bar); nor (w4, w1, w2); nor (F, w4, w3); endmodule
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// 3.
// (e)
module Fig_3_26_CA (F, A, B, C, D, E); output F; input A, B, C, D, E;
// (a) To get A NOR B: ~(A + B) // (b) To get C NOR D: ~(C + D) // (c) Finally, take the NOR of (a) and (b) with E'
assign F = ~( ~(A + B) + ~(C + D) + ~E );
// Another way, from the Boolean equation: // assign F = (A + B) & (C + D) & E;
endmodule
// (f)
module Fig_3_27_CA (F, A, B, C, D); output F; input A, B, C, D;
// (a) First, get A' NOR B: ~(~A + B) // (b) Then get A NOR B': ~(A + ~B) // (c) NOR (b) and (c) together: ~( ~(~A + B) + ~(A + ~B)) // (d) Get C NOR D': ~(C + ~D) // (e) Finally, NOR (c) and (d) together:
assign F = ~( ~( ~(~A + B) + ~(A + ~B)) + ~(C + ~D));
// It is hard to read the above gateโlevel translation. // It is easier to write directly from the Boolean equation // // assign F = ((A & ~B) + (~A & B)) & (C + ~D);
endmodule
hw04_soln.v Page 2
// A primitive has one output, and is defined by a truth table. // The circuit will have an output of 1 when three or four of the inputs // are 1; otherwise, the output will be 0.
UDP_Majority_4 (y, a, b, c, d); output y; input a, b, c, d; table // a b c d : y 0 0 0 0 : 0 ; 0 0 0 1 : 0 ; 0 0 1 0 : 0 ; 0 0 1 1 : 0 ; 0 1 0 0 : 0 ; 0 1 0 1 : 0 ; 0 1 1 0 : 0 ; 0 1 1 1 : 1 ; 1 0 0 0 : 0 ; 1 0 0 1 : 0 ; 1 0 1 0 : 0 ; 1 0 1 1 : 0 ; 1 1 0 0 : 0 ; 1 1 0 1 : 0 ; 1 1 1 0 : 1 ; 1 1 1 1 : 1 ; endtable endprimitive