Design of GRAY to Binary Code Converter using CASE Statement (Behavior Modeling Style) -
Output Waveform :: GRAY to Binary Code Converter. |
Verilog CODE-
//-----------------------------------------------------------------------------
//
// Title : Gray_to_binary
// Design : verilog upload 2
// Author : Naresh Singh Dobal
// Company : nsdobal@gmail.com
// Verilog Programs & Exercise by Naresh Singh Dobal.
//
//-----------------------------------------------------------------------------
//
// File : GRAY to Binary Code Converter using case statement.v
module Gray_to_binary ( din ,dout );
output [3:0] dout ;
reg [3:0] dout ;
input [3:0] din ;
wire [3:0] din ;
always @ (din) begin
case (din)
0 : dout = 0;
1 : dout = 1;
2 : dout = 3;
3 : dout = 2;
4 : dout = 7;
5 : dout = 6;
6 : dout = 4;
7 : dout = 5;
8 : dout = 15;
9 : dout = 14;
10 : dout = 12;
11 : dout = 13;
12 : dout = 8;
13 : dout = 9;
14 : dout = 11;
default : dout = 10;
endcase
end
endmodule
0 comments :
Post a Comment