public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
* New bus_mux component
@ 2001-01-05 13:38 J. Johnston
  2001-01-05 13:41 ` Ben Elliston
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: J. Johnston @ 2001-01-05 13:38 UTC (permalink / raw)
  To: sid

The following patch is for a new glue component: bus_mux which is a bus multiplexer.
It supports one bus input and attaches the bus to one of two accessors.  The
output accessor can be switched via a switch pin.  I have included the patch
plus a new documentation file.  Ok to check in?

-- Jeff J.
? sid/component/glue/hw-glue-bus-mux.txt
Index: sid/include/ChangeLog
===================================================================
RCS file: /cvs/src/src/sid/include/ChangeLog,v
retrieving revision 1.1
diff -u -r1.1 ChangeLog
--- ChangeLog	2000/12/07 19:31:09	1.1
+++ ChangeLog	2001/01/05 21:34:18
@@ -1,3 +1,8 @@
+2001-01-05  Jeff Johnston  <jjohnstn@redhat.com>
+
+	* sidbusutil.h (mux_passthrough_bus): New bus allowing one
+	input bus tied to one of two accessors with dynamic switching.
+
 2000-11-27  Frank Ch. Eigler  <fche@redhat.com>
 
 	* sidattrutil.h (attribute_coder_alias): New coder for attribute
Index: sid/include/sidbusutil.h
===================================================================
RCS file: /cvs/src/src/sid/include/sidbusutil.h,v
retrieving revision 1.1
diff -u -r1.1 sidbusutil.h
--- sidbusutil.h	2000/12/07 19:31:09	1.1
+++ sidbusutil.h	2001/01/05 21:34:18
@@ -255,6 +255,58 @@
     sid::bus** target;
   };
   
+  // This sort of bus passes accesses through to one of two buses which
+  // are specified by meta-pointers.  Access can be switched dynamically.
+  class mux_passthrough_bus: public sid::bus
+  {
+  public:
+    mux_passthrough_bus(sid::bus** t1, sid::bus** t2): index(0), target(t1) 
+      {
+	assert (t1 != 0);
+        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.
+#define SID_GB_WRITE(dtype) \
+      sid::bus::status write(sid::host_int_4 addr, dtype data) throw ()\
+	  { if (*target) return (*target)->write(addr, data); else return sid::bus::unpermitted; }
+
+#define SID_GB_READ(dtype) \
+      sid::bus::status read(sid::host_int_4 addr, dtype& data) throw ()\
+	  { if (*target) return (*target)->read(addr, data); else return sid::bus::unpermitted; }
+
+    SID_GB_WRITE(sid::little_int_1)
+    SID_GB_WRITE(sid::big_int_1)
+    SID_GB_WRITE(sid::little_int_2)
+    SID_GB_WRITE(sid::big_int_2)
+    SID_GB_WRITE(sid::little_int_4)
+    SID_GB_WRITE(sid::big_int_4)
+    SID_GB_WRITE(sid::little_int_8)
+    SID_GB_WRITE(sid::big_int_8)
+
+    SID_GB_READ(sid::little_int_1)
+    SID_GB_READ(sid::big_int_1)
+    SID_GB_READ(sid::little_int_2)
+    SID_GB_READ(sid::big_int_2)
+    SID_GB_READ(sid::little_int_4)
+    SID_GB_READ(sid::big_int_4)
+    SID_GB_READ(sid::little_int_8)
+    SID_GB_READ(sid::big_int_8)
+
+#undef SID_GB_WRITE
+#undef SID_GB_READ
+
+  private:
+    int index;
+    sid::bus** target;
+    sid::bus** t[2];
+  };
+
   // The passthrough_word_bus maps memory and either directly passes through to the underlying
   // bus or else converts the incoming bus access call to a particular
   // preferred size & type.  The bus object is addressable as if it
Index: sid/component/glue/ChangeLog
===================================================================
RCS file: /cvs/src/src/sid/component/glue/ChangeLog,v
retrieving revision 1.1
diff -u -r1.1 ChangeLog
--- ChangeLog	2000/12/07 19:30:51	1.1
+++ ChangeLog	2001/01/05 21:34:18
@@ -1,3 +1,12 @@
+2001-01-05  Jeff Johnston  <jjohnstn@redhat.com>
+
+	* glue.cxx (bus_mux): New bus multiplex component accepting
+	one input bus and having two output accessors.
+	(list_types): List it under type "hw-glue-bus-mux".
+	(create): Ditto.
+	(do_delete): Ditto.
+	* hw-glue-bus-mux.txt: New documentation for bus_mux.
+
 2000-11-21  Frank Ch. Eigler  <fche@redhat.com>
 
 	* Makefile.in: Regenerated.
Index: sid/component/glue/Makefile.am
===================================================================
RCS file: /cvs/src/src/sid/component/glue/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- Makefile.am	2000/12/07 19:30:51	1.1
+++ Makefile.am	2001/01/05 21:34:18
@@ -12,7 +12,7 @@
 seqinval.exp sequence.exp sequence1.exp sequence2.exp sequence8.exp \
 seqvalid.exp gluemonkey.exp traffic.exp
 
-pkgdata_DATA = hw-glue-sequence.txt hw-glue-probe-bus.txt sw-glue-attribbank.txt
+pkgdata_DATA = hw-glue-sequence.txt hw-glue-probe-bus.txt sw-glue-attribbank.txt hw-glue-bus-mux.txt
 
 checkme:
 	(cd ../testsuite ; $(MAKE) check RUNTESTFLAGS="$(RUNTESTFLAGS) $(DEJAGNUTESTS)" )
Index: sid/component/glue/Makefile.in
===================================================================
RCS file: /cvs/src/src/sid/component/glue/Makefile.in,v
retrieving revision 1.1
diff -u -r1.1 Makefile.in
--- Makefile.in	2000/12/07 19:30:51	1.1
+++ Makefile.in	2001/01/05 21:34:19
@@ -99,7 +99,7 @@
 seqvalid.exp gluemonkey.exp traffic.exp
 
 
-pkgdata_DATA = hw-glue-sequence.txt hw-glue-probe-bus.txt sw-glue-attribbank.txt
+pkgdata_DATA = hw-glue-sequence.txt hw-glue-probe-bus.txt sw-glue-attribbank.txt hw-glue-bus-mux.txt
 mkinstalldirs = $(SHELL) $(top_srcdir)/../config/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
@@ -126,6 +126,7 @@
 
 TAR = gtar
 GZIP_ENV = --best
+DEP_FILES =  .deps/glue.P
 SOURCES = $(libglue_la_SOURCES)
 OBJECTS = $(libglue_la_OBJECTS)
 
@@ -133,9 +134,9 @@
 .SUFFIXES:
 .SUFFIXES: .S .c .cxx .lo .o .s
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
-	cd $(top_srcdir) && $(AUTOMAKE) --cygnus glue/Makefile
+	cd $(top_srcdir) && $(AUTOMAKE) --foreign glue/Makefile
 
-Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
 	cd $(top_builddir) \
 	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
@@ -165,9 +166,6 @@
 	  $(LIBTOOL)  --mode=uninstall rm -f $(DESTDIR)$(pkglibdir)/$$p; \
 	done
 
-.c.o:
-	$(COMPILE) -c $<
-
 .s.o:
 	$(COMPILE) -c $<
 
@@ -184,9 +182,6 @@
 
 maintainer-clean-compile:
 
-.c.lo:
-	$(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
 .s.lo:
 	$(LIBTOOL) --mode=compile $(COMPILE) -c $<
 
@@ -263,8 +258,13 @@
 subdir = glue
 
 distdir: $(DISTFILES)
+	here=`cd $(top_builddir) && pwd`; \
+	top_distdir=`cd $(top_distdir) && pwd`; \
+	distdir=`cd $(distdir) && pwd`; \
+	cd $(top_srcdir) \
+	  && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign glue/Makefile
 	@for file in $(DISTFILES); do \
-	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
+	  d=$(srcdir); \
 	  if test -d $$d/$$file; then \
 	    cp -pr $$d/$$file $(distdir)/$$file; \
 	  else \
@@ -273,16 +273,65 @@
 	    || cp -p $$d/$$file $(distdir)/$$file || :; \
 	  fi; \
 	done
+
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+
+-include $(DEP_FILES)
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+	-rm -rf .deps
+
+maintainer-clean-depend:
+
+%.o: %.c
+	@echo '$(COMPILE) -c $<'; \
+	$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-cp .deps/$(*F).pp .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm .deps/$(*F).pp
+
+%.lo: %.c
+	@echo '$(LTCOMPILE) -c $<'; \
+	$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-sed -e 's/^\([^:]*\)\.o[ 	]*:/\1.lo \1.o :/' \
+	  < .deps/$(*F).pp > .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm -f .deps/$(*F).pp
+
+%.o: %.cxx
+	@echo '$(CXXCOMPILE) -c $<'; \
+	$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-cp .deps/$(*F).pp .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm .deps/$(*F).pp
+
+%.lo: %.cxx
+	@echo '$(LTCXXCOMPILE) -c $<'; \
+	$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-sed -e 's/^\([^:]*\)\.o[ 	]*:/\1.lo \1.o :/' \
+	  < .deps/$(*F).pp > .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm -f .deps/$(*F).pp
 info-am:
 info: info-am
 dvi-am:
 dvi: dvi-am
-check-am:
+check-am: all-am
 check: check-am
 installcheck-am:
 installcheck: installcheck-am
-install-info-am: 
-install-info: install-info-am
 install-exec-am: install-pkglibLTLIBRARIES
 install-exec: install-exec-am
 
@@ -312,27 +361,27 @@
 
 maintainer-clean-generic:
 mostlyclean-am:  mostlyclean-pkglibLTLIBRARIES mostlyclean-compile \
-		mostlyclean-libtool mostlyclean-tags \
+		mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
 		mostlyclean-generic
 
 mostlyclean: mostlyclean-am
 
 clean-am:  clean-pkglibLTLIBRARIES clean-compile clean-libtool \
-		clean-tags clean-generic mostlyclean-am
+		clean-tags clean-depend clean-generic mostlyclean-am
 
 clean: clean-am
 
 distclean-am:  distclean-pkglibLTLIBRARIES distclean-compile \
-		distclean-libtool distclean-tags distclean-generic \
-		clean-am
+		distclean-libtool distclean-tags distclean-depend \
+		distclean-generic clean-am
 	-rm -f libtool
 
 distclean: distclean-am
 
 maintainer-clean-am:  maintainer-clean-pkglibLTLIBRARIES \
 		maintainer-clean-compile maintainer-clean-libtool \
-		maintainer-clean-tags maintainer-clean-generic \
-		distclean-am
+		maintainer-clean-tags maintainer-clean-depend \
+		maintainer-clean-generic distclean-am
 	@echo "This command is intended for maintainers to use;"
 	@echo "it deletes files that may require special tools to rebuild."
 
@@ -345,12 +394,13 @@
 maintainer-clean-compile mostlyclean-libtool distclean-libtool \
 clean-libtool maintainer-clean-libtool uninstall-pkgdataDATA \
 install-pkgdataDATA tags mostlyclean-tags distclean-tags clean-tags \
-maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \
-installcheck-am installcheck install-info-am install-info \
-install-exec-am install-exec install-data-am install-data install-am \
-install uninstall-am uninstall all-redirect all-am all installdirs \
-mostlyclean-generic distclean-generic clean-generic \
-maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+maintainer-clean-tags distdir mostlyclean-depend distclean-depend \
+clean-depend maintainer-clean-depend info-am info dvi-am dvi check \
+check-am installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
 
 
 checkme:
Index: sid/component/glue/glue.cxx
===================================================================
RCS file: /cvs/src/src/sid/component/glue/glue.cxx,v
retrieving revision 1.1
diff -u -r1.1 glue.cxx
--- glue.cxx	2000/12/07 19:30:51	1.1
+++ glue.cxx	2001/01/05 21:34:19
@@ -67,6 +67,7 @@
   using sidutil::recursion_limited;
   using sidutil::recursion_record;
   using sidutil::self_watcher;
+  using sidutil::mux_passthrough_bus;
 
   using std::map;
   using std::deque;
@@ -509,7 +510,43 @@
   return s;
 }
 
+class bus_mux: public virtual component,
+               protected fixed_pin_map_component,
+               protected fixed_accessor_map_component,
+               protected fixed_attribute_map_component,
+               protected no_relation_component,
+               protected fixed_bus_map_component
 
+{
+  mux_passthrough_bus upstream;
+  bus* downstream1;
+  bus* downstream2;
+
+  callback_pin<bus_mux> switch_pin;
+
+public:
+  bus_mux ():
+    switch_pin (this, &bus_mux::handle_switch_pin),
+    upstream (&this->downstream1, &this->downstream2),
+    downstream1 (0), downstream2 (0)
+    {
+      add_bus ("upstream", &this->upstream);
+      add_accessor ("downstream1", &this->downstream1); 
+      add_accessor ("downstream2", &this->downstream2);
+      add_pin ("switch", &switch_pin);
+      add_attribute ("switch", &switch_pin, "pin");
+    }
+  ~bus_mux () {}
+
+  void handle_switch_pin (host_int_4 value)
+    {
+      if (value != 0)
+        {
+          upstream.switch_bus();
+        }
+    }
+};
+
 // ----------------------------------------------------------------------------
 
   static
@@ -523,6 +560,7 @@
   types.push_back("hw-glue-sequence-8");
   types.push_back("sw-glue-attribbank");
   types.push_back("hw-glue-probe-bus");
+  types.push_back("hw-glue-bus-mux");
   return types;
 }
   
@@ -543,6 +581,8 @@
     return new attr_storage_component ();
   if (typeName == "hw-glue-probe-bus")
     return new bus_prober ();
+  if (typeName == "hw-glue-bus-mux")
+    return new bus_mux ();
   else
     return 0;
 }
@@ -552,13 +592,15 @@
   void
   do_delete(component* c)
 {
-  // Two of these dynamic_cast<>s will return 0.  It is safe to delete 0.
+  // Three of these dynamic_cast<>s will return 0.  It is safe to delete 0.
   sequence_component* g1 = dynamic_cast<sequence_component*>(c);
   if (g1) { delete g1; return; }
   attr_storage_component* g2 = dynamic_cast<attr_storage_component*>(c);
   if (g2) { delete g2; return; }
   bus_prober* g3 = dynamic_cast<bus_prober*>(c);
   if (g3) { delete g3; return; }
+  bus_mux* g4 = dynamic_cast<bus_mux*>(c);
+  if (g4) { delete g4; return; }
 }
 
   

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: New bus_mux component
  2001-01-05 13:38 New bus_mux component J. Johnston
@ 2001-01-05 13:41 ` Ben Elliston
  2001-01-05 14:10 ` Ben Elliston
  2001-01-05 15:10 ` Frank Ch. Eigler
  2 siblings, 0 replies; 5+ messages in thread
