Making a D Latch for my EE class. The module DL is by my professor and works correctly. The module DLATCH by me does not work. The code is identical.
Does anyone know why? I call them in exactly the same manner in my main module. I've spent about 3 hours trying to find out why.
module DL(input D, E, output reg Q);
reg S, R, QN;
always @(*) begin
S = ~(D & E);
R = ~(~D & E);
Q = ~(R & QN);
QN = ~(S & Q);
end
endmodule
module DLATCH(input D, E, output reg Q);
reg S, R, QN;
always @(*) begin
S = ~(D & E);
R = ~(~D & E);
Q = ~(R & QN);
QN = ~(S & Q);
end
endmodule