This is the mail archive of the
sid@sources.redhat.com
mailing list for the SID project.
Re: [RFA]: hw-glue-bus-mux selection behavior
Frank Ch. Eigler wrote:
> Hi -
>
> brolley wrote:
> : [...]
> : > To me, this seems like an unnecessary feature; I'd let the client pick
> : > exactly 0 or 1.
> :
> : ok -- just trying to be too clever, I guess. How about 0 vs non-zero?
> : I think there should be some defined behavior for all values. [...]
>
> No doubt about that. Not that I want to get you to go all the way
> on this now, but ideally, setting the selector to any index that does
> not have an configured downstream accessor should be okay, merely cause
> sid::bus::unmapped for all future accesses. The 0/1 case falls out of
> that automatically, as does future expansion to 2..N downstream
> accessors.
OK -- new patch attached
Right now mux_passthrough_bus returns sid::bus::unpermitted if the
target bus is NULL. Shall I change that to sid::bus::unmapped?
Dave
Index: include/sidbusutil.h
===================================================================
RCS file: /cvs/cvsfiles/devo/sid/include/sidbusutil.h,v
retrieving revision 1.46
diff -c -p -r1.46 sidbusutil.h
*** sidbusutil.h 2001/03/01 19:18:07 1.46
--- sidbusutil.h 2001/03/28 17:44:13
*************** namespace sidutil
*** 266,274 ****
assert (t2 != 0);
t[0] = t1;
t[1] = t2;
}
~mux_passthrough_bus() {}
! void switch_bus() { index ^= 1; target = t[index]; }
// Some macros to make manufacturing of the cartesian-product
// calls simpler.
--- 266,292 ----
assert (t2 != 0);
t[0] = t1;
t[1] = t2;
+ t[2] = NULL;
}
~mux_passthrough_bus() {}
! void switch_bus()
! {
! // Switch to the next bus if the current one is valid (0 or 1)
! if ((index & ~1) == 0)
! {
! index ^= 1;
! target = t[index];
! }
! }
! void select_bus (int i)
! {
! // Set index to 2 (error) unless i is 0 or 1
! if ((i & ~1) == 0)
! index = i;
! else
! index = 2;
! target = t[index];
! }
// Some macros to make manufacturing of the cartesian-product
// calls simpler.
*************** namespace sidutil
*** 304,310 ****
private:
int index;
sid::bus** target;
! sid::bus** t[2];
};
// The passthrough_word_bus maps memory and either directly passes through to the underlying
--- 322,328 ----
private:
int index;
sid::bus** target;
! sid::bus** t[3];
};
// The passthrough_word_bus maps memory and either directly passes through to the underlying