Tutorial: Creating a Custom Bitfile: Difference between revisions

From Cpre584
Jump to navigation Jump to search
Tyler07 (talk | contribs)
 
(14 intermediate revisions by 2 users not shown)
Line 2: Line 2:


== Building a Bitfile ==
== Building a Bitfile ==
Copy rev 2011_11_22 of the [[Running the Vector Adder Example Application#Compiling the Project|example project]] and set your [[Convey environment setup|environment variables]] if you have not done so already.  You can make a small modification to the verilog code if you wish.
Copy the newest version of the [[Running the Vector Adder Example Application#Compiling the Project|example project]] and set your [[Convey environment setup|environment variables]] if you have not done so already.  You can make a small modification to the verilog code if you wish, such as making it a vector subtractor instead of a vector adder.
 
Next, compile your bitfile:


  cd ~/pdk_sample/cae_vadd/phys
  cd ~/pdk_sample/cae_vadd/phys
  make
  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.
The bitfile will take a long time to create (while the Reference Manual states 2 to 4 hours, it may take much longer).  Be patient.


== Packaging the Bitfile ==
Next, package your bitfile using the command:


cd ~/pdk_sample/cae_vadd/phys
  make release
  make release


This will create a new directory (~/pdk_sample/cae_vadd.release/).  The important file that is created is named cae_fpga.tgz.
After make release has finished there will be a directory on the same level as your top level project directory called:
 
myproject.released
 
Inside of that folder there will be a folder with the current date. Go to the most recent directory and there will be a file called cae_fpga.tgz, this file needs to be copied into the directory:
 
/myprojectname/personalities/<personality number>/
 
Example command:
 
cp cae_fpga.tgz ../../myprojectname/personalities/<personality number>/ae_fpga.tgz
 
Note that cae_fpga.tgz needs to be renamed to ae_fpga.tgz
 
Note that make and make release will NOT do this copy for you. If you forget you will still be using the old personality
 
 
=== FPGA Usage Statistics ===
 
The device usage statistics are displayed on the terminal while building the bitfile.  The log is saved to disk at:
 
{project directory}/phys/cae_fpga.map
OR
{project directory}/phys/cae_fpga.par
 
Search the end of the log file for "Design Summay" for a percentage break down in LUT, Flip flop, and BRAM usage.
 
== Choose a New Signature ==
Custom personalities should not use the default PDK signature (4.1.1.1.0).  Choose a new signature between 65000 and 65535.  In this example, we will use 65123.1.1.1.0.
 
You will need to create a new directory and copy the pertinent files to this directory:
 
cd /opt/convey/personalities
mkdir 65123.1.1.1.0
cd 65123.1.1.1.0
cp /home/PROJECT_RELEASE/DATE/cae_fpga.tgz ./ae_fpga.tgz


== Installing the Bitfile ==
This is the only required file, but you may copy PersDesc.dat from the default PDK folder to your new folder and uncomment additional custom instructions you have used.


THIS DOES NOT WORK - See appendix to follow the RPM packaging steps!
cp /opt/convey/personalities/4.1.1.1.0/PersDesc.dat ./


Follow the instructions from section 9.4.7 to install the packaged bitfile.
Instead of adding a new directory to Convey's personality folder as done above, you may set the CNY_PERSONALITY_PATH environment variable to any directory, i.e.
# Rename ~/pdk_sample/cae_vadd.released/#DATE#/cae_fpga.tgz to '''ae_fpga.tgz'''
# Determine what your bitfile's signature should be
# Copy the ae_fpga.tgz file to /opt/convey/personalities/#signature#


Any ideas? We need higher privilledges add files to the /opt/convey/personalities/ folder.
  export CNY_PERSONALITY_PATH=/home/PROJECT_PATH/
  or
setenv CNY_PERSONALITY_PATH /home/PROJECT_PATH/


Finally, flush the MP cache:
The default when the CNY_PERSONALITY_PATH is not set is to use the /opt/convey/personalities folder.
/opt/convey/sbin/mpcache –f


== Choosing a Signature ==
You will also need to update the ''customdb'' file in /opt/convey/personalities (or create your own customdb file in your user defined personalities folder).  This file is used by the cny_get_signature function and converts strings to a signature number.  Our customdb file contains the following text: 


The documentation (Section 10.1.2.1 of PDK Ref) also mentions doing the following:
65123.1.1.1.0,subtractor


cp  –r /opt/convey/personalities/4.1.1.1.0  ~/'''#number=>65000#'''.1.1.1.0
Finally, there are certain places in the code where you should ensure that the signature has been updated.


Edit readme and PersDesc.dat.
* In the simulator (/sim/CaeIsaVadd.cpp), update: '''#define PERS_SIGN_CAE 0xfe63001000101000LL''', where 0xfe63 is the hex value for your signature (65123).
* In the C code, (SampleAppVadd/UserApp.c) update: '''cny_get_signature("subtractor", &sig, &sig2, &stat);''', where "subtractor" is the pseudo name of your CAE given in the customdb file.
* In the assembly code, (SampleAppVadd/cpVadd.s) update the signature directive: '''.signature pdk=65123'''


When you change the personalities directory, flush the MP cache.  This will erase the cache, which is necessary if you've updated your custom bitfile:


Finally, you need to always set the CNY_PERSONALITY_PATH environment variable to
/opt/convey/sbin/mpcache -f
the directory just created, i.e.


    export CNY_PERSONALITY_PATH=/home/my_dir/
You can also add a signature, and preload a given bitfile by using the commands:
    or
    setenv CNY_PERSONALITY_PATH  /home/my_dir/


where /home/my_dir is your home directory or the directory '''#number=>65000#'''.1.1.1.0 was created
/opt/convey/sbin/mpcache -add  -S<personality number>
in.
/opt/convey/sbin/mpcache -load -S<personality number>


After implementing the AE software model, copy the AE software model executable into
Additional details are available in Appendix D of the [[Media:ConveyPDKReferenceManual.pdf | Convey PDK Reference Manual (.pdf)]].
the '''#number=>65000#'''.1.1.1.0/ directory with the file name caeemulator.  This allows the model to be
automatically executed when the personality is dispatched by an application. 
Alternatively, the CNY_CAE_EMULATOR can be used to define the full pathname of the
AE software model executable


== See Also ==
== See Also ==

Latest revision as of 02:12, 5 February 2013

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

Building a Bitfile

Copy the newest version 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, such as making it a vector subtractor instead of a vector adder.

Next, compile your bitfile:

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, it may take much longer). Be patient.

Next, package your bitfile using the command:

make release

After make release has finished there will be a directory on the same level as your top level project directory called:

myproject.released

Inside of that folder there will be a folder with the current date. Go to the most recent directory and there will be a file called cae_fpga.tgz, this file needs to be copied into the directory:

/myprojectname/personalities/<personality number>/

Example command:

cp cae_fpga.tgz ../../myprojectname/personalities/<personality number>/ae_fpga.tgz

Note that cae_fpga.tgz needs to be renamed to ae_fpga.tgz

Note that make and make release will NOT do this copy for you. If you forget you will still be using the old personality


FPGA Usage Statistics

The device usage statistics are displayed on the terminal while building the bitfile. The log is saved to disk at:

{project directory}/phys/cae_fpga.map
OR
{project directory}/phys/cae_fpga.par

Search the end of the log file for "Design Summay" for a percentage break down in LUT, Flip flop, and BRAM usage.

Choose a New Signature

Custom personalities should not use the default PDK signature (4.1.1.1.0). Choose a new signature between 65000 and 65535. In this example, we will use 65123.1.1.1.0.

You will need to create a new directory and copy the pertinent files to this directory:

cd /opt/convey/personalities
mkdir 65123.1.1.1.0
cd 65123.1.1.1.0

cp /home/PROJECT_RELEASE/DATE/cae_fpga.tgz ./ae_fpga.tgz

This is the only required file, but you may copy PersDesc.dat from the default PDK folder to your new folder and uncomment additional custom instructions you have used.

cp /opt/convey/personalities/4.1.1.1.0/PersDesc.dat ./

Instead of adding a new directory to Convey's personality folder as done above, you may set the CNY_PERSONALITY_PATH environment variable to any directory, i.e.

export CNY_PERSONALITY_PATH=/home/PROJECT_PATH/
  or
setenv CNY_PERSONALITY_PATH /home/PROJECT_PATH/

The default when the CNY_PERSONALITY_PATH is not set is to use the /opt/convey/personalities folder.

You will also need to update the customdb file in /opt/convey/personalities (or create your own customdb file in your user defined personalities folder). This file is used by the cny_get_signature function and converts strings to a signature number. Our customdb file contains the following text:

65123.1.1.1.0,subtractor

Finally, there are certain places in the code where you should ensure that the signature has been updated.

  • In the simulator (/sim/CaeIsaVadd.cpp), update: #define PERS_SIGN_CAE 0xfe63001000101000LL, where 0xfe63 is the hex value for your signature (65123).
  • In the C code, (SampleAppVadd/UserApp.c) update: cny_get_signature("subtractor", &sig, &sig2, &stat);, where "subtractor" is the pseudo name of your CAE given in the customdb file.
  • In the assembly code, (SampleAppVadd/cpVadd.s) update the signature directive: .signature pdk=65123

When you change the personalities directory, flush the MP cache. This will erase the cache, which is necessary if you've updated your custom bitfile:

/opt/convey/sbin/mpcache -f

You can also add a signature, and preload a given bitfile by using the commands:

/opt/convey/sbin/mpcache -add  -S<personality number>
/opt/convey/sbin/mpcache -load -S<personality number>

Additional details are available in Appendix D of the Convey PDK Reference Manual (.pdf).

See Also

References