How do I access parameters coherently?


Add the following declarations to your program:

#define _coherentread(a_source,a_dest,b_source,b_dest) \
   {register_diob diob; register_p p; diob = a_source; \
    p = b_source;  b_dest = p; a_dest = diob;};

#define _coherentwrite(a_dest,a_source,b_dest,b_source)\
   {register_diob diob; register_p p; diob = a_source; \
    p = b_source; a_dest = diob; b_dest = p; };

register_diob diob;
register_p    p;

#define CoherentWrite(a,av,b,bv) diob = av; p = bv; NOP(); a = diob; b = p;

where a_dest and b_dest are the variables, and a_source and b_source are values to assign to a_dest and b_dest.

There are a few restrictions for using this macro:

  • Only the b arguments can have 32 bit variables (because they use the p register). The a arguments in these macros must be 24 bits. The b arguments may be 24 or 32 bits.

  • Expressions for b arguments cannot use anything that requires the diob register (arrays, pointers in general). There are no restrictions on the a expressions.