# Verilog Netlist and verilog file not justifying each other

i generated a verilog netlist file with the help of a test case for 2-1 encoder .To test the netlist i draw the schematic diagram and try to find the output.I can't upload the pic of schematic which i draw by hand but below is the verilog file

module test (input [1:0] in, input enable, output reg  out);

always @(in or enable)
if(!enable)
out = 4'b0000;
else begin
case (in)
2'b00 : out = 0 ;
2'b01 : out = 1;
2'b10 : out = 0;
2'b11 : out = 1;
endcase
end
endmodule


which says that output must be 0,1,0,1

i generated a netlist which is given below

module test(enable, in, out);
input [1:0] in;
input enable;
output out;

wire  synth_net_4;
wire  synth_net_9;
wire  synth_net_12;
wire  synth_net_17;

wire  synth_net_19;
wire  synth_net;
GND synth_GND_0(.out(synth_net_4));
GND
synth_GND_1(.out(synth_net_12));
MUX4 synth_MUX(.in({synth_net_17,
synth_net_12, synth_net_9, synth_net_4}), .select({in[1], in[0]}), .out(
synth_net_19));
VCC synth_VCC_2(.out(synth_net_9));
VCC synth_VCC_5(.out(
synth_net_17));
BUF synth_BUF(.in(enable), .out(synth_net));
AND2 synth_AND(
.in({synth_net_19, synth_net}), .out(out));
endmodule


but schematic with respect to this netlist give output as 1,0,1,0.So am i doing something wrong in getting exact schematic?I just want to validate that netlist corresponds exactly to verilog file.

• If you upload your drawing to somewhere on the web (like imgur.com), someone with more rep can add it in to your post. – The Photon May 24 '13 at 13:23
• Can you explain more about how you generated the netlist form? And what you expected the netlist to contain. I see a MUX4 and an AND2 in the netlist, so it looks pretty close to your code. Why is it not like what you were expecting? – The Photon May 24 '13 at 13:25
• out is only determined by the LSB of in. therefore synthesis has optimised the mux and only given you a 1 bit mux. – pre_randomize May 24 '13 at 14:16
• @pre_randomize, Are you sure? The MUX4 line has 4 inputs and 2 select lines. If it was going to optimize, it could optimize it to a single AND gate: out = in[0] & enable. – The Photon May 24 '13 at 14:44
• Actually i got where i was lacking.Earlier my output was just reverse of what was supposed to be.Actually later i found that port numbering in MUX start from downside, so now output will be as what was expected.Actually i had made the schematic by hand so i am not able to upload it. – shailendra May 24 '13 at 14:53

module test (input in, input enable, output out);