From: Ben Elliston @ 2001-01-05 13:41 UTC (permalink / raw)
  To: J. Johnston; +Cc: sid

Jeff,

   The following patch is for a new glue component: bus_mux which is a
   bus multiplexer. It supports one bus input and attaches the bus to one
   of two accessors.  The output accessor can be switched via a switch
   pin.  I have included the patch plus a new documentation file.  Ok to
   check in?

How about test cases?

Ben

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: New bus_mux component
  2001-01-05 13:38 New bus_mux component J. Johnston
  2001-01-05 13:41 ` Ben Elliston
@ 2001-01-05 14:10 ` Ben Elliston
  2001-01-05 15:01   ` Frank Ch. Eigler
  2001-01-05 15:10 ` Frank Ch. Eigler
  2 siblings, 1 reply; 5+ messages in thread
From: Ben Elliston @ 2001-01-05 14:10 UTC (permalink / raw)
  To: J. Johnston; +Cc: sid

   The following patch is for a new glue component: bus_mux which is a
   bus multiplexer. It supports one bus input and attaches the bus to one
   of two accessors.  The output accessor can be switched via a switch
   pin.  I have included the patch plus a new documentation file.  Ok to
   check in?

Also, you should consider including your new component in gluemonkey.exp and
running it under the monkey tester for a few days.

