Category: VHDL

VHDL Code for Binary to BCD Converter

Binary to BCD Converter Some times we need to display the output in a seven-segment display. For that purpose we will convert binary to BCD. To translate from binary to BCD, we can employ the shift-and-add-3 algorithm: Left-shift the (n-bit) binary number one bit. If n shifts have taken place, the number has been fully

VHDL code for 4-bit binary comparator

Binary comparator compare two 4-bit binary number. It is also known as magnitude comparator and digital comparator. Analog form comparator is voltage comparator. The functionality of this comparator circuit is, It consist of 3 outputs Greater, Equal and Smaller. If inp-A is greater then inp-B then greater output is high, if both inp-A and inp-B

VHDL Code for 4-bit Adder / Subtractor

This example describes a two input 4-bit adder/subtractor design in VHDL. The design unit multiplexes add and subtract operations with an OP input. 0 input produce adder output and 1 input produce subtractor output. VHDL Code for 4-bit Adder / Subtractor

VHDL Code for Flipflop – D,JK,SR,T

All flip-flops can be divided into four basic types: SR, JK, D and T. They differ in the number of inputs and in the response invoked by different value of input signals. SR FlipFlop A flip-flop circuit can be constructed from two NAND gates or two NOR gates. These flip-flops are shown in Figure. Each flip-flop has two outputs, Q

VHDL Code for Clock Divider (Frequency Divider)

Clock Divider Clock Divider is also known as frequency divider, which divides the input clock frequency and produce output clock. In our case let us take input frequency as 50MHz and divide the clock frequency to generate 1KHz output signal. VHDL code consist of Clock and Reset input, divided clock as output. Count is a

VHDL code for 4-bit ALU

ALU ALU’s comprise the combinational logic that implements logic operations such as AND, OR, NOT gate and arithmetic operations, such as Adder, Subtractor. Functionally, the operation of typical ALU is represented as shown in diagram below, Functional Description of 4-bit Arithmetic Logic Unit Controlled by the three function select inputs (sel 2 to 0), ALU can

VHDL Code for 4-Bit Shift Register

Shift Register VHDL Code for shift register can be categorised in serial in serial out shift register, serial in parallel out shift register, parallel in parallel out shift register and parallel in serial out shift register. Parallel In – Parallel Out Shift Registers For parallel in – parallel out shift registers, all data bits appear