This is the mail archive of the sid@sources.redhat.com mailing list for the SID project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[RFA]: hw-glue-bus-mux selection behavior


Hi,

It seems more natural to me, and turns out to be more conveniant in many 
cases to have the "switch" pin of the hw-glue-bus-mux component act as a 
selector rather than as a command to switch buses. That is, when the pin 
is driven 0, then "downstream1" is selected and when the pin is driven 
1, then "downstream2" is selected. This is because the input to a 
bus-mux is frequently the value of a bit in a control register of the 
component driving the pin. It also scales well to a possible future 
bux-mux which may have more than one output accessor.

Jeff Johnston, the original author of the component has agreed with me 
in principal and so, I present this patch for approval. Anyone currently 
using this component would have to make changes to their code.

Notes:
1)  I actually implemented the selector to choose "downstream1" when the 
pin value is even and "downstream2" otherwise. This works well for 0 and 
1 values and provides a way for a component to toggle between the 
busses, as before, by simply incrementing the pin value. Once again, 
this scales to a multi-bus-mux where one could rotate between the busses 
by incrementing the pin value.

2) I left the mux_passthrough_bus::switch_bus function in since it still 
seems like useful functionality for other subclasses.

OK to commit?

Dave
2001-03-27  Dave Brolley  <brolley@redhat.com>

	* sidbusutil.h (mux_passthrough_bus::select_bus): New function.

2001-03-27  Dave Brolley  <brolley@redhat.com>

	* hw-glue-bus-mux.txt: Update description of switching behavior.
	* glue.cxx (bus_mux::handle_switch_pin): Call upstream.select_bus.

Index: component/glue/glue.cxx
===================================================================
RCS file: /cvs/cvsfiles/devo/sid/component/glue/glue.cxx,v
retrieving revision 1.32
diff -c -p -r1.32 glue.cxx
*** component/glue/glue.cxx	2001/01/12 21:01:31	1.32
--- component/glue/glue.cxx	2001/03/27 23:20:56
*************** public:
*** 540,549 ****
  
    void handle_switch_pin (host_int_4 value)
      {
!       if (value != 0)
!         {
!           upstream.switch_bus();
!         }
      }
  };
  
--- 540,546 ----
  
    void handle_switch_pin (host_int_4 value)
      {
!       upstream.select_bus (value);
      }
  };
  
Index: component/glue/hw-glue-bus-mux.txt
===================================================================
RCS file: /cvs/cvsfiles/devo/sid/component/glue/hw-glue-bus-mux.txt,v
retrieving revision 1.2
diff -c -p -r1.2 hw-glue-bus-mux.txt
*** component/glue/hw-glue-bus-mux.txt	2001/01/12 21:01:31	1.2
--- component/glue/hw-glue-bus-mux.txt	2001/03/27 23:20:56
***************
*** 24,33 ****
        to "downstream1".
  
      * Switching
!       When the "switch" pin is driven high, the output accessor will
!       be switched from the current output accessor to the one not in use.
        The "switch" pin can be driven any number of times, each time
!       causing the output to be switched.
  
      * Bus traffic
        Input to the "upstream" bus is passed on to the current
--- 24,37 ----
        to "downstream1".
  
      * Switching
!       When the "switch" pin is driven with an even value, the output accessor
!       will be "downstream1". When the "switch" pin is driven with an odd
!       value, the output accessor will be "downstream2".
        The "switch" pin can be driven any number of times, each time
!       causing the corresponding output to be selected.
!       One can select the desired output directly by driving the "switch" pin
!       with a specific value, or toggle between the outputs by simply
!       incrementing the value driven.
  
      * Bus traffic
        Input to the "upstream" bus is passed on to the current
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
*** include/sidbusutil.h	2001/03/01 19:18:07	1.46
--- include/sidbusutil.h	2001/03/27 23:20:57
*************** namespace sidutil
*** 269,274 ****
--- 269,275 ----
        }
      ~mux_passthrough_bus() {}
      void switch_bus() { index ^= 1; target = t[index]; }
+     void select_bus (int i) { index = i & 1; target = t[index]; }
      
      // Some macros to make manufacturing of the cartesian-product
      // calls simpler.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]