Tutorial: Creating a Custom Bitfile: Difference between revisions

From Cpre584
Jump to navigation Jump to search
No edit summary
Line 38: Line 38:
=== Allocated Memory on the Coprocessor Board ===
=== Allocated Memory on the Coprocessor Board ===
System memory and memory used for the coprocessor are physically separate.  In the example C file, function calls such as '''cny_cp_malloc''' and '''ny_cp_posix_memalign'''.
System memory and memory used for the coprocessor are physically separate.  In the example C file, function calls such as '''cny_cp_malloc''' and '''ny_cp_posix_memalign'''.
See: [[Media:ConveyProgrammersGuide.pdf | Convey Programmers Guide (.pdf)]] - Chapter 9


=== Making a Coprocessor Call ===
=== Making a Coprocessor Call ===
Line 47: Line 49:
== References ==
== References ==
* [[Media:ConveyPDKReferenceManual.pdf | Convey PDK Reference Manual (.pdf)]] - Sections 9.4.6, 9.4.7, 10 and Appendix D
* [[Media:ConveyPDKReferenceManual.pdf | Convey PDK Reference Manual (.pdf)]] - Sections 9.4.6, 9.4.7, 10 and Appendix D
* [http://wikis.ece.iastate.edu/cpre584/images/archive/6/64/20120214181134%21ConveyPDKReferenceManual.pdf Convey PDK Reference Manual V3] - Sections 8.5-8.7, 9, and Appendix D
* [[Media:ConveyProgrammersGuide.pdf | Convey Programmers Guide (.pdf)]] - Chapter 9 and Appendix G

Revision as of 20:15, 14 February 2012

This page covers the creation and installation of a custom personality/bitfile (a modification of the vector adder sample project).

Building a Bitfile

Copy rev 2011_11_22 of the example project and set your environment variables if you have not done so already. You can make a small modification to the verilog code if you wish.

cd ~/pdk_sample/cae_vadd/phys
make

The bitfile will take a long time (2 to 4 hours; sometimes perhaps 10 hours) to create. Be patient.

Packaging the Bitfile

cd ~/pdk_sample/cae_vadd/phys
make release

This will create a new directory (~/pdk_sample/cae_vadd.release/). Then something magical happens that I don't quite understand yet.

Installing the Bitfile

Any ideas? Intuition tells me we'd need higher privilledges to install the RPM to the /opt/convey/personalities/ folder.

Using the Bitfile in C Code

My current understanding is that running a routine on the coprocessor requires two parts:

  • A call to the cny_get_signature function to get the signature of the custom personality you created
  • A cny coprocessor funcation call (ex: l_copcall_fmt, d_copcall_fmt, etc)

If you want to pass parameters to your function call, the vector adder set the standard of using an assembly file to marshal registers back and forth between the processor / coprocessor, though there may be other ways.

Getting the Signature

 cny_image_t        sig2;
 cny_image_t        sig;
 int stat;
 if (cny_get_signature)
   cny_get_signature("your custom personality name", &sig, &sig2, &stat);
 else 
   fprintf(stderr,"ERROR:  cny_get_signature not found\n");

Allocated Memory on the Coprocessor Board

System memory and memory used for the coprocessor are physically separate. In the example C file, function calls such as cny_cp_malloc and ny_cp_posix_memalign.

See: Convey Programmers Guide (.pdf) - Chapter 9

Making a Coprocessor Call

The vector adder example uses:

act_sum = l_copcall_fmt(sig, cpVadd, "AAAA", a1, a2, a3, size);

See: Convey Programmers Guide (.pdf) - Appendix G

References