Latest Post

Ads

VLSI: Gray to Binary and Binary to Gray Dataflow Modelling

Gray to Binary:

module Gray_to_Binary(
    input g1,
    input g2,
    input g3,
    input g4,
    output b1,
    output b2,
    output b3,
    output b4
    );
assign b4 = g4;
assign b3 = b4 ^ g3;
assign b2 = b3 ^ g2;
assign b1 = b2 ^ g1;

endmodule



Binary to Gray:

module Binary_to_Gray(
    input b1,
    input b2,
    input b3,
    input b4,
    output g1,
    output g2,
    output g3,
    output g4
    );
assign g1 = b1;
assign g2 = b1 ^ b2;
assign g3 = b2 ^ b3;
assign g4 = b3 ^ b4;

endmodule

Image result for gray to binary conversion

Ads

Popular posts from this blog

VLSI: BCD to Excess 3 and Excess 3 to BCD Dataflow Modelling

Full Subtractor Verilog Code in Structural/Gate Level Modelling with Testbench

VLSI: 4-1 MUX Dataflow Modelling with Testbench

VLSI: Half Subtractor and Full Subtractor Gate Level Modelling

VLSI: 1-4 DEMUX (Demultiplexer) Dataflow Modelling with Testbench