A synchronous FIFO (First-In-First-Out) is a digital circuit that is used to transfer data between the same clock domain and the main function is to buffer data when the rate of data transfer is faster than the rate of data processing.
A synchronous FIFO is called "synchronous" because it uses synchronized clocks to control the read and write operations. The read and write pointers of the FIFO are updated synchronously with the clocks, and data is transferred between the FIFO and the external circuit synchronously with the clocks.
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
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).
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.
A T flip-flop can be implemented using NAND logic gates by performing the following steps:
- 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.
- Connect a T input to one of the inputs of each NAND gate.
- Connect an enable input to both NAND gates' inputs, with the enable signal flipped by an inverter to one of the inputs.
- Connect a clock input inverted to either one of the two inputs of each NAND gate.
