- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I read the Nios2 custom instruction reference book online, and found that the only way I could read or write data from custom registers is to change the assembly code (change rA or rB to cA and cB).
However, if I were to load the C program directly to the Nios board, the IDE will never know that I use custom registers. (because when it compiles, IDE automatically assign all the variables to Nios registers) so my question is how do I let the IDE compiler know that some of my custom instructions use custom registers instead of Nios registers? any suggestions will be very appreciated http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gifLink Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure exactly what you mean here.
What assembly code do you want to generate? And what's being generated? The best way to get custom instructions emitted is to use a function from the __builtin_custom family, or the wrapper which is built around it within system.h. If this isn't flexible enough then you can also use asm() statements within C code but you must make sure you get your constraints right as otherwise the generated code will be very inefficient or wrong.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
okei let me rephrase my question in a simpler way:
after I use the __builtin_custom functions, how do I let the compiler know that I am using custom registers instead of NIOS2 registers? __builtin_custom only tells the compiler that I am using custom instructions, but it does not give informations to custom REGISTERS~- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The compiler won't be able to use your custom registers. You'll have to manage them yourself explicitly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks James & wombat~
I guess I'll use asm() to do it...
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