Sunday 21 July 2013

Design of Binary To GRAY Code Converter using CASE Statements (Behavior Modeling Style) Verilog CODE-






Design of Binary to Gray Code Converter using CASE Statement (Behavior Modeling Style) -


Output Waveform ::   Binary To GRAY Code Converter


Verilog CODE -


//-----------------------------------------------------------------------------
//
// Title       : Binary_to_Gray
// Design      : verilog upload 2
// Author      : Naresh Singh Dobal
// Company     : nsdobal@gmail.com
// Verilog Programs & Exercise by Naresh Singh Dobal.
//
//-----------------------------------------------------------------------------
//
// File        : Binary to Gray Code converter using case statements.v


module Binary_to_Gray ( 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 = 6;
5 : dout = 7;
6 : dout = 5;
7 : dout = 4;
8 : dout = 12;
9 : dout = 13;
10 : dout = 15;
11 : dout = 14;
12 : dout = 10;
13 : dout = 11;
14 : dout = 9;
default : dout = 8;
endcase
end

endmodule

0 comments :

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes