[patch][commit] Base address for hw-glue-probe-bus

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch][commit] Base address for hw-glue-probe-bus

Dave Brolley-2
Hi,

The address which is driven on the "address" pin of hw-glue-probe-bus is
the one which comes in on the "upstream" bus. This is OK if the probe
bus is at the top of the memory heirarchy, but not so useful if it is,
for example, between a mapper and a memory component. In this case, the
address which is driven is the offset into the memory region.

In order to make this component more useful, I've committed the attached
patch which adds a "base-address" attribute to hw-glue-probe-bus. This
base is added to the address being probed and the result is driven on
the "address" pin. This allows the actual address being probed to be
driven in cases like the one above. The default value of "base-address"
is zero, so the behaviour of configurations which don't set it will not
change.

Tested on the internal port which exposed the requirement.

Let me know if you have any problems or concerns.

Dave


2006-08-29  Dave Brolley  <[hidden email]>

        * glue.cxx (base_address): New member of bus_prober.
        (bus_prober): Initialize base_address.
        (writeAny): Add this->prober->base_address to the address driven.
        (readAny): Likewise.
        * hw-glue-probe-bus.xml: Document new base-address attribute.
        * *.txt: Regenerated.


Index: sid/component/glue/glue.cxx
===================================================================
RCS file: /cvs/cvsfiles/devo/sid/component/glue/glue.cxx,v
retrieving revision 1.38
diff -c -p -r1.38 glue.cxx
*** sid/component/glue/glue.cxx 11 Nov 2002 22:28:28 -0000 1.38
--- sid/component/glue/glue.cxx 28 Aug 2006 18:58:34 -0000
***************
*** 1,6 ****
  // glue.cxx - miscellaneous glue components.  -*- C++ -*-
 
! // Copyright (C) 1999-2001 Red Hat.
  // This file is part of SID and is licensed under the GPL.
  // See the file COPYING.SID for conditions for redistribution.
 
--- 1,6 ----
  // glue.cxx - miscellaneous glue components.  -*- C++ -*-
 
! // Copyright (C) 1999-2001, 2006 Red Hat.
  // This file is part of SID and is licensed under the GPL.
  // See the file COPYING.SID for conditions for redistribution.
 
*************** class bus_prober: public virtual compone
*** 376,381 ****
--- 376,382 ----
    probing_bus upstream;
    bus* downstream;
 
+   host_int_4 base_address;
    output_pin address_pin;
    output_pin data_high_pin;
    output_pin data_low_pin;
*************** public:
*** 390,396 ****
 
    bus_prober::bus_prober ():
      upstream (this),
