psC Language with the Virtual Board The psC language book, “FPGA for Everyone” contains syntax and documented examples to lean the psC language and program applications. This document and the examples complement the book. In fact, many examples are used in the book. The virtual machine (RVM) executes psC programs in a “target” environment. In the examples, the Virtual Board target is used to simulate the behavior of a basic FPGA board. This document describes the virtual board features and lists the psC language examples. psC Language with the Virtual Board Software, documentation, samples and related materials are Copyright © 2003-2021, ICI Techno. support@icitechno.com All rights reserved. Unauthorized duplication, in whole or part, of this document by any means except for brief excerpts in published reviews is prohibited without the express written permission the author. Novakod is a registered trademark. All other trademarks referenced herein are the property of their respective owners and no trademark rights to the same are claimed. 2 psC Language with the Virtual Board Contents Description .............................................................................................................. 4 Memory ................................................................................................................... 4 Simulation with the virtual board ............................................................................. 5 Examples ................................................................................................................. 6 3 psC Language with the Virtual Board Description The virtual board is the generic target used for most simulation. It contains any number of inputs/outputs ports and includes two memory banks. The figure below illustrates the structure of the virtual board: Virtual Board Input Ports Output Ports psC Code Memory Bank A Memory Bank B Memory Each memory bank is 32MB, organized as 8M x 32 bits. The table lists the pins available to access the memory banks. Memory Bank A B DMA control 4 psC port names Command_A Address_A Data_out_A Data_in_A Init_over_A Almost_full_A Command_B Address_B Data_out_B Data_in_B Init_over_B Almost_full_B DMA_sel Direction Output Output Output Input Not used Not used Output Output Output Input Not used Not used Not used Type Mode uint:2 uint:23 uint uint Active Passive Passive Active uint:2 uint:23 uint uint Active Passive Passive Active psC Language with the Virtual Board Simulation with the virtual board The virtual board is fully integrated in the development environment (RIDE). Once the psC code is ready for simulation, a virtual board target can be created. Depending on the type of target, the virtual board can be used with the Novakod API or with event files. If the API is used, any C++ application, like the Control Panel, will be able to connect to the virtual board. All psC input and output ports will be accessible by the C++ application. In addition, the memory banks will be accessed using DMA. Novakod API Control Panel RVM Virtual Board C++ application The virtual board target can also be configured to use event files. In this case, all input ports will be driven by values/events from the .evi file and the generated output values/events will be stored in the .evo file. RVM File.evi Virtual Board File.evo Input files can be edited with an Excel like editor and both input and output files can be visualized in a signal editor, the well-known GTK Wave. 5 psC Language with the Virtual Board Examples Many examples are provided to illustrate psC application with the virtual board. Each example is documented, and the examples are in: C:\Novakod_Studio\Examples\ Here is a brief description of these examples: Description Example AW ✓ A ✓ Illustrates a basic program structure, the pipeline ES ✓ 04_Types Base types, user define types and literal constants E ✓ 05_Arrays Simple FIFO buffer using psC arrays ES ✓ 06_Template Delay component template ES ✓ 07_Memory Viewing memory signals ESL ✓ 08_SortDma Sort algorithm with control panel A ✓ 09_ImageProcessing Image processing and C++ application A 10_SpaceTime1 Compute average: small and fast version 11_SpaceTime2 Sort numbers: small and fast version 12_Clock Various clock generators ES 13_TestBench Testbench for a PWM generator core ES 14_Random Random generators: PRBS and xoshiro128+ ES 15_SerialUart UART transmitter and receiver ES 16_Processor Complete processor with debug command 17_FixMacro Temp variables macro for fix operations library 18_Filter IIR and FIR filters (32 bits fix) ESL 19_Float Two floating point applications AEL 20_Math Systolic arrays for matrix operation E 21_CodeGen Many examples to illustrate code generation E 22_SorterTmpl Step by step development of a sorter template E 01_HelloWorld A simple up/down counter 02_CppInterface C++ application controlling up/down counter 03_Pipeline Notes: A – API is used with control panel or C++ application W – Uses the watch window E – Event files are used S – Signal viewer is used L – Uses library C – Vhdl Core generator 6 Must Read EC E AES EL