X
RSS YouTube LinkedIn Twitter XCore IRC

Search




Post new topic Reply to topic   [ 3 posts ] 
Author Message
PostPosted: Tue Feb 02, 2010 4:01 pm 
Joined: Tue Jan 12, 2010 1:49 pm
Posts: 55
OK, so I have no software background at all. Just wanted to throw that out there before I ask what may be a silly question. I don't think I can post the exact example so I've modified it to suit my questions.

Firstly, can someone explain access to the data region using the data pointer? Is it fixed and all access to data is an offset from this pointer?

Secondly, in the following assembler, can you explain in layman's terms what is going on? It is performing a read-modify-write but I'm unsure of the exact syntax meaning. Assume my_port is a 32-bit port that I want to access individual bits of. I pass one argument to the function which is stored automatically in r0.

Code:
my_out_func:
ldw r11, dp[my_port]
out res[r11], r0
retsp 0


Thanks, Shareef.


Top
Offline Profile View all posts by this user  
 
PostPosted: Tue Feb 02, 2010 9:03 pm 
Joined: Tue Dec 15, 2009 12:46 am
Posts: 248
sjalloq wrote:
Firstly, can someone explain access to the data region using the data pointer? Is it fixed and all access to data is an offset from this pointer?

The mapper gathers all writable data into a single region in the final image. The boot code initialises the dp register of every thread to the start of this region. If you use a label with a dp relative instruction then at link time the offset to that label from the start of the data region is patched into the instruction.

Quote:
Secondly, in the following assembler, can you explain in layman's terms what is going on?

I've tried annotating the code:
Code:
 // Define symbol my_out_func to be the current pc
my_out_func:
// Load the word at the address of the my_port symbol into r11.
// dp relative addressing is used (explained above).
ldw r11, dp[my_port]
// Output the value in r0 to resource whose resource identifier is held in r11
out res[r11], r0
// Jump to the value of lr (i.e. return from the function)
retsp 0


If the port is in its default mode (no serialisation or ready signals) then this instruction sequence will drive the value in r0 to the port's pins on the next falling edge of port's clock.


Top
Offline Profile View all posts by this user  
 
PostPosted: Tue Feb 02, 2010 11:25 pm 
Joined: Tue Jan 12, 2010 1:49 pm
Posts: 55
Brilliant. Thanks for your help.


Top
Offline Profile View all posts by this user  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic   [ 3 posts ] 


Who is online

Users browsing this forum: No registered users and 2 guests



Search for:
Jump to: