LOGI - Virtual Components - Project
Virtual Components Overview
The subject of Virtual Components (VC) was mentioned in the kickstarter comments in regard to the potential of being able to add components to a project when you just don’t have it physically available. The LOGi-Team likes to take suggestions and put them into action and would like to introduce to the first beta version of LOGI Virtual Components.
Using Virtual components is a great way of implementing hardware in the loop at the hobbyist/education level. Using Virtual components allows the user to maximize their use of the LOGi Development boards by being able to easily add components to a project that may not be needed as primary functionality on the development board. There is no need to have an FPGA board with multiple LEDs, Switches, Buttons, 7 seg. You can use virtual components to add components you need to use. You can mix and match pre-designed virtual component modules any configuration needed for the project with no cost, no hardware and no chance of burning anything up.
Usually when you buy a FPGA platform to learn HDL, you will inevitably feel the need to drop the board and move to hardware specialized for your next application. Using virtual components solves this issue by allowing the user to add and remove the components to fit and meet the needs of progressing projects. This adds a great amount of flexibility for users of the LOGi-Boards and will hopefully allow the boards to be used in a maximum array of applications.
We have designed some base virtual components to test with the current LOGi-boards. We have developed a full frame-work from HDL to API wrappers that can interface with the virtual components on the Raspberry Pi or BeagleBone. Below is a listing of the current components, potential future components, video of components running on the LOGi-Pi and a top level block diagram of the architecture.
LOGi-Virtual Components Functional Block Diagram
Current Virtual Components
- Virtual LED
- Virtual SSEG Display
- Virtual Push button
- Virtual DIP Switch
Potential Virtual Components that could be designed
- Virtual Gauge Output
- Virtual Dial Input
- Virtual PWM LED
- Virtual PWM DAC
- Virtual 8x8 led matrix
- Virtual Servo
Functional Overview of Virtual Components used in the LOGI App
Users can run the LOGI-Pi LOGI App that will demo the concept fo the virtual components (VC). The LOGI App emulates teh functionality of a "breadboard" that are typically used for prototyping electronic circuits. The functional components can be seen in the above image, which include a 4x SSEG display,(VSSEG) 8 x DIP SW (VSW), 4x Push Button (VPB) and 8x LEDs (VLED). The components will be referred to with V prefix to denote them being "Virtual", vs "Real" for the real physical components that reside on the LOGI-Pi board.
The virtual components are created by using the python pygame library, which is very easy to use and allows for dynamic functionality to input and output stimulus that emulates the virtual components. The HDL project for the FPGA can be found within the LOGI projects repository here. The HDL project uses our standard LOGI wishbone structure to communicate between the Raspberry Pi with the graphical components to the FPGA with the hardware description of the VC components functionality. See the "LOGi-Virtual Components Functional Block Diagram" above for a graphical view of the interconnect.
Running the Virtual Components LOGI-App - Step by Step Guide
- The Virtual Component LOGI App must run from Raspbian desktop with an attached monitor (Raspbian base image)
- logi-tools installed (see installing logi-tools here or get a pre-configured logi-image here)
- pygame must be installed (The make_demo.sh script will install pygame if it is not already installed the first time the app is run).
For consistency and simplicity we will refer to numbering of components from left to right based upon the setup image above. This is based upon the virtual DIP SW already being labeled this way and we will stay consistent with this. The numbering will be 1 based (start from 1 not 0).
The demo resides within the logi-apps. So the easiest way to run the demo is the download and run the demo using the instructions found on the logi-apps wiki page. In short you can download all of the logi-apps by running "git clone -b logipi https://github.com/fpga-logi/logi-apps.git " . You can then navigate to the virtual component demo directory and run "sudo ./make_demo" to load the bit file and display basic instructions for the edu demo.
Step by Step
1) Run "startx" if you are in console mode, then "sudo ./make_demo.sh" from the command line within the logi-app/virtual components directory. This will run the setup script that will check to make sure that pygame is installed. If pygame is not installed it will be downloaded and installed, which will take a little time. After pygame is installed the script will output some basic instructions on the terminal and launch the virtual components breadboard window. The initial state of the program is a "Knigh Rider" side to side led scan along the 8x VLEDs. You can change the mode of program functionality by changing the virutal DIP Switch (VSW) values (click on them) and the virutal push buttons (VPB). See "LOGI-Apps Virtual Components Functionality" for specific functionality.
2) Click on VSW(8) to push it high. This will enable the virtual seven segment displays (VSSEG) to begin counting. The default timescale is 1 second and the VSSEGs will begin counting from 0-F in hexadecimal.
3) Click on VSW(7) to push it high. This will change the VLEDs mode to dispaly a binary count rather than the Knight Rider display. The count is a representation of the current count value within the FPGA. The count will eventually roll over to 0 and the VLEDs will continuosly count up in binary.
4) Have a look at the Real LEDs on the LOGI board. You will note that the LEDs represent the low bits of the internal count value within the FPGA. You can see that Real LEDs are synchronized with the VLEDs and VSSEG update.
5) Push the virtual push button 1 (VPB) to reset the count, which will reset the VSSEG and VLED values. Note that the count resides on the FPGA and a all data signals are being transmitted over wishbone to the Raspberry Pi which is then updated on the virtual breadboard. So, the FPGA reads the VPB1 value overwishbone and resets the count internally.
6) 1 second if kind or boring. Let's steup it up a bit. VSW1 and VSW2 enable higher speed counts within the FPGA. The increment is in binary from the VSW. So setting VSW1 = low and VSW2 = high = binary 1 and will increase the speed of the increment within the FPGA accordingly. The increments are from 1, 5, 10, 100hz based upon the binary value of the VSW. So VSW1 = low and VSW2 = low = 1Hz and VSW1 = high and VSW2 = high = 100hz count update. Note that you will begin to see the limits of the the RPi and pygame are capable of dynamically updating on the display. Go ahead and play with incrementing and decrementing the count speed. You can also lower VSW(7) to get a higher speeed Knight Rider display.
7) Push the Real Push Button 2 (far right push button). This PB also reset the internal count of the FPGA. Note that the SSEG and binary count LEDs restart at 0. So VPB1 and PB2 both reset the count.
We have mostly been giving the FPGA stimulus from the breadboard virtual componets that then changes the functionality within the FPGA. Let make it more apparent that we are going full loop from the physical world to the virtual world through the FPGA.
8) Push VSW6 high. This will will stop the VLED count and the Real LED count. Push Virtual Push Button 3 and 4 (VPB3 and VPB4). This will turn on the Real LEDS on the LOGI-Pi board.
9) Toggle the Real DIP SW values on the LOGI-Pi board. This will turn on and off the Virtual LEDs 7 and 8.
This allows the users to see the virtual push buttons clicks turn on and off the Real LEDs and then the Real SW values change the Virtual LEDs.
10) You can now play with different combination of the below commands to see what kind of interested effects you can see. Note these are just few components that we thought might be useful. See the list of potential further components that we think are possible. Have a look at the LOGI virtual components project to get an idea of how to create this functionality using wishbone. We are currently working on ways to create any number of wishbone projects in an easy way using the LOGI Skeleton editor. Note that you will begin seeing wishbone more and more. We think it makes integrating cool functionality a snap ;).
LOGI-Apps Virtual Components Functionality
- VSW(8): 1 = enables the SSEG to begin counting
- VSW(7): 0 = binary count, 1 = "knight rider" : toggles between the LEDS displaying the binary and the "knigh rider" cylon side to side scroll
- VSW(6): 0 = standard LED, 1 = VPB to fpga LED and fpga DIPSW to VLED : if dip switch 6 is high you can press the virtual push buttons and the Real LEDs on the fpga board will follow the virutal push butttons 3 and 4. The Virtual$
- VSW(1:2): 00-11 : This will increment the count value which drivers the SSEG count and the binary count on the LEDS.
- VPB(1): 1 = reset count : pushing virtual PB0 will reset the SSEG and binary count
- VPB(3): 1 = will enable the Real LED on FPGA board when VDIPSW(6) is = 1.
- VPB(4): 1 = will enable the Real LED on FPGA board when VDIPSW(6) is = 1.
- REAL COMPONENTS FUNCTIONALITY:
- DIPSW(1:2): The Virtual LED 7 and 8 will follow the DIP SW value when VDIPSW(6) is = '1'
- SW(2): This will reset the count variable
- LED(1:2): Will display the low 2 bits of the count when VDIPSW(7)= '1' or will display VPB(3:4) when DIPSW(6) = '1'
- PB(1): This will reset the FPGA
- PB(2): This will reset the count
Flexibility of the LOGi-Tools
We were able to create LOGi Virtual Component project using the pre-existing LOGi-Tools including the wishbone HDL, API , python wrapper. Fortunately for us the drivers are very flexible and lend themselves well be easily being adapted to new and contrasting projects. Based on the ease of integration we were able quickly put together the Virtual Component demo (2 days). We hope this showcases some of the flexibility and capability of being able to easily create and interface to a variety of potential applications. So what kind of projects would you like to implement with the LOGi-Tools? Have more ideas of you would like to share that we might think about implementing?
Where To Go From Here
LOGI Skeleton editor - An automated way of easily creating your own custom wishbone projects with our pre-developed peripherals.
More interesting LOGI-Apps that you can run with a flick of the keyboard: "sudo ./make_demo.sh"
All of the LOGI Drivers, Sofware, Hardware that you can use in your projects (LOGI Repository)