!     downstream (0)
      {
        sample_interval = 1;
 
--- 391,398 ----
 
    bus_prober::bus_prober ():
      upstream (this),
!     downstream (0),
!     base_address (0)
      {
        sample_interval = 1;
 
*************** public:
*** 408,413 ****
--- 410,416 ----
        add_pin ("type", & this->accesstype_pin);
        add_attribute ("type", & this->accesstype_pin, "pin");
       
+       add_attribute ("base-address", & this->base_address, "setting");
        add_attribute ("sample-interval", & this->sample_interval, "setting");
        add_attribute ("trace?", & this->upstream.verbose_p, "setting");
        add_attribute ("label", & this->label, "setting");
*************** probing_bus::writeAny(host_int_4 addr, D
*** 470,476 ****
 
   this->counter = 0;
   // drive informational pins
!  this->prober->address_pin.drive (addr);
   typename DataType::host_int_type d_host = data; // natural endianness
   host_int_8 d_wide(d_host); // widen
   this->prober->data_high_pin.drive ((d_wide >> 32) & 0xFFFFFFFF);
--- 473,479 ----
 
   this->counter = 0;
   // drive informational pins
!  this->prober->address_pin.drive (this->prober->base_address + addr);
   typename DataType::host_int_type d_host = data; // natural endianness
   host_int_8 d_wide(d_host); // widen
   this->prober->data_high_pin.drive ((d_wide >> 32) & 0xFFFFFFFF);
*************** probing_bus::readAny(host_int_4 addr, Da
*** 506,512 ****
 
   this->counter = 0;
   // drive informational pins
!  this->prober->address_pin.drive (addr);
   typename DataType::host_int_type d_host = data; // natural endianness
   host_int_8 d_wide(d_host); // widen
   this->prober->data_high_pin.drive ((d_wide >> 32) & 0xFFFFFFFF);
--- 509,515 ----
 
   this->counter = 0;
   // drive informational pins
!  this->prober->address_pin.drive (this->prober->base_address + addr);
   typename DataType::host_int_type d_host = data; // natural endianness
   host_int_8 d_wide(d_host); // widen
   this->prober->data_high_pin.drive ((d_wide >> 32) & 0xFFFFFFFF);
Index: sid/component/glue/hw-glue-probe-bus.xml
===================================================================
RCS file: /cvs/cvsfiles/devo/sid/component/glue/hw-glue-probe-bus.xml,v
retrieving revision 1.4
diff -c -p -r1.4 hw-glue-probe-bus.xml
*** sid/component/glue/hw-glue-probe-bus.xml 27 May 2002 20:53:49 -0000 1.4
--- sid/component/glue/hw-glue-probe-bus.xml 28 Aug 2006 18:58:34 -0000
***************
*** 18,23 ****
--- 18,24 ----
      <defpin name="type" direction="out" legalvalues="enum values" behaviors="bus traffic sampling" />
 
      <!-- attributes -->
+     <defattribute name="base-address" category="setting" legalvalues="numeric" defaultvalue="0" behaviors="bus traffic tracing" />
      <defattribute name="trace?" category="setting" legalvalues="boolean" defaultvalue="0" behaviors="bus traffic tracing" />
      <defattribute name="sample-interval" category="setting" legalvalues="numeric" defaultvalue="1" behaviors="bus traffic sampling" />
      <defattribute name="interval-counter" category="register" legalvalues="numeric" behaviors="bus traffic sampling" />
***************
*** 54,60 ****
   pins.  In sequence, the following output pins are driven:</p>
  <ul>
   <li>
!    <name>address</name> - address parameter</li>
   <li>
     <name>data-high</name> - top 32 bits of bus data being read/written</li>
   <li>
--- 55,61 ----
   pins.  In sequence, the following output pins are driven:</p>
  <ul>
   <li>
!    <name>address</name> - address parameter added to the value of the <attribute>base-address</attribute> attribute</li>
   <li>
     <name>data-high</name> - top 32 bits of bus data being read/written</li>
   <li>
Reply | Threaded
Open this post in threaded view
|

Re: [patch][commit] Base address for hw-glue-probe-bus

Frank Ch. Eigler
Hi -

> The address which is driven on the "address" pin of hw-glue-probe-bus is
> the one which comes in on the "upstream" bus. This is OK if the probe
> bus is at the top of the memory heirarchy, but not so useful if it is,
> for example, between a mapper and a memory component. [...]

This sacrifices reusability of such a probe component in a
multiply-connected bus topology (having multiple incoming mappings on
the same upstream bus).  To do this without would require more
"wiring", like putting the bus-probe between the transparent mapper
and a similarly configured normal one.

- FChE
Reply | Threaded
Open this post in threaded view
|

Re: [patch][commit] Base address for hw-glue-probe-bus

Dave Brolley-2
Frank Ch. Eigler wrote:

>Right, go ahead with your patch.  For the documentation of this new
>attribute though, please make a mention of the possibility of the
>probed device being multiply mapped.
>
>  
>
OK. I've committed the attached patch which adds the requested
documentation and a correction to the code which ensures that
base-address is also reflected in the out generated when the trace?
attribute is set.

Dave


Index: sid/component/glue/glue.cxx
===================================================================
RCS file: /cvs/src/src/sid/component/glue/glue.cxx,v
retrieving revision 1.13
diff -c -p -r1.13 glue.cxx
*** sid/component/glue/glue.cxx 29 Aug 2006 17:47:22 -0000 1.13
--- sid/component/glue/glue.cxx 29 Aug 2006 20:31:19 -0000
*************** probing_bus::writeAny(host_int_4 addr, D
*** 469,480 ****
        this->counter ++;
        if (this->counter >= this->prober->sample_interval)
  {
   if (this->verbose_p)
     this->traceAccess (addr, data, code, s);
 
   this->counter = 0;
   // drive informational pins
!  this->prober->address_pin.drive (this->prober->base_address + addr);
   typename DataType::host_int_type d_host = data; // natural endianness
   host_int_8 d_wide(d_host); // widen
   this->prober->data_high_pin.drive ((d_wide >> 32) & 0xFFFFFFFF);
--- 469,481 ----
        this->counter ++;
        if (this->counter >= this->prober->sample_interval)
  {
+  addr += this->prober->base_address;
   if (this->verbose_p)
     this->traceAccess (addr, data, code, s);
 
   this->counter = 0;
   // drive informational pins
!  this->prober->address_pin.drive (addr);
   typename DataType::host_int_type d_host = data; // natural endianness
   host_int_8 d_wide(d_host); // widen
   this->prober->data_high_pin.drive ((d_wide >> 32) & 0xFFFFFFFF);
*************** probing_bus::readAny(host_int_4 addr, Da
*** 505,516 ****
        this->counter ++;
        if (this->counter >= this->prober->sample_interval)
  {
   if (this->verbose_p)
     this->traceAccess (addr, data, code, s);
 
   this->counter = 0;
   // drive informational pins
!  this->prober->address_pin.drive (this->prober->base_address + addr);
   typename DataType::host_int_type d_host = data; // natural endianness
   host_int_8 d_wide(d_host); // widen
   this->prober->data_high_pin.drive ((d_wide >> 32) & 0xFFFFFFFF);
--- 506,518 ----
        this->counter ++;
        if (this->counter >= this->prober->sample_interval)
  {
+  addr += this->prober->base_address;
   if (this->verbose_p)
     this->traceAccess (addr, data, code, s);
 
   this->counter = 0;
   // drive informational pins
!  this->prober->address_pin.drive (addr);
   typename DataType::host_int_type d_host = data; // natural endianness
   host_int_8 d_wide(d_host); // widen
   this->prober->data_high_pin.drive ((d_wide >> 32) & 0xFFFFFFFF);
Index: sid/component/glue/hw-glue-probe-bus.xml
===================================================================
RCS file: /cvs/src/src/sid/component/glue/hw-glue-probe-bus.xml,v
retrieving revision 1.3
diff -c -p -r1.3 hw-glue-probe-bus.xml
*** sid/component/glue/hw-glue-probe-bus.xml 29 Aug 2006 17:47:22 -0000 1.3
--- sid/component/glue/hw-glue-probe-bus.xml 29 Aug 2006 20:31:19 -0000
***************
*** 18,24 ****
      <defpin name="type" direction="out" legalvalues="enum values" behaviors="bus traffic sampling" />
 
      <!-- attributes -->
!     <defattribute name="base-address" category="setting" legalvalues="numeric" defaultvalue="0" behaviors="bus traffic tracing" />
      <defattribute name="trace?" category="setting" legalvalues="boolean" defaultvalue="0" behaviors="bus traffic tracing" />
      <defattribute name="sample-interval" category="setting" legalvalues="numeric" defaultvalue="1" behaviors="bus traffic sampling" />
      <defattribute name="interval-counter" category="register" legalvalues="numeric" behaviors="bus traffic sampling" />
--- 18,24 ----
      <defpin name="type" direction="out" legalvalues="enum values" behaviors="bus traffic sampling" />
 
      <!-- attributes -->
!     <defattribute name="base-address" category="setting" legalvalues="numeric" defaultvalue="0" behaviors="bus traffic sampling" />
      <defattribute name="trace?" category="setting" legalvalues="boolean" defaultvalue="0" behaviors="bus traffic tracing" />
      <defattribute name="sample-interval" category="setting" legalvalues="numeric" defaultvalue="1" behaviors="bus traffic sampling" />
      <defattribute name="interval-counter" category="register" legalvalues="numeric" behaviors="bus traffic sampling" />
***************
*** 55,61 ****
   pins.  In sequence, the following output pins are driven:</p>
  <ul>
   <li>
!    <name>address</name> - address parameter added to the value of the <attribute>base-address</attribute> attribute</li>
   <li>
     <name>data-high</name> - top 32 bits of bus data being read/written</li>
   <li>
--- 55,62 ----
   pins.  In sequence, the following output pins are driven:</p>
  <ul>
   <li>
!    <name>address</name> - address parameter added to the value of the
!             <attribute>base-address</attribute> attribute</li>
   <li>
     <name>data-high</name> - top 32 bits of bus data being read/written</li>
   <li>
***************
*** 146,151 ****
--- 147,173 ----
      <p>
   A statistics-gathering component could attach to the sampling output
   pins to maintain a picture of a program's memory access patterns.</p>
+
+         <p>
+           The <attribute>base-address</attribute> attribute should only be used if
+           the downstream component has a fixed address within the system. The
+           <attribute>base-address</attribute> attribute is not suitable for situations in
+           which more than one address range is mapped onto the <bus>upstream</bus> bus.</p>
+         <p>
+           Consider the example below in which a single hw-glue-probe-bus is used to trace
+           two address ranges.</p>
+
+ <code> new hw-glue-probe-bus bus-prober
+ new SOME_KIND_OF_CPU cpu
+         new SOME_KIND_OF_TRANSPARENT_MAPPER probe-mapper
+         new SOME_KIND_OF_MAPPER mapper
+         connect-bus cpu insn-memory probe-mapper access-port
+         connect-bus probe-mapper [0-1023] bus-prober upstream
+         connect-bus probe-mapper [1024-2047] mapper access-port
+         connect-bus probe-mapper [2048-3071] bus-prober upstream
+         connect-bus bus-prober downstream mapper access-port
+         set bus-prober trace? 1</code>
+
        </p>
      </p>
    </env>