Blog_Insider
(Move to ...)
Home
Career Growth In Vlsi Industry
Semiconductor Job portal - Internship
VLSI world for Freshers
Future of Semiconductor
VLSI Projects
PLL or DLL
Complex Number
Serial Perepheral Interface
UART Design
I2C Design
How to make Digital PLL
Reset - Async or Sync ?
How to convert .db to .lib
How to verify Mixed signal design
Know about unateness
RTL technique for Low Power Design
Unified Power Format - UPF for Low Power
UPF Example
Refreshing Verilog for Interview
Low Power Design and Verification
Blocking and Non Blocking in Verilog
Gate Level Simulation
Code Coverage Analysis
BIST
Static Timing Analysis
SDC - Timing Constraint
Debugging Guideline for Functional Simulation
Clock Dividers and Multipliers
Correct way of Digital design RTL Coding
Digital Design for Beginner and Prof
Clock Gating Circuits
Handling multiclock domain in design ( RTL + SDC )
Implementation of Logical Questions
Step by Step approach to make XOR using NAND
APTITUDE QUESTIONS
Interview Questions on AXI
Edge detection logic with Verilog code
Gvim Help
Error Detection and Correction
Running Disparity
Verilog Code for the counting number of 1's and 0's
Verilog code for binary to gray code
Verilog Code for FIR Filter
Types of Adders with Verilog Code
VHDL Operator
Parameter in Verilog
SpyGlass Custom Goal
Dump Synchronizer using SpyGlass
Generic Interview Questions
Resume Guidelines - A must visit page
Analog IC Design
Left -Edge Algorithm
Max Transition Violation in Design
OCV, AOCV and POCV -Static Timing Analysis
you-need-to-remove-these-6-items
FREE CAD Tools
List of Semiconductor Comanies
The best top 20 universities for MS in Digital VLSI in USA
▼
RTL Code
(Move to ...)
RTL for Asynchronous FIFO
RTL for cnt 0's n 1's
RTL for FIR Filter
RTL for Bin2Gray
RTL for 8-bit ALU
SPI Controller RTL code in Verilog
RTL for Pos/Neg Detector
RTL for Parity Checker
RTL Design for Gray to Binary
RTL for calculate square root
RTL for Round Robin Algo
▼
Top Visited Posts
(Move to ...)
VLSI Projects
100+ VLSI Digital interview questions
Roadmap For Educational Projects in VLSI
▼
Verilog Binary to gray code conversion
How to do binary to gray code conversion -
Verilog Code for Binary to Gray code conversion ->
Equation for Gray code
Hardware for Binary to Gray Code ->
/*Logic to convert binary numbers into Gray coded binary numbers is implemented in the following Verilog Code.
*/
module binary2gray();
reg clk;
reg rstn;
reg [ 5 : 0 ] counter_binary, counter_binary_reg, counter_gray, counter_gray_reg;
integer count, file_wr;
/* Initial block to generate clock and reset */
initial begin
clk = 0 ; rstn = 0 ; # 100 rstn = 1 ;
forever begin
# 10 clk = ! clk;
end end
/* Synchronous Logic for registering the data and incrementing the counter for binary data */
always @ ( posedge clk or negedge rstn)
begin
if (! rstn) begin
counter_binary_reg <= 'b0 ;
counter_gray_reg <= 'b0 ; end
else begin
counter_binary_reg <= counter_binary + 1 ;
counter_gray_reg <= counter_gray;
$display ( "binary number= 6'b%b : gray en-coded binary number = 6'b%b" , counter_binary_reg, counter_gray_reg); end end
/* Logic is to get Gray code from Binary code */
function [ 5 : 0 ] binary2gray ;
input [ 5 : 0 ] value;
integer i;
begin
binary2gray[ 5 ] = value[ 5 ];
for ( i= 5 ; i> 0 ; i = i - 1 )
binary2gray[ i- 1 ] = value[ i] ^ value[ i - 1 ];
end
endfunction
/* Get gray encoded output */
always @(*)
begin
counter_gray = counter_gray_reg;
counter_binary = counter_binary_reg;
counter_gray = binary2gray( counter_binary_reg); end
endmodule
Verilog File -> Binary_to_gray.v
Title of the document
Your small contribution will help to write more useful information
Donate us
Or Click on the ads showing on the page.
No comments:
Post a Comment