Ben

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: New bus_mux component
  2001-01-05 14:10 ` Ben Elliston
@ 2001-01-05 15:01   ` Frank Ch. Eigler
  0 siblings, 0 replies; 5+ messages in thread
From: Frank Ch. Eigler @ 2001-01-05 15:01 UTC (permalink / raw)
  To: Ben Elliston; +Cc: sid

Hi -

On Sat, Jan 06, 2001 at 09:10:16AM +1100, Ben Elliston wrote:
:    The following patch is for a new glue component: bus_mux [...]
: 
: Also, you should consider including your new component in gluemonkey.exp and
: running it under the monkey tester for a few days.

A few days would be an overkill for a component whose functional body
consists of a couple of lines of code. :-)

- FChE
-- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6VlJRVZbdDOm/ZT0RAvCsAJ0VCy/jGcMIvMZRbhpCEQcHGFpyOACcC5rw
qwUx8TOYF1X7OxjaUxoTjds=
=/pLg
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: New bus_mux component
  2001-01-05 13:38 New bus_mux component J. Johnston
  2001-01-05 13:41 ` Ben Elliston
  2001-01-05 14:10 ` Ben Elliston
@ 2001-01-05 15:10 ` Frank Ch. Eigler
  2 siblings, 0 replies; 5+ messages in thread
From: Frank Ch. Eigler @ 2001-01-05 15:10 UTC (permalink / raw)
  To: J. Johnston; +Cc: sid

Hi -

On Fri, Jan 05, 2001 at 04:38:03PM -0500, J. Johnston wrote:
: The following patch is for a new glue component: bus_mux which is a
: bus multiplexer. [...]

Looks good.  Nice docs.

(An alternative to toggling between two alternatives would be
to have a configurable fan-out, sort of like the hw-glue-sequence
component.  Later.)

- FChE
-- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6VlRGVZbdDOm/ZT0RAmtiAJ9/DVKMa6lawYGeAwnWAG6hQBJiLACeO/td
Uq1ktfY3ZgLby6kcfuyx/oE=
=LjiS
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-01-05 15:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-05 13:38 New bus_mux component J. Johnston
2001-01-05 13:41 ` Ben Elliston
2001-01-05 14:10 ` Ben Elliston
2001-01-05 15:01   ` Frank Ch. Eigler
2001-01-05 15:10 ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).