Adding and Using External Cores
When coding a module or system, there may come a time where you will want to use an external hardware core that was not coded in ROCCC. For example, let’s say we were working on a distanceBetween module that needs to use a square-root operation.
Let’s also say we already have a square-root hardware core called “sqrt” from an external source that we would like to use in our ROCCC code. This can be done as long as you tell ROCCC about the sqrt IP Core before using it. To do this, select “Add -> IP Core” from the ROCCC menu. A window will open asking for the details of the IP Core. Input the name and latency of this core. If you give ROCCC the incorrect latency for the core, ROCCC will generate improper code whenever you use this core so make sure that value is correct.
After you have given the name and latency, you will also need to specify the ports including their bit sizes and datatypes. Fill out the details for one of the ports and press the “Add” button on the right to add that port to the list.
Continue doing this until you have added all the ports that this core contains. For this example, there should only be two ports, a 32-bit input port and a 32-bit output port. Once all the ports have been specified, select “Finish” at the bottom for the core to be added to the database.
Calling IP Cores in the Database
Now that we added our sqrt core to our database, we can now use it. So in our distanceBetween example, we should place our cursor in the function since that is where we want to insert the call. Go to the IP Cores view and find the sqrt core. To add a call to this module in our code, double click the name of the sqrt core. This will automatically insert a function call to that core in our code. It will outline what values need to be passed in at which locations via comments in the argument list. It will also insert the line “#include roccc-library.h” at the top of your code so you can call that function.
So now that we have our function call in place, we can start passing the necessary values into the function call. We will place squaredDistance as the input, and have distance as the output.
Once we have done that, it should be ready to go. Compile the module and vhdl code will be generated for our distanceBetween component. ROCCC will instantiate the inserted sqrt call in the VHDL and hook up all the signals correctly for you.
|<< Using Compiled Modules||Tutorials Home||High-Level Optimizations >>|