image/svg+xml
  • Contents
      • Back
      • Digital Basics
      • Verilog
      • Verification
      • SystemVerilog
      • UVM
Most Popular
Verification
  Testbench Evolution
  Constraint Random Verification
  Verification Techniques
  Verification Plan
  Code Coverage

Verilog
  Data Types
  Basic Constructs
  Behavioral Modeling
  Gate Modeling
  Simulation Basics
  Design Examples

SystemVerilog
  Data Types
  Class
  Interface
  Constraints and more!
  Testbench Examples

UVM
  Sequences
  Testbench Components
  TLM Tutorial
  Register Model Tutorial
  Testbench Examples

Digital Fundamentals
  Binary Arithmetic
  Boolean Logic
  Karnaugh Maps
  Combinational Logic
  Sequential Logic




Verilog Binary to Gray

Gray code is a binary code where each successive value differs from the previous value by only one bit.

Implementation #1


module bin2gray #(parameter N=4) ( input  [N-1:0] bin, 
                                   output [N-1:0] gray);
  
  genvar i;    
  generate
    for(i = 0; i < N-1; i = i + 1) begin
      assign gray[i] = bin[i] ^ bin[i+1];
    end
  endgenerate
  
  assign gray[N-1] = bin[N-1];
endmodule

Read more: Verilog Binary to Gray

Gray Code

Gray code, also known as Gray binary code or reflected binary code, is a binary numeral system where adjacent values differ by only one bit. In other words, Gray code is a binary code where each successive value differs from the previous value by only one bit.

For example, the binary representation of decimal numbers 1 and 2 is 0001 and 0010 respectively. Note that two LSB bits (bit#0 and bit#1) have to change for the transition from 1 to 2. In Gray code, 1 and 2 are represented by 0001 and 0011 respectively but the same transition now requires only a change of one bit (bit#1 from LSB).

Read more: Gray Code

Shift Register

A shift register is a sequential digital circuit that is used to store and transfer binary data. It consists of a series of flip-flops connected in a chain, with each flip-flop holding a single bit of data. The input data is shifted through the register one bit at a time, either left or right, depending on the design.

Read more: Shift Register

T Flip-Flop

A T flip-flop can be implemented using NAND logic gates by performing the following steps:

  1. Use two NAND gates in a feedback loop where the output of one NAND gate connects to one of the inputs of the other NAND gate.
  2. Connect a T input to one of the inputs of each NAND gate.
  3. Connect an enable input to both NAND gates' inputs, with the enable signal flipped by an inverter to one of the inputs.
  4. Connect a clock input inverted to either one of the two inputs of each NAND gate.

Read more: T Flip-Flop

JK Flip-Flop

A JK flip-flop can also be implemented using NAND logic gates by performing the following steps:

  1. Use two NAND gates in a feedback loop where the output of one NAND gate connects to one of the inputs of the other NAND gate.
  2. Connect a J and a K input to the inputs of the two NAND gates, respectively.
  3. Connect an enable input to both NAND gates' inputs, with the enable signal flipped by an inverter to one of the inputs.
  4. Connect a clock input inverted to either one of the two inputs of each NAND gate.

Read more: JK Flip-Flop

  1. D Flip-Flop
  2. SR Latch Circuit
  3. Sequential Logic
  4. Digital Full-Adder Circuit
  5. Digital Half-Adder Circuit

Page 6 of 63

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Interview Questions
  Verilog Interview Set 1
  Verilog Interview Set 2
  Verilog Interview Set 3
  Verilog Interview Set 4
  Verilog Interview Set 5

  SystemVerilog Interview Set 1
  SystemVerilog Interview Set 2
  SystemVerilog Interview Set 3
  SystemVerilog Interview Set 4
  SystemVerilog Interview Set 5

  UVM Interview Set 1
  UVM Interview Set 2
  UVM Interview Set 3
  UVM Interview Set 4
Related Topics
  Digital Fundamentals
  Verilog Tutorial

  Verification
  SystemVerilog Tutorial
  UVM Tutorial
  • Verilog Testbench
  • Verilog Coding Style Effect
  • Verilog Conditional Statements
  • Verilog Interview Set 10
  • Synchronous FIFO
  • SystemVerilog Interview Set 10
  • SystemVerilog Interview Set 9
  • SystemVerilog Interview Set 8
  • SystemVerilog Interview Set 7
  • SystemVerilog Interview Set 6
  • UVM Singleton Object
  • UVM Component [uvm_component]
  • UVM Object [uvm_object]
  • UVM Root [uvm_root]
  • UVM Interview Set 4
© 2015 - 2023 ChipVerify
Terms and Conditions | DMCA.com Protection Status