Register temporarily stores 8-bits of data and delays it by eight clock periods from. Write VHDL code for 4bit up down counter with synchronous reset and clear. VHDL 8-bit counter. Ask Question. Up vote 1 down vote favorite. I am a complete beginner in VHDL, so I was hoping that someone could help me with this project I am working on. Browse other questions tagged vhdl counter xilinx or ask your own question. 3 years, 9 months ago. 3 years, 9 months ago.
Search with a picture instead of text
![8 bit games 8 bit games](/uploads/1/2/6/2/126252330/687665109.png)
OR
Take photo
The photos you provided may be used to improve Bing image processing services.
To use Visual Search, enable the camera in this browser
- UnsaveSee allYou can find this image in the 'All saves' collection.
- More
- 1011 x 483 · png
- 842 x 532 · gif
- 609 x 744 · gif
- 843 x 762 · gif
- 1280 x 720 · jpeg
- 1200 x 1286 · png
- 1124 x 482 · png
- 960 x 720 · jpeg
- 1280 x 720 · jpeg
- 1294 x 438 · png
- 829 x 435 · png
- 834 x 438 · png
- 728 x 942 · jpeg
- 800 x 843 · png
- 728 x 942 · jpeg
- 600 x 201 · png
- 874 x 383 · png
- 1280 x 720 · jpeg
- 638 x 826 · jpeg
- 1280 x 720 · jpeg
- 1280 x 720 · jpeg
- 1168 x 628 · png
- 316 x 213 · jpeg
- 448 x 418 · jpeg
- 955 x 495 · png
- 441 x 607 · gif
- 640 x 392 · jpeg
- 565 x 480 · gif
- 345 x 333 · png
- 483 x 556 · gif
- 960 x 720 · jpeg
- 954 x 392 · jpeg
- 977 x 323 · png
- 497 x 272 · png
- 1280 x 720 · jpeg
Please select one of the options below.
Created on: 28 January 2013
A shift register is written in VHDL and implemented on a Xilinx CPLD. Two different ways to code a shift register in VHDL are shown.
Shift Register Operation
A register stores data i.e. logic levels, zeros and ones. A shift register has the capability of shifting the data stored in the register from left to right or right to left.
Shift registers consist of D flip-flops as shown in the figure below. This is a four bit shift register and therefore consists of four D flip-flops. This shift register is configured to shift data from the left to the right.
Data is fed into the D input of the first flip-flop on the left. This data can be either a 0 or a 1 and will be shifted to the right on each rising edge of the clock pulse. Whatever the state of the data input when the rising edge of the clock pulse occurs will be the logic level that is shifted into the first flip-flop. The data in each flip-flop will be shifted to the flip-flop on its right when the rising edge of the clock pulse occurs.
A Shift Register is Made from D-type Flip-flops
The image below shows an eight bit shift register that is created in VHDL code in this tutorial. Data is shifted from left to right – from Most Significant Bit (MSB) to Least Significant Bit (LSB).
The Shift Register as Created in VHDL Code
It is also possible to shift data from right to left and to use the LSB as an input for serial data.
Shift Register VHDL Code
There are two examples of a shift register written in VHDL below. The two different examples create the same shift register using slightly different VHDL code.
This video shows the VHDL shift register in action. Both VHDL code examples of the shift register behave in exactly the same way when implemented on the CPLD.
These shift registers are both serial to parallel shift registers as they take the serial data from the D input and shift it for display on 8 LEDs in parallel.
Amazon.co.uk
First Shift Register
This example creates a shift register using a VHDL signal called shift_reg shown in the code listing below. This register is initialized with the value of 00h so that when power is switched on to the CPLD board, the register will be cleared. The shift_reg register is 8 bits wide and the VHDL code connects each bit in the register to an LED, so that 8 LEDs show the value in each bit of the register.
On the home built CPLD board, the LEDs will all initially be switched on because of the wiring of the LEDs to the CPLD which effectively inverts the logic level on the CPLD pin.
Inputs and Outputs
The shift register has a D input for serial data. In the video, this input is connected to the right switch of the switch bank and feeds data into the shift register.
The CLK input of the shift register is connected to a clock source. Data is shifted in the shift register on each rising edge of the clock pulse.
The LED outputs connect each bit in the shift register to its own LED on the CPLD board.
Clock Divider
A clock divider is used to slow down the input clock so that the contents of the shift register will be visible on the LEDs.
Tutorial 6 (Clock Divider in VHDL) in this course shows how to set up the input clock for the home made CPLD board.
Doing the Shifting
The shifting inside the shift register takes place in a VHDL process. On every rising edge of the clock pulse (the divided clock pulse), the data in the shift register is shifted one bit to the right – from the MSB to the LSB.
The shifting is done by moving each bit to the bit position to its right, e.g. shift_reg(6) <= shift_reg(7); moves bit 7 to bit 6, and so on for each bit.
The source of the data being shifted is from the D input which is connected to a switch on the board. The D input is fed to the MSB of the shift register (i.e. bit 7): shift_reg(7) <= D;
Second Shift Register
The second VHDL shift register, shown below, works in exactly the same way as the first shift register except that the shifting process is simplified.
In the above code, the shifting is done by moving seven bits of data in a single line of code. Bits 7 to 1 (the upper seven bits) are moved to bits 6 to 0 all in one go. In other words the upper seven bits are moved right by one bit position.
New data from the D input is then fed into the MSB (bit 7).
Please enable JavaScript to view the comments powered by Disqus.
VHDL CPLD Course