Tutorial: Creating a Custom Bitfile: Difference between revisions

From Cpre584
Jump to navigation Jump to search
Line 14: Line 14:
  make release
  make release


This will create a new directory (~/pdk_sample/cae_vadd.release/).
This will create a new directory (~/pdk_sample/cae_vadd.release/) that contains your bitfile(s) in an RPM directory, as well as a tarball of the RPM directory.


== Installing the Bitfile ==
== Installing the Bitfile ==

Revision as of 20:42, 15 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 to create (while the Reference Manual states 2 to 4 hours; mine took 18 hours to finish). Be patient.

Packaging the Bitfile

cd ~/pdk_sample/cae_vadd/phys
make release

This will create a new directory (~/pdk_sample/cae_vadd.release/) that contains your bitfile(s) in an RPM directory, as well as a tarball of the RPM directory.

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);

In this case, the l at the beginning of l_copcall_fmt means the return type is a long (64 bits). The first two arguments are always (1) the bitfile signature and (2) a assembly function name. The third argument lists the type and number of optional arguments that are passed (starting at register A8). For example, "AAAA" means there are 4 long variables passed to the coprocessor call.

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

References