Constant Divider circuit accepts an input of 8 bit wide and divides it by constant value 53. The divider circuit will generate two output values as remainder and quotient. As we know that the division operator is not synthesizable, so division is done by repetitive subtraction method. As an example of input is 108, the remainder is 2 and quotient is 2 while if input is 20, remainder is 20 and quotient is 0. In this design Inp is input with 8 bit long, Remi and Quo are two output signals with 6-bit and 3-bit long respectively. Here bit lengths of Remi and Quo are decided as per getting maximum value. Divider is constant which is 8 bit long and value is "00110101". Binary value of 53 is "00110101".
Search This Blog
Showing posts with label VHDL. Show all posts
Showing posts with label VHDL. Show all posts
Sunday, 2 October 2016
Tuesday, 31 May 2016
Design 4-bit Linear Feedback Shift Register (LFSR) using VHDL Coding and Verify with Test Bench
Linear Feedback Shift Register is a sequential shift register with combinational feedback logic around it that causes it to pseudo randomly cycle through a sequence of binary values. Feedback around LFSR's shift register comes from a selection of points in the register chain and constitute either XORing or XNORing these points to provide point back into the register. The LFSR basically loops through repetitive sequences of pseudo random values. The maximum length of sequence is (2^n) - 1. It is used for State Encoding. It is also used to generate random numbers. Find out Verilog code here.
Wednesday, 11 May 2016
Design 8 bit Ripple Carry Adder using VHDL Coding and Verify using Test Bench
Given below code will generate 8 bit output as sum and 1 bit carry as cout. it also takes two 8 bit inputs as a and b, and one input carry as cin. This code is implemented in VHDL by structural style. Predefined full adder code is mapped into this ripple carry adder. Full Adder code can be found here. Carry is generated by adding each bit of two inputs and propagated to next bit of inputs. If carry is generated by adding seventh bits and previous carry, then cout bit goes high.
Saturday, 16 April 2016
Design Gray Counter using VHDL Coding and Verify with Test Bench
Given below code is about Gray Counter in VHDL. In a gray code only one bit changes at a one time. This design code has two inputs clock and reset signals and one four bit output that will generate gray code. In the first if rst signal is high then output will be zero and as soon as rst will go low, on the rising edge of clk, design will generate four bit gray code and continue to generate at every rising edge of clk signal. This design code can be upgraded and put binary numbers as a input and this design will work as binary to gray code converter. Find out Verilog Code of Gray Counter here.
Thursday, 10 March 2016
A Brief Overview Of Data Type in VHDL.
VHDL is strongly typed language and it supports a variety of Data Types and Operators. Users can also define their own data types and operators in user defined packages. There are three basic classes to define data objects in VHDL language.
- Signal : It represents interconnections that connect components and parts.
- Variable : It is used for local storage within process.
- Constant : It is used to declare a fixed value.
The data object can be a scalar or an array (one dimensional as well as multi dimensional).
Saturday, 27 February 2016
Get Knowledge of Operators in VHDL with Examples
VHDL has wide range of Operators, which can be grouped into following
- Logical Operators
- Relational Operators
- Shift Operators.
- Miscellaneous Operators
Wednesday, 10 February 2016
Get Knowledge of Delay Types in VHDL
In VHDL, delays are specified only in signal assignment not in variable assignment. Delays are not synthesizable. There are two types of delay in VHDL Language.
- Transport Delay
- Inertial Delay
- Transport Delay : It is the delay model just delay the signal or change the value of the signal by the time specified in the after clause. It is the characteristic of the hardware elements that exhibits infinite frequency response. Any pulse is transmitted no matter how small it is.
Monday, 8 February 2016
Design BCD to 7-Segment Decoder using VHDL Code
Given below VHDL code will convert 4 bit BCD into equivalent seven segment number. It will accept 4 bit input and generate seven bit output. One seven segment can show zero to nine digit, so there is 4 bit input. Code is written for Common Cathode seven segment LED.So, LEDs will glow when the input is high. Find out Verilog Code here.
Common Cathode Seven Segment Display |
Friday, 29 January 2016
Design Johnson Counter and Test with Test Bench using VHDL Code
Johnson Counter is one kind of Ring Counter. It is also known as Twisted Ring Counter. A 4-bit Johnson Counter passes blocks of four logic "0" and then passes four logic "1". So it will produce 8-bit pattern. For example, "1000" is initial output then it will generate 1100, 1110, 1111, 0111, 0011, 0001, 0000 and this patterns will repeat so on. Find out Verilog Code here.
Sr. No.
|
Name of the Pin
|
Direction
|
Width
|
Description
|
1
|
Clk
|
Input
|
1
|
Clock Signal
|
2
|
Rst
|
Input
|
1
|
Reset Signal
|
3
|
Op
|
Output
|
4
|
Output Signal
|
Thursday, 28 January 2016
VHDL Code for Ring Counter
Ring Counter is composed of Shift Registers. The data pattern will recirculate as long as clock pulses are applied. For example, if we talk about 4-bit Ring Counter, then the data pattern will repeat every four clock pulses. If pattern is 1000, then it will generate 0100, 0010, 0001, 1000 and so on. Find out Verilog Code here.
Ring Counter |
Sr. No.
|
Name of the Pin
|
Direction
|
Width
|
Description
|
1
|
Clk
|
Input
|
1
|
Clock Signal
|
2
|
Rst
|
Input
|
1
|
Reset Signal
|
3
|
Op
|
Output
|
4
|
Output Signal
|
Sunday, 10 January 2016
Verilog and VHDL Code for Digital Clock
Given below code is Simple Digital Clock. It accepts one input as 50 MHz clock and gives three output as Hour, Minute and Second. This code converts internally 50 MHz into 1 Hz Clock Frequency. In this code first process converts frequency from 50 MHz to 1 Hz. in the second process at every clock event second value will increment but up to 59 and then again zero. Same way Minute value will also increment after second value will reach to 59, but up to 59. Hour value will increment when minute value reaches to 59 and goes up to 23 and again goes to zero. In the last integer values of ss, mm and hr are converted into standard logic vector and assign to Second, Minute and Hour respectively. If you want to display this clock on your 7 segment or LCD display then you have write another code that accepts these inputs and generates equivalent output to be displayed.
Friday, 8 January 2016
VHDL Code for Bitonic Sorter
Bitonic Sorter is one kind of Sorting Algorithm. This algorithm invented by Ken Batcher. You can find more detail about this algorithm over here.
Bitonic Sorter |
Wednesday, 6 January 2016
VHDL Code for Generation of 1 KHz and 1 Hz Frequency from 100 MHz Frequency
Given below VHDL code will generate 1 kHz and 1 Hz frequency at the same time. This design takes 100 MHz as a input frequency. For this we need counter with different values and that will generate above frequencies. There is a simple formula to find this count value and it is given below.
Count Value = (Input Frequency) / (2 * Output Frequency).
In our case Count Value for 1 kHz is (100 * 10^6) / (2 * 1 * 10^3) = 50,000. After 50,000 count, level of msClk will change.
and for 1 Hz is (100 * 10^6) / (2 * 1) = 5,00,00,000.
Name of Pins
|
Direction
|
Data Width
|
sysClk
|
Input
|
1
|
msClk
|
Output
|
1
|
secClk
|
Output
|
1
|
Sunday, 3 January 2016
VHDL Code for Debouncer Circuit
The debouncer circuit is useful when we specially use push button switches in our design. This design code will generate high pulse for 1 millisecond after press and goes back to low. If you want to input a manual switch signal into a digital circuit you'll need to debounce the signal so a single press doesn't appear like multiple presses. Pin description is given below.
Name of Pins | Direction | Data Width |
msClk | Input | 1 |
pb | Input | 1 |
debouncedPb | Output | 1 |
Saturday, 5 December 2015
VHDL Code of (7,4) Hamming Code Encoder
Name of Pins | Direction | Width |
Datain | Input | 4 |
Hamout | Output | 7 |
Hamming code is useful in Error Correction in Linear Block Code. This code will encode four bits of data and generate seven bits of code by adding three bits as parity bits. It was introduced by Richard W. Hamming. This algorithm can detect one and two bit error and can correct one bit error. Given below code will generate (7,4) Systematic Hamming Encoder. This encoder will use Least Significant 4 bits as data inputs and Most 3 significant bits as a parity bits.
Parity bits equations are given below
p0 = datain(0) xor datain(1) xor datain(3)
p1 = datain(0) xor datain(2) xor datain(3)
p2 = datain(1) xor datain(2) xor datain(3)
Thursday, 10 July 2014
Saturday, 28 June 2014
VHDL Programming Code Structure
VHDL stands
for Very High speed integrated circuits Hardware Description Language. It was
funded by the US Department of Defense in the 70’s and 80’s. It was
established as IEEE standard IEEE 1076 in 1987. It was later updated on 1993, 2002
and 2008. Today VHDL
is widely used across the industry for design description, simulation and
synthesis purpose.
Here
General Structure of VHDL Program is given below
·
Library
Declaration
·
Package
Declaration
·
User
Defined Library Declaration*
·
User
Defined Package Declaration*
·
Entity
Declaration
o
Generic
Declaration
o
Port
Declaration
·
Architecture
Declaration
·
Configuration
Declaration
Wednesday, 14 May 2014
Shift Operators in VHDL
There are total six shifting operators in VHDL language.
- sll
- It means Logical Shift Left.
- It shifts the elements in the array by n places to left and fill vacanted positions with "0".
- Ex
- "1000_1010" sll 3 will give "0101_0000".
- "1000_1010" sll -2 will give "0010_0010".
Wednesday, 4 December 2013
Difference between Verilog and VHDL
Verilog
|
VHDL
|
Verilog isn’t strongly typed language.
|
VHDL is strongly typed language.
|
Verilog is case sensitive language.
|
VHDL is case insensitive language.
|
Verilog is easy to learn comparatively VHDL.
|
VHDL is hard to learn comparatively Verilog.
|
Verilog has simple data types. |
VHDL allows creating more complex data types.
|
Verilog has a lack of library management.
|
VHDL has a very good library management.
|
Thursday, 31 October 2013
VHDL Code for Round Robin Arbiter with Fixed Time Slices
S.No.
|
Name
|
Direction
|
Width
|
Remark
|
1
|
Rst
|
Input
|
1
|
Reset signal
|
2
|
Clk
|
Input
|
1
|
Clock signal
|
3
|
Req
|
Input
|
4
|
Request for user1 ,user2,user3,user4
|
4
|
Gnt
|
Output
|
4
|
four grant signal to the Users
|
Round-robin (RR) is one of the simplest scheduling algorithms for processes in an operating system. As the term is generally used, time slices are assigned to each process in equal portions and in circular order, handling all processes without priority (also known as cyclic executive). Round-robin scheduling is simple, easy to implement, and starvation-free. Round-robin scheduling can also be applied to other scheduling problems, such as data packet scheduling in computer networks. Find out Round Robin Arbiter with variable time slice here.
Subscribe to:
Posts (Atom)