- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi. I spent the last 10 hours trying to assert Custom Instruction Internal Registers Files (readra, readrb and writerc). I gave up. I can't believe Altera hasn't develop any Macros to do it!! I have found some tips of how to do it in Assembly, but I couldn't understand well. Please let me know if there is a way to do it in C.
Thanks, GustavoLink Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try a variant on the following:
/* There are 'int __builtin_custom_inii(int op, int a, int b)'
* (and similar) wrappers for custom instructions defined by gcc itself.
* But none for the 'c' variants that do not use the main register file.
* The one below is useful when the 'b' field is used as a sub-opcode.*/
__attribute__((always_inline))
static __inline__ uint32_t
custom_inic(const uint32_t op, uint32_t a, const uint32_t b)
{
uint32_t result;
__asm__ ( "custom\t%1, %0, %2, c%3"
: "=r" (result) : "n" (op), "r" (a), "n" (b));
return result;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh, and the disassembler is wrong - it needs patching in order to correctly decode custom instructions (patches on wiki).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works when I use the following command and when I have only one custom instruction in my VHDL code.
asm volatile ("custom 0, c0, %1, %2" : "=r" (y) : "r" (x), "r" (h)); But, when I want to select one custom instruction (n=0) out of two, my Hardware in VHDL doesn't read 0 in "n".- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you correctly connected your custom instruction module to both numbers?
It may be worth looking at the RTL viewer and using signaltap.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page