Cog Memory Object (UPDATED!!)
tpw_man
Posts: 276
This adds some somewhat slow memory to a propeller application. It uses a cog and the spare memory within the cog to add ~1560 bytes. It can be used for an application where not much main memory is left, but a cog or two can be spared. It can support up to 8 cogs and weighs in at about 170 longs. The demo only takes up 2/3 of the memory capacity it adds Attached is the object along with a simple demo that lights up an LED when memory values read and written are the same. If anybody spots any ways to make it smaller or any potential bugs it would be appreciated. A version that supports block reads/writes will come soon. I hope it will be of use!
EDIT: Updated to support block reads/writes.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1011, so be surprised!
Advertisement sponsored by dfletch:
Come and join us on the Propeller IRC channel for fast and easy help!
Channel: #propeller
Server: irc.freenode.net or freenode.net
If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
Post Edited (tpw_man) : 8/2/2008 12:51:22 AM GMT
EDIT: Updated to support block reads/writes.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1011, so be surprised!
Advertisement sponsored by dfletch:
Come and join us on the Propeller IRC channel for fast and easy help!
Channel: #propeller
Server: irc.freenode.net or freenode.net
If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
Post Edited (tpw_man) : 8/2/2008 12:51:22 AM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Searider
EDIT: I think they decided to go with 16 cogs and 256K of ram to get the best of both props.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1011, so be surprised!
Advertisement sponsored by dfletch:
Come and join us on the Propeller IRC channel for fast and easy help!
Channel: #propeller
Server: irc.freenode.net or freenode.net
If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with the Protoboard? - Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card? - PropDOS
Need a part? Got spare electronics? - The Electronics Exchange
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1011, so be surprised!
Advertisement sponsored by dfletch:
Come and join us on the Propeller IRC channel for fast and easy help!
Channel: #propeller
Server: irc.freenode.net or freenode.net
If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
I had a reason when I started, but I entirely forget now. I will try and fix it to not need that.
EDIT: Fixed it to not need the random numbers and cog id. Thanks for the suggestion, it shaved off 20 longs [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1011, so be surprised!
Advertisement sponsored by dfletch:
Come and join us on the Propeller IRC channel for fast and easy help!
Channel: #propeller
Server: irc.freenode.net or freenode.net
If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
Post Edited (tpw_man) : 8/1/2008 11:48:39 PM GMT
It ands it with 2 to get the 'sub address' which is the portion of the long to read/write from. It then shifts left 3 to multiply by 8 to get the byte shifting number. It then uses the byte shifting number to position the appropriate byte at bits 0-7 in at the long. It should be that way to work right.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1011, so be surprised!
Advertisement sponsored by dfletch:
Come and join us on the Propeller IRC channel for fast and easy help!
Channel: #propeller
Server: irc.freenode.net or freenode.net
If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
dont you want to read the long at address 0 and shift it by 8 to get the 2nd byte?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1011, so be surprised!
Advertisement sponsored by dfletch:
Come and join us on the Propeller IRC channel for fast and easy help!
Channel: #propeller
Server: irc.freenode.net or freenode.net
If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
Junking the single read/writes would save some memory. Having a buffered
transaction of one long for single accesses is better than adding extra stuff.
The current spin read and write API signatures could remain the same.
Is it possible to make the spin functions do the shifting?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