the emulation technology of the present invention uses the debug upside opportunities noted above to provide developers with an arsenal of debug capability aimed at narrowing the control and visibility gap . this emulation technology delivers the solution to the complex debug problems of today &# 39 ; s highly integrated embedded real - time systems . this technology attacks the loss of visibility , control , and ease of use issues described in the preceding section while expanding the feature set of current emulators . the on - chip debug component of the present invention provides a means for optimizing the cost and debug capabilities . the architecture allows for flexible combinations of emulation components or peripherals tailored to meet system cost and time to market constraints . the scalability aspect makes it feasible to include them in production devices with manageable cost and limited performance overhead . emulation , debug , and simulation tools of the present invention are described herein . the emulation and debug solutions described herein are based on the premise that , over time , some if not most debug functions traditionally performed off chip must be integrated into the production device if they are to remain in the developer &# 39 ; s debug arsenal . to support the migration of debug functions on chip , the present invention provides a powerful and scalable portfolio of debug capabilities for on - chip deployment . this technology preserves all the gains of initial jtag technology while adding capabilities that directly assault the visibility , control , and ease of use issues created by the vanishing visibility trend . four significant architectural infrastructure components spearhead the assault on the control and visibility gap described earlier herein : real - time emulation ( rte ); real - time data exchange ( rtdx ); trace ; and advanced analysis . real - time emulation ( rte ) provides a static view of the cpu and memory state after background program is stopped . interrupt driven code continues to execute while the background program is stopped . real time emulation provides basic debug capability of computational problems and code design problems . real - time emulation ( rte ) provides a base set of fixed capabilities for real - time execution control ( run , step , halt , etc .) and register / memory visibility . this component allows the user to debug application code while real - time interrupts continue to be serviced . registers and memory may be accessed in real - time with no impact to interrupt processing . users may distinguish between real - time and non real - time interrupts , and mark code that must not be disturbed by real - time debug memory accesses . this base emulation capability includes hardware that can be configured as two single point hardware breakpoints , a single data watchpoint , an event counter , or a data logging mechanism . the emu pin capability includes trigger i / os for multiprocessor event processing and a uni - directional ( target to host ) data logging mechanism . real - time data exchange ( rtdx ) enables debugger software to interact with the application code to exchange commands and data while the application continues to execute . real - time data exchange employs analysis components to identify observation points and interrupt program flow to collect data . real - time data exchange employs dynamic instrumentation , dynamic variable adjustments and dynamic data collection . real - time data exchange provides real - time data transfers between an emulator host and target application . this component offers both bi - directional and uni - directional dsp target / host data transfers facilitated by the emulator . the dsp ( or target ) application may collect target data to be transferred to the host or receive data from the host , while emulation hardware ( within the dsp and the emulator ) manages the actual transfer . several rtdx transfer mechanisms are supported , each providing different levels of bandwidth and pin utilization allowing the trade off of gates and pin availability against bandwidth requirements . trace employs bus snooper hardware to collects selective program flow and data transactions for export without interacting with the application . trace uses analysis components to define program segments and bus transactions that are to be recorded for export . trace permits evaluation of program flow corruption , memory corruption and program timing problems . trace enables benchmarking , code coverage measurement and path coverage measurement . trace is a non - intrusive mechanism of providing visibility of the application activity . trace is used to monitor cpu related activity such as program flow and memory accesses , system activity such as asic state machines , data streams and cpu collected data . historical trace technology also used logic analyzer like collection and special emulation ( ses ) devices with more pins than a production device . the logic analyzer or like device processed native representations of the data using a state machine like programming interface ( filter mechanism ). this trace model relied on all activity being exported with external triggering selecting the data that needed to be stored , viewed and analyzed . existing logic - analyzer - like technology does not , however , provide a solution to decreasing visibility due to higher integration levels , increasing clock and more sophisticated packaging . in this model , the production device must provide visibility through a limited number of pins . the data exported is encoded or compressed to reduce the export bandwidth required . the recording mechanism becomes a pure recording device , packing exported data into a deep trace memory . on - chip trace with high speed serial data export , in combination with advanced analysis provides a solution for soc designs . trace is used to monitor cpu related activity such as program flow and memory accesses , system activity such as asic state machines , data streams etc . and cpu collected data . this creates four different classes of trace data : program flow and timing provided by the dsp core ( program counter trace ); memory data references made by the dsp core or chip level peripherals ( data reads and writes ); application specific signals and data ( asic activity ); and cpu collected data . collection mechanisms for the four classes of trace data are modular allowing the trade off of functionality verses gates and pins required to meet desired bandwidth requirements . real - time data exchange and trace functions provide similar , but different forms of visibility . they differ in terms of how data is collected , and the circumstances under which they would be most effective . real - time data exchange is a cpu assisted solution for exchanging information . the data to be exchanged have a well - defined behavior in relation to the program flow . real - time data exchange can be used to record the input or output buffers from a dsp algorithm . real - time data exchange requires cpu assistance in collecting data hence there is definite , but small , cpu bandwidth required to accomplish this . real - time data exchange is an application intrusive mechanism of providing visibility with low recurring overhead cost . trace is a non - intrusive , hardware - assisted collection mechanism ( such as bus snoopers ) with very high bandwidth ( bw ) data export . trace is used when there is a need to export data at a very high data rate or when the behavior of the information to be traced is not known , or is random in nature or associated with a address . program flow is a typical example where it is not possible to know a priori the behavior . the bandwidth required to export this class of information is high . data trace of specified addresses is another example . the bandwidth required to export data trace is very high . trace data is unidirectional , going from target to host only . real - time data exchange can exchange data in either direction although unidirectional forms can be supported for data logging . the trace data path can also be used to provide very high speed uni - directional real - time data exchange such as cpu collected trace data . advanced analysis allows observation of occurrences of events or event sequences . advanced analysis enables measurement of elapsed time between events . advanced analysis can generate external triggers . advanced analysis alters the program flow after the detection of events or event sequences . advanced analysis is most useful for benchmarking , event / sequence identification , external trigger generation and stop program execution . note that advanced analysis can be used to activate trace and real - time data exchange . advanced analysis provides a non - intrusive on - chip event detection and trigger generation mechanism . the trigger outputs created by advanced analysis control other infrastructure components such as trace and real - time data exchange . historical trace technology used bus activity exported to a logic analyzer to generate triggers that controlled trace within the logic analyzer unit or generated triggers which were supplied to the device to halt execution . this usually involved a chip that had more pins than the production device ( an se or special emulation device ). this analysis model does not work well in the system - on - a - chip ( soc ) era as the integration levels and clock rates of today &# 39 ; s devices preclude full visibility bus export . advanced analysis provides affordable on - chip instruction and data bus comparators , sequencers and state machines , and event counters to recreate the most important portions of the triggering function historically found off chip . advanced analysis provides the control aspect of debug triggering mechanism for trace , real - time data exchange and real - time emulation . this architectural component identifies events , tracks event sequences , and assign actions based on their occurrence , such as break execution , enable / disable trace , count , enable / disable real - time data exchange . the modular building blocks for this capability include bus comparators , external event generators , state machines or state sequencers , and trigger generators . the modularity of the advanced analysis system allows the trade off of functionality verses gates . since the trace port bandwidth is a premium , the export mechanism provides for the export of trace information either at the processor clock rate or a rate that is asynchronous to the processor clock rate . the asynchronous export mode allows the trace port transmission rate to be maximized as it can be de - coupled from the processor clock rate . this is significant as is unlikely that the processor clock rate will match the optimum trace export rate in most applications . it is anticipated that this architecture will remain viable for processor clock rates of 1 ghz or more . the use of a local oscillator allows the trace port transmission to be loosely coupled to the packet generation . this allows the trace transmission rate to be optimized and the pin count minimized . [ 0060 ] fig3 illustrates an example of one on - chip debug architecture embodying target system 140 . the architecture uses several module classes to create the debug function . one of these classes is event detectors including bus event detectors 210 , auxiliary event detectors 211 and counters / state machines 213 . a second class of modules is trigger generators including trigger builders 220 . a third class of modules is data acquisition including trace collection 230 and formatting . a fourth class of modules is data export including trace export 240 , and real - time data exchange export 241 . trace export 240 is controlled by clock signals from local oscillator 245 . local oscillator 245 will be described in detail below . a final class of modules is scan adapter 250 , which interfaces scan input / output to cpu core 201 . final data formatting and pin selection occurs in pin manager and pin micros 260 . the size of the debug function and its associated capabilities for any particular embodiment of a system - on - chip may be adjusted by either deleting complete functions or limiting the number of event detectors and trigger builders deployed . additionally , the trace function can be incrementally increased from program counter trace only to program counter and data trace along with asic and cpu generated data . the real - time data exchange function may also be optionally deployed . the ability to customize on - chip tools , changes the applications development paradigm . historically , all chip designs with a given cpu core were limited to a fixed set of debug capability . now , an optimized set of debug capability is available for each chip design . this paradigm change gives system architects the tools needed to manage product development risk at an affordable cost . note that the same cpu core may be used with differing peripherals with differing pin outs to embody differing system - on - chip products . these differing embodiments may require differing debug and emulation resources . the modularity of this invention permits each such embodiment to include only the necessary debug and emulation resources for the particular system - on - chip application . the real - time emulation debug infrastructure component is used to tackle basic debug and instrumentation operations related to application development . it contains all execution control and register visibility capabilities and a minimal set of real - time data exchange and analysis such as breakpoint and watchpoint capabilities . these debug operations use on - chip hardware facilities to control the execution of the application and gain access to registers and memory . some of the debug operations which may be supported by real - time emulation are : setting a software breakpoint and observing the machine state at that point ; single step code advance to observe exact instruction by instruction decision making ; detecting a spurious write to a known memory location ; and viewing and changing memory and peripheral registers . real - time emulation facilities are incorporated into a cpu mega - module and are woven into the fabric of cpu core 201 . this assures designs using cpu core 201 have sufficient debug facilities to support debugger application program 110 baseline debug , instrumentation , and data transfer capabilities . each cpu core 201 incorporates a baseline set of emulation capabilities . these capabilities include but are not limited to : execution control such as run , single instruction step , halt and free run ; displaying and modifying registers and memory ; breakpoints including software and minimal hardware program breakpoints ; and watchpoints including minimal hardware data breakpoints . the execution control facilities offer two modes of operation , stop mode and real - time . these modes differ as to how cpu core 201 handles maskable interrupts , non - maskable interrupts , and reset after code execution is halted . the halt of code execution can be caused by the user from debugger application program 110 via a keyboard or mouse input , via a software breakpoint or via a hardware breakpoint or watchpoint . all interrupts and resets are disabled at this point when operating in stop mode . in the real - time mode , reset and non - maskable interrupts ( nmi ) can always be serviced along with those maskable interrupts designated as real - time events . the real - time facilities are implemented without the assistance of a monitor program for cpu cores 201 with pipelines that allow an interrupt between each instruction . a monitor program is required to support real - time operation for those pipelines that do not meet the interrupt between each instruction criteria . the real - time aspects of this capability provides for the execution of interrupt driven code while the execution of background code is stopped to perform debug operations . facilities are provided to define each interrupt as either a real - time or a non - real - time event . interrupts defined as real - time events are continually serviced , even while the debug of background code occurs . interrupts defined as non - real - time events can be serviced as long as the debug facilities have not stopped the application . the real - time execution of the time critical code is thus transparent to the developer . the registers of cpu core 201 are viewed when the application has been halted . the register view corresponds to the machine state at the stop point . the debug software and hardware assure that the register activity that occurs as a result of real - time interrupts is transparent to the user . all register changes affect only registers values relative to the stop point . memory is also displayed and changed relative to the stop point . alternately , memory may be viewed and changed independent of whether a stop point has occurred . debug related memory accesses can be constrained to bus cycles where cpu core 201 has not created a memory access . this makes debug related accesses transparent to the application when the these accesses target zero wait state memory . a shared hardware component provides two hardware breakpoints , an address and data watchpoint or low bandwidth real - time data exchange capabilities . this hardware block also provides a parallel signature analysis function in some implementations . the hardware breakpoints provide a means for setting breakpoints in rom . the watchpoint provides for the detection of memory read and writes of specific data patterns to an address . baseline and extended debug capabilities may be customized on - chip for each instance of the system - on - chip . this requires flexibility in the debug software . when the debug system is initialized , a chip identity code is read from the device . debugger application program 110 uses this identity code to locate a file that identifies the debug building blocks of the corresponding chip . the file data provides information to automatically configure debug application program 110 to display any enabled capabilities of target device 140 to the user . since interaction with system resources can alter the timing of real - time systems , debugger application program 110 takes special care not to touch system resources without being directed to do so . at startup and thereafter , debugger application program 110 does not therefore access machine resources unless a user action dictates these accesses . this minimizes the opportunity to create unwanted system disturbances debugger application program 110 presents the machine state when the application program halts . when the execution mode is stop mode , the application program can be halted after each instruction . functions such as step , breakpoints or the like , cause the application to halt immediately . there are no dependencies on the cpu pipeline , with a step advancing the pipeline one instruction . for real - time mode , the model for execution control remains identical to that for stop mode for cpus that can take an interrupt after every instruction . when the execution mode is real time , the visualization of the execution control changes substantially for cpu cores 201 that cannot take an interrupt after every instruction . an example of such a cpu core is the texas instruments tms320c6000 with an unprotected pipeline . for this cpu class , the application program can only be halted at interruptible points in the program . this is true for breakpoints , watchpoints and single instruction steps . for this cpu class , a step operation starts execution and execution does not stop until it reaches an interruptible point . this means the number of instructions executed by the step may be one or more and perhaps many more than one . any breakpoint or watchpoint request asserted will only cause the halt of the application program when interrupts are enabled . this halt of program activity could be many states after a halt request is asserted . real - time execution control allows interrupt code execution to occur while background code has been halted . a breakpoint or other halt condition can occur in this interrupt code after background code execution was previously halted . in this case , multiple stops are outstanding at the same time . each stop creates a debug frame , with debug frames being stacked . execution must be restarted from the most recently generated debug frame before execution of any prior frames can be restarted . the ability to flush all debug frames is provided . visibility into the on - chip program and data activity is the key to efficient debug . providing this visibility involves on - chip facilities for data collection , export of the collected data and control over the collection mechanism . an external recording device such as a logic analyzer or emulator stores the exported data . the recording device forwards to debugger application program 110 upon request for post processing and display . components of debugger application program 110 use the processed trace data to provide the visibility needed for a number of debug , quality assurance and optimization operations related to application development . some of the development processes that use trace are : run away code debug ; memory corruption debug ; general observation of program flow and decision making ; monitoring application specific integrated circuit ( asic ) components and peripheral operations ; observing input and / or output data streams ; instruction code coverage and path coverage ; and program profiling and bus or memory profiling . each trace channel can export up to four types of information . these four types are : program flow or program counter trace with timing ; reads and writes to memory and peripherals ; asic data or other activity ; and data provided by the application software . table 1 identifies the trace information types needed to quickly address issues related to the development processes listed above . from one to four channels such trace channels may be activated simultaneously permitting the concurrent tracing of the activity generated by one or more subsystems on a chip . these subsystems could be cpu cores 201 and memory systems , asic logic , input or output data streams or other information classes defined by the user . when multiple channels are deployed , the channel export mechanisms can share pins to increase the average transmission efficiency . generally , pin constraints and other factors limit the number of trace channels on a physical device to four . the trace function is distributed through the development system architecture . it has three major components : on - chip collection and filtering , compression and export ; recording at the emulator or logic analyzer ; and interpretation and display at host computer 120 using debugger application program 110 software . trace utilizes on - chip hardware to collect and filter , compress , and export on - chip activity to a logic analyzer or emulator . collection involves identifying the trace data and capturing the trace data into on - chip buffers . data is buffered and prioritized internally after collection to assure that trace information is exported as quickly and efficiently as possible . buffer sizes and the number of pins dedicated to exporting trace data are scalable to allow the system designer to help meet system trace speed and volume requirements . the captured data is compressed before it is passed to the export block . after compression , the data is exported at a programmable or fixed trace port width at a clock rate that may or may not be the same as the cpu core 201 clock rate . the export clock is derived from either cpu core 201 clock or from a local oscillator dedicated to the generation of the export clock . the local oscillator option addresses several issues . as system clock rates increase , it may not be possible to export data at cpu core 201 clock rate . an export clock not derived from cpu clock 201 rate may maximize the export bandwidth . using an optional local oscillator incurs a small incremental hardware cost in order to maximize the transmission bandwidth of trace pin . trace information can be collected in one of three ways . these are : bus snoopers ; cpu core collection ; and via asic specific hardware . bus snoopers monitor program flow and memory accesses with the appropriate filtering identifying transactions of interest . cpu core collection uses cpu core 201 to collect data as part of application program flow . asic logic can either determine its own collection criteria or have collection initiated by a advanced analysis trigger output . bus snoopers minimize intrusiveness and are better suited to monitor information in a timing transparent manner . this class of collection does not require application program intervention in any way . in the case of bus snoopers , trace triggers created by advanced analysis logic direct the capture of desired of information in on - chip first - in - first - out ( fifo ) buffers where it is subsequently processed for export . the control of bus snooper collection mechanisms by the advanced analysis is called trace filtering . the collection can also be controlled via a memory -- mapped register . debugger application program 110 may optionally allow the application to access this register . options are provided to allow the trace collection to either stall or discard data when the collection parameters cause the fifos to fill faster than they can be emptied . this type of collection mechanism is used to create program flow and timing trace . it is deployed to trace memory references whose origins are not deterministic . advanced analysis facilities or components identify what data is to be collected or how much data is to be collected . these facilities are used to start or stop trace acquisition after a sequence of events occurs in the application program or directly select the data that is placed in collection fifos . advanced analysis also provides the ability to collect a pre - specified number of bus operations or transactions after the occurrence of an event or define an event that ends the trace session collecting n trace transactions before the system event . these facilities can be used to create a number of additional filtering criteria , with the richness of this criteria set by the strength of the analysis event detection , state machines and counters . debugger application program 110 can be used to collect system activity when the data of interest can be observed at a point the applications program . in this case , code is added to the application to collect the desired information and move this information to the trace logic for export . this is approach is actually a hybrid of real - time data exchange and trace where cpu core 201 collects the data which the trace export mechanism exports . this collection and export mechanism provides a high bandwidth output - only application accessible port . this capability can be used simultaneously and in conjunction with the bus snooper capabilities . the applications program collection method targets data collection and is not suited for the collection of program flow and timing information . it is more cost effective than the bus snooper method when used to collect data streams that are related to program flow . data generated by asic logic or input data streams is presented to the trace export mechanism for inclusion into the trace export stream through a predefined interface . in this collection mechanism , all data fifos and data flow control is the responsibility of the asic logic . the native form of trace data is compressed before export in order to maximize the amount of information that can be exported for a given trace export bandwidth . the compression operation converts the native information captured on - chip to a format that is , in some cases , heavily compressed . the compressed information must be processed with a sophisticated decompression algorithm to return it to its native form . this decompression operation is performed by debugger application program 110 running on host computer 120 after the trace data is removed from target device 140 and passed to the trace software running on host computer 120 . the key to a cost effective on - chip trace is reducing the amount of data collected for export to a trace recorder . reducing the data volume reduces the need for trace pins and on - chip buffering . a number of compression , filtering , and encoding strategies are employed to accomplish this objective . these strategies play a significant role in keeping the trace bandwidth requirements in check . a few of the compression and bandwidth preservation techniques used include the following . providing advanced analysis resources enables user specification of exactly what data is to be exported . thus data is only collected at the points in the application program of interest . the on - chip facilities on target system 140 collects and exports only program counter discontinuity information . the full program counter flow is reconstructed by debugger application program 110 . this reduces the amount of trace data needed to be transferred . branch or context switch information is not transmitted if it can be inferred from the program source code . high order bits of data values that are the same as the previous values transmitted are not transmitted . instruction activity indicators are minimized in architectures that permit this minimization . the export of non - native , compressed information means that triggering and sequence detection at host computer 120 is not practical . since the trace stream can contain multiple data types , it is also difficult to define the recording of a specific number of samples of one type before and after an event at the recording destination . consequently , the recorder is treated as a pure recording device , with all event and trace management moved on - chip . since the trace port bandwidth is a premium , the export mechanism provides for the export of trace information either at the processor clock rate or a rate that is asynchronous to the processor clock rate . the asynchronous export mode allows the trace port transmission rate to be maximized as it can be de - coupled from the processor clock rate . this is significant as is unlikely that the processor clock rate will match the optimum trace export rate in most applications . data trace has an immense appetite for export bandwidth . every effort is made though debug function pin sharing to allocate as many pins to data trace export as practical . thus the maximum amount of information can be exported without stalling the processor or losing data . the pin sharing option , very efficient compression algorithms , and high transmission rates minimize the number of chip pins needed to be allocated to debug functions . this invention provides a mix of debug capabilities addressing a number of debug problems . they are a superset of the capabilities provided by the prior generation of debug port offerings . two new capabilities of high performance real - time data exchange and trace stand out . they have been added to the debug portfolio to maintain visibility in the face of the continuous march to higher clock rates and higher levels of integration . addressing the visibility problem at an affordable system cost presents a particular challenge to the tools architects and developers . since debug will have a modest or small pin and gate allocation to constrain system cost , the challenge is to provide historical visibility levels with novel approaches . maintaining the status quo in this environment would indeed be a major accomplishment . the debug port is one component of a configurable debug strategy . traditionally , a single set of debug capabilities was built into each cpu core 201 . these capabilities remained constant over the lifetime of cpu core 201 , supported by a single set of debugger source code . as the relentless increase of gate densities and clock rates continue , the in system debug problem becomes more complex . increased levels of integration translate to vanishing visibility . this is a severe problem because it is difficult if not impossible to fix what you cannot see . as systems - on - chip become dominated by large memory structures , the relative cost of debug features in relation to the entire system has shrunk dramatically . currently where adding more debug capabilities to a custom digital signal processor ( cdsp ) or mass market device is practical on a chip by chip basis . customers are prepared to add additional debug capabilities to those standard capabilities incorporated into cpu cores . these additional capabilities are expected to create time to market advantages that justify the additional recurring costs . in the customer &# 39 ; s mind , the customizing of the on - chip debug capabilities ultimately boils down to three questions . first , to what extent will this customization improve my ability to create and produce product ? second , what is the cost of the customization in gates or die area ? third , what is the cost of the customization in pins or package cost ? in summary , are the costs of customization worth the benefits ? the answer to these questions is not the same for all design teams and all products . since the complexity of applications varies along with the debug styles of design teams , the need to customize varies by chip . there will be no one answer . as the vanishing visibility problem illustrated in fig1 intensifies , the customer is facing a dilemma . today &# 39 ; s minimal on - chip capabilities pose a time to market threat . one subtle system problem can introduce weeks of product delivery delay . system designers can &# 39 ; t fix it if they can &# 39 ; t see it . a strong on - chip tool set is insurance against this happening . the need to strengthen the debug capabilities of a chip receives additional attention when production devices serve as the application debug platform . these production chips must provide sufficient debug capabilities to support time to market objectives yet be cost competitive . the on - chip debugging requirements are heavily influenced by the debug style of system design teams . it is highly desirable to provide system architects the ability to tailor the on - chip debug facilities to balance time to market and cost needs . the techniques of this invention provide this option . these techniques provide for addition of debug capability to custom digital signal processor ( cdsp ) and mass market chips via a library of emulation peripherals . the number and type of these peripherals added are tailored to meet the debug requirements defined by the target application . the original semiconductor manufacture &# 39 ; s applications teams define the emulation capabilities mix added to mass market chips . the custom digital signal processor customer defines the emulation capabilities added to cdsps . the scalability aspect of emulation capability makes it feasible to include them in production devices with manageable cost and limited performance overhead . in this configurable debug / emulation paradigm , the system architect has the option to increase or decrease the pin count allocated to debug functions with a corresponding increase or decrease in the debug capabilities . these include the capability or functions available at any one time , the communication bandwidth , and the trace bandwidth . since a user will not generally utilize all emulation functions at the same time , it makes sense to dynamically allocate the emulation peripherals and trace / debug pin pool based the debug capability specified by the user at any point during development session . this approach substantially minimizes the pin count pressure created by the addition of emulation capability to a production chip and provides more capability for a lower cost . the pins assigned to trace and debug can be dynamically reallocated to trace , debug or a mix of trace and debug functions . at any one time , the debug pin pool may provide a mix of capabilities related to : debug , such as run , step , read and write registers and memory ; trigger channels used to input and output triggers ; real - time data exchange for data exchange or data logging ; and trace for export of program counter , memory access , or asic logic activity . the debug pin pool may dictate the available trace and communication bandwidths , the communication formats used for debug and real - time data exchange and the emulation peripheral functions that can be used simultaneously . the emulation peripheral functionalities of trace and real - time data exchange are designed permitting a scalable number of pins . more pins allocated to a particular function means more bandwidth for that function . the allocation of more pins to any particular function may come at the expense of reducing the number of pins allocated to a second function , thereby reducing its available bandwidth . the general rules are simple . the total number of pins allocated cannot exceed the maximum number available . a minimum number of pins must allocated to some functions to enable them . finally , the addition of the pins to the minimum number required for a function such as debug , trigger , real - time data exchange or trace increases the communication bandwidth for the function . the addition of emulation peripherals to a production chip requires gates and in some cases pins . only the importing or exporting information to debug and trace facilities external to the production chip generate pin requirements . since adding pins and gates to production chips can adversely affect system cost , the new paradigm must be scalable . “ pay only for what you need ” must be the message to customers . delivering a debug / emulation tools library must be accompanied by a means to evaluate its capabilities and make the decisions as to its cost / benefits . gates and pins are not free , just more affordable than they have been in the past . in the configurable debug paradigm , effective use of gates and pins is a must . flexible combinations of emulation peripherals provide a cost containment mechanism for gate consumption while an efficient pin reuse strategy offers cost containment for pin consumption . since there are different debug needs during a product development cycle , the gates and pins dedicated to debug can in many cases be reconfigured at run - time to best address the debug function needed at the moment . this model boosts the return on investment of debug related expenditures . for instance , debug and trace pins are viewed as a single pool of pins that are allocated at run - time . most pins can be assigned one or more different debug functions during a debug session . a single pin could be assigned trace , trigger , communication , or other functionality at any one time . generally all pins that are not assigned to another function are assigned to trace as this maximizes the available trace bandwidth . the reconfiguration theme is also followed with debug gates , with many on - chip modules capable of delivering several functions . in this case the on - chip modules are also configured at run - time . this model does not preclude fixed pin or module functions . [ 0096 ] fig4 illustrates the final trace output stages . trace export 240 includes trace packet build 242 , first - in - first - out ( fifo ) buffer 246 and transmission formatter 248 . pin manager and pin macros 260 includes pin manager 261 and pin macros 262 . as illustrated in fig4 trace packet built 242 and the input stage to fifo buffer 246 are clocked by cpu_clk , which is employed by cpu core 201 . the output stage of fifo buffer 246 as well as transmission formatter 248 , pin manager 261 and pin macros 262 are optionally clocked by either cpu_clk or by a different clock signal from transmission clock generator 245 ( called local oscillator 245 in fig3 ). transmission clock generator 245 is generic to all instruction set architectures ( isas ) and reused of the implementation is expected . fifo buffer 246 is either : asynchronous to cpu_clk clock ; synchronous to cpu_clk ; or not needed . when fifo buffer 246 is asynchronous to cpu_clk , the trace port is fixed or variable width and the transmission is at a rate other than cpu_clk . during asynchronous operation , the input interface of fifo buffer 246 operates with at the cpu_clk and the output interface of fifo buffer 246 operates at the transmission clock of transmission clock generator 245 . fifo buffer 246 operates as an asynchronous fifo buffer between trace packet build 242 and transmission formatter 248 . when fifo buffer 246 is synchronous to cpu_clk , the trace port is fixed or variable width and the transmission is at the rate of cpu_clk . synchronous operation is similar to asynchronous operation , only the transmission clock and functional clock ( cpu_clk ) are the same . a trace packet and port width mismatch requires fifo buffer 246 between trace packet build 242 and transmission formatter 248 to act as a synchronous fifo buffer . fifo buffer 246 is not needed when the trace port is fixed at 10 bits and the transmission is at the rate of cpu_clk . local oscillator 245 is deployed to optimize the transmission rate of the trace port . local oscillator 245 allows the trace port clock to be generated at the maximum trace port rate independent of the processor clock rate , there by maximizing the trace port bandwidth . local oscillator 245 provides : clock generation in a range of 125 mhz to 250 mhz or higher over the manufacturing process ; measurement of the oscillator clock ock frequency ; measurement of the functional clock fck frequency ; creation of the oscillator clock ock using either functional clock fck or reference clock tck as a reference ; calibration of local oscillator 245 for setup purposes ; and functional testing of local oscillator 245 . local oscillator 245 is a pseudo digital frequency synthesizer ( pdfs ). the local oscillator clock ock is created from a ring oscillator where the length of the ring is varied to change the frequency . the practical range of the local oscillator clock ock is set by the ring oscillator minimum and maximum frequencies . the ring oscillator frequency range is set to deliver a 125 mhz to 250 mhz or higher clock over the entire manufacturing process . scale factors that require the generation of a local oscillator clock ock frequency less than the lowest ring oscillator frequency create the lowest ring oscillator frequency . scale factors that require the generation of a local oscillator clock ock frequency less than the fastest ring oscillator minimum frequency create the fastest ring oscillator frequency . scale factors requesting the generation a frequency between the ring oscillator maximum and minimum local oscillator frequencies generate a local oscillator clock ock at or near the requested frequency . since the ring oscillator delay line has finite increments , the oscillator frequency generation increases or decreases in discrete steps that can vary the period of the local oscillator clock ock approximately two nand gate delays or about 60 to 200 picoseconds depending on the process node . this is equivalent to between 1 . 5 and 3 % at roughly 200 mhz . when the oscillator circuit has locked to the reference , it will seek between two discrete frequencies that vary in period by the delay introduced by one variable delay line element . this is extremely attractive as it distributes trace port emi / rfi between two different frequencies . there is no requirement to maintain phase relationship between the reference clock and the oscillator clock . local oscillator 300 , shown in fig6 includes three separate sections : clock scaling 301 ; ring oscillator control 303 ; and ring oscillator 305 . these elements are all controlled by local oscillator control register 307 in a manner that will be described below . as illustrated in fig5 local oscillator 300 adjusts frequency using one to four fixed delays and a variable delay . this will be explained below . [ 0103 ] fig7 illustrates clock scaling 301 in detail . clock scaling 301 sets the ratio of the selected reference clock and oscillator clock ock . it contains two pre - scaling sections , the reference clock pre - scaler 410 and the oscillator clock pre - scaler 420 . in normal modes , either test clock tck or functional clock fck is selected by reference clock select 411 to drive reference clock pre - scaler 410 while oscillator clock ock is selected by oscillator clock select 421 to drive oscillator clock pre - scaler 420 . when the frequency requested is within the oscillator range , ock locks to the reference and the output frequency of the two pre - scalers is virtually the same . when an out of range frequency is requested , ock becomes either the lowest or highest oscillator frequency . in this case reference and oscillator pre - scaler outputs do not converge and are never virtually the same . ring control 303 determines whether the reference or oscillator input is running a higher frequency and makes the adjustments necessary to add or subtract delay stages in the ring oscillator 305 . ring control 303 compares the number of edges generated by reference pre - scalar output rpso and oscillator pre - scaler output opso . when reference clock pre - scaler 410 generates edges at a higher rate than oscillator clock pre - scaler 420 , the oscillator frequency is raised . when oscillator clock pre - scaler 420 generates edges at a higher rate than reference clock pre - scaler 410 , the oscillator frequency is lowered . ring control 303 adjusts the length of the ring oscillator delay chain to cause a change in the oscillator frequency . ring oscillator 305 is a combination of a fixed delay line and a variable length delay line that is fed back on itself with an inversion . the fixed delay establishes the maximum oscillator frequency as shown in fig5 while the variable delay provides lowering the oscillator from the maximum . there are four sections of fixed delay . they can be added in series to create one of four fixed delays , as shown in fig5 . fixed delay sections that are not included in the ring delay are disabled so they do not consume power . debugger application program 110 uses the calibration capabilities of the local oscillator ascertain the delay value of each of the fixed sections . it then chooses the combination the fixed delays that when added to half the variable delay , creates an oscillator clock that is closest to the desired frequency . this creates the maximum dynamic range for the oscillator thereby giving it the most immunity from temperature and voltage variations . one of four fixed delay combinations can be chosen to establish the maximum frequency . the variable delay section provides a delay twice that of a fixed delay section . ring control 303 sets the variable delay line length using the criteria discussed previously . ring oscillator 305 must be calibrated before the fixed delay option is chosen . debugger application program 110 establishes the fixed and variable delay values using calibration capabilities built into the local oscillator . this calibration information is then used to choose a fixed delay for normal operation . calibration involves counting the number of oscillator clocks ( ock ) or functional clocks ( fck ) that occur within a measurement period defined by a preset number of test clocks ( tck ). the measurement period is a window created by a number of test clocks between 8 * n where n ranges from 1 to 256 , i . e . the clock number ranges from 8 to 2048 . using this measurement requires a minimum tck frequency of 1 mhz . the fixed delay selection and calibration modes are controlled through local oscillator control register losc_cntl 307 . local oscillator control register 307 stored data decoded as defined in tables 2 and 3 . these define the characteristics of the local oscillator . local oscillator control register 307 sets the reference clock pre - scaling , the oscillator clock pre - scaling and the operating modes of calibration , test , and normal . this register is part of the trace port register set and is preferably addresses at base address plus three of the trace port register set . the eight bits of the oscale field corresponding to bits 8 to 15 of local oscillator control register 307 define the local oscillator pre - scale divide factor . the eight bits define a divide ratio of 1 to 256 as shown in table 2 . the three bits of the rscale field corresponding to bits 5 to 7 of local oscillator control register 307 define the reference oscillator pre - scale divide factor . the three bits define a ration of 2 , 4 , 8 to 256 as shown in table 2 . the two bits of the fixed field corresponding to bits 3 and 4 of local oscillator control register 307 define the number of fixed delays used by ring oscillator 305 . these two bits select one , two , three or all four fixed delay elements as shown in table 2 . where : n is an integer that can range from 1 to 256 as selected by the oscale field ; m is an integer that can range from 0 to 7 and selected by the rscale field ; and rck is the reference clock either test clock tck or functional clock fck as selected by reference clock select 411 . the outputs of reference clock pre - scaler 410 and oscillator clock pre - scaler 420 supply ring control 303 to determine local oscillator frequency adjusts . dynamically changing one or both of these values while the oscillator is active can cause the period of the oscillator to change no more than attributable to one delay element ( 1 to 2 % maximum before the change takes effect ). the fixed field selects the lumped delay of ring oscillator 305 . this field cannot be dynamically changed while the local oscillator is running . the omode [ 2 : 0 ] field corresponding to bits 0 to 2 of local oscillator control register 307 determines the clock inputs to reference clock pre - scaler 410 and oscillator clock pre - scaler 420 as shown in table 3 . this field also determines whether the pre - scalers 410 and 420 operate in calibration , test , or normal modes . this field cannot be changed dynamically while the oscillator is running in normal modes except for selecting the reference clock following initialization by moving between state 000 and state 001 or moving between state 000 and state 010 . [ 0114 ] fig7 illustrates clock scaling 301 . there are two major sections , the reference clock pre - scaler 410 and the oscillator clock pre - scaler 420 . in normal operation the two sections operate separately to generate scaled versions of reference and oscillator clocks . these scaled clocks are sent to the ring control 303 for processing . the clock circuit has 3 normal modes and 2 test modes . the three normal modes are : local oscillator output disabled ; local oscillator output generated based on test clock tck reference ; and local oscillator output generated based on function clock fck reference . the test modes are : local oscillator clock ock input to both reference and oscillator pre - scaling sections ; and frequency measurement mode . clock scaling 301 includes a 3 - bit ripple pre - scaler 413 on the input of the reference clock channel and a 3 - bit ripple pre - scaler 425 on the input of the oscillator clock channel . reference channel 3 - bit pre - scaler 413 is followed by 8 - bit ripple counter 415 . oscillator channel 3 - bit pre - scaler 425 is followed by 8 - bit ripple counter 427 . the respective 3 - bit pre - scalers 413 and 425 reduce the input clock rate to a frequency that is easily manageable . the length of the pre - scalers is chosen to support test clock tck reference frequencies as low as 1 mhz . oscillator 3 - bit pre - scaler 425 creates ripple counter clock and load functions roughly four input clocks apart . in normal mode 000 selected by he omode field , pre - enable decode 423 clears all pre - scaler stages ( 413 , 415 , 425 , 427 , 429 ) to zero . when oscillator clock pre - scaler 425 reaches an all ones count , ripple counter 427 is loaded with the oscale value prior to the next count directive . oscillator clock pre - scaler 425 provides its count and load signals by approximately four input clocks enabling this load . the normal modes either disable local oscillator 245 or create a local oscillator output that based on either function clock fck or test clock tck . these modes encompass omode codes 000 , 001 , and 010 . the test modes provide for the testing of local oscillator 245 , causing ock to source both the reference clock pre - scalar 410 and oscillator clock pre - scaler 420 . clock scaling 301 is functionally tested in this mode by manipulating the multiplier portion of the frequency synthesis equation . when the omode field is 000 , the local oscillator circuits are initialized . initialization asynchronously clears the reference clock pre - scaler 410 and oscillator clock pre - scalar 420 , asynchronously clears the variable delay line element pointer , and turns ring oscillator 305 off . local oscillator 245 is completely disabled in this mode . when the omode field is set to 001 or 010 , local oscillator 245 begins normal clock generation . the input to reference clock pre - scaler scaler 410 is set to test clock tck if omode is 001 and set to function clock fck if omode is 010 . in either case the input to oscillator clock pre - scaler 420 set to ock . ring control 303 is released to operate and ock is enabled . at some point afterward , the circuit reaches equilibrium with ock the specified multiple of the selected reference . when the omode field is 011 , ock drives both the reference clock pre - scaler 410 and oscillator clock pre - scaler 420 . the pre - scalers are tested in this mode . when the 2 *( n / 2 ( 7 − m ) ) portion of the reference equation resolves to 1 , the outputs of reference clock pre - scaler 410 and oscillator clock pre - scaler 420 virtually match . in this case ring control 303 does not alter the delay setting more than one delay from its initial setting since the equilibrium condition is reached . this equilibrium condition occurs because the pre - scalers are driven from the same clock . in this case , the delay element position remains constant or oscillates by one . this can be used to assure each bit of both pre - scalers is functional . if the equation resolves to & gt ; 1 , ring control 303 continuously requests the oscillator to speed up . conversely , if the equation resolves to & lt ; 1 , ring control 303 directs the oscillator to continuously slow down . in both of these cases ock is changed but the attempt to reach equilibrium are futile as both the pre - scalers are driven from ock . the results of these operations can be observed by reading local oscillator control register 307 and observing the delay selection field . this mechanism provides a test mechanism for of each bit of both pre - scalers . when omode is set 100 to 111 , local oscillator 245 operates in calibration mode . an omode code of 100 clears reference clock pre - scaler 410 and oscillator clock pre - scalar 420 , and clears a state machine that monitors the relationship between the reference clock pre - scaler 410 and oscillator clock pre - scaler 420 outputs without altering the variable delay setting . codes 101 to 111 enable reference clock pre - scaler 410 and oscillator clock pre - scaler 420 to count . when oscillator clock pre - scaler 420 count reaches all ones , the counts of reference clock pre - scaler 410 and oscillator clock pre - scaler 420 are frozen . they remain frozen until a code is applied other than 101 to 111 . when the freeze happens , ring control 303 either lengthens or shortens the variable delay and waits for the pre - scalers to be cleared and the clear removed before reapplying pre - scaler clocks . the omode setting is applied to local oscillator 245 in sufficient time before clocks are enabled so that the circuit operates properly . code 101 measures functional clock fck . code 110 measures oscillator clock ock frequency and shortens the variable delay line thus increasing the oscillator clock ock frequency after the measurement is taken . code 111 measures oscillator clock ock frequency and lengthens the variable delay line decreasing the oscillator ock frequency after the measurement is taken . a typical omode code application sequence for calibration is as follows : read control register until 8 duplicate values other than zero to ascertain completion read control register until 8 duplicate values other than zero to ascertain completion read control register until 8 duplicate values other than zero to ascertain completion read control register until 8 duplicate values other than zero to ascertain completion read control register until 8 duplicate values other than zero to ascertain completion a similar sequence can be used to measure the oscillator clock ock frequency from slowest to fastest by starting from the end of the last sequence . in this case , the second omode code is 110 , which decreases the variable delay each cycle . the reference clock pre - scaler 410 , shown in the upper half of fig7 is simply an 11 - bit ripple counter . it is divided into 3 - bit pre - scaler 413 and 8 bit ripple counter 415 . both 3 - bit pre - scaler 413 and 8 bit ripple counter 415 are cleared when the pre - enable signal pre_ena is a zero . the output of each stage of 8 bit ripple counter 415 ( rps [ 0 ] to rps [ 7 ]) is output to multiplexer 417 . multiplexer 417 selects one of these outputs rps [ 0 ] to rps [ 7 ] as the reference pre - scaler output ( rpso ) according to the value of the rscale field of local oscillator control register 307 . this allows reference clock pre - scaler 410 to vary the reference pre - scaler output by 8 * 2 ( 7 − m ) , where m can range from 0 to 7 . oscillator clock pre - scalar 420 is slightly more complex than reference clock pre - scalar 410 . oscillator clock pre - scaler 420 has a reloadable 8 bit ripple counter 427 along with 3 - bit pre - scaler 425 . the clock input of 8 bit ripple counter 427 is fed by 3 - bit pre - scaler 425 . the least two significant bits of 3 - bit pre - scaler 425 are preferably gray coded . ring control 303 enables the reference clock pre - scaler 410 and oscillator clock pre - scaler 420 clocks via a clock enable signal ckena . these clocks are enabled asynchronously . once a pre - scaler clock is enabled the corresponding pre - scaler begins to advance . ring control 303 starts ring oscillator 305 at its fastest frequency after pre_ena is are all ones . after pre - enable decoder 423 releases pre_ena , 8 - bit ripple counter 427 is loaded with the local oscillator scale value ( oscale [ 7 : 0 ]). following this load 8 bit ripple counter 427 has the correct value and is ready to count . the 8 bit ripple counter 427 begins to count when the most significant bit of 3 - bit pre - scaler 425 goes to one and then to zero . the 8 bit ripple counter 427 reloads following count to all 0 &# 39 ; s . this continues indefinitely unless calibration mode is specified . ring control 303 does not treat the opso and rpso inputs the same . ring control 303 processes positive edges on the opso and both edges on the rpso . this gives the opso an extra divide by two . toggle flip - flop 429 at the output oscillator clock pre - scaler 420 provides another divide by two . table 4 lists the total count implemented for various inputs of rscale and oscale . when local oscillator 245 is operating in functional modes , rpso and opso control the oscillator rate . if opso has two rising edges before the rpso has either a falling or rising edge , ring control 303 directs ring oscillator 305 slow down . if rpso has rising and falling ( or falling and rising ) edges before opso has a rising edge , ring control 303 directs ring oscillator 305 to speed up . [ 0152 ] fig8 illustrates the details of ring control 303 . ring control 303 includes input multiplexer 501 , 3 - stage synchronizer 503 , edge detector 505 , 3 - stage synchronizer 513 , edge detector 515 and frequency comparison state machine 520 . ring control 303 has two operating modes , a first mode for normal and test operation and a second mode for calibration selected by the most significant bit of the omode field ( see table 3 ). in normal / test operation , ring control 303 receives the oscillator pre - scaler output opso and reference pre - scaler output rpso from the clock scaling 301 . input multiplexer 501 selects the reference pre - scaler output rpso . the pre - scaler enable signal pre_ena clears 3 - stage synchronizer 503 . similarly , the local oscillator enable signal losc_ena clears 3 - stage synchronizer 513 . edge detector 505 detects both the rising and falling edges of its input from 3 - stage synchronizer 503 . edge detector 515 detects only rising edges of its input from 3 - stage synchronizer 513 . ring control 303 compares the rate to the rpso and opso inputs in frequency comparison state machine 520 to determine which is faster . frequency comparison state machine 520 compares the rate of rising edges on opso to the rate of rising and falling edges on rpso . ring control 303 adjusts the oscillator frequency to make the opso rate twice the rate of rpso . ring control 303 directs ring oscillator 305 to add more or less delay in the ring . there are separate directives for even and odd delay element cells . thus frequency comparison state machine 520 has four output signals : more delay even element signal more_e ; more delay odd element signal more_o ; less delay odd element signal less_o ; and less delay even element signal less_e . this allows the storage elements determining the ring length to act similar to master - slave flip - flops , with even cells and odd cells being updated by different clocks . when the ring delay is lengthened on consecutive adjustments , the more_e and more_o signals alternate . when the ring delay is shortened on consecutive adjustments , the less_e and less_o signals alternate . when the ring delay is lengthened and then shortened or shortened and lengthened on consecutive adjustments , the adjustments are made with both targeting even cells or both targeting odd cells . in calibration mode , the control register can be used to step the ring oscillator adjustments up or down . in this mode , input multiplexer 501 selects the pre - scaler enable signal pre_ena . the pre - scaler enable signal pre_ena is used to signal ring control 303 that calibration is enabled . a calibration sequence starts with the initialization of the local oscillator . this clears reference clock pre - scaler 410 , and loads the oscillator clock pre - scaler 420 . the pre - scaler clocks are enabled when pre - scale enable signal pre_ena becomes 1 . pre - scalers 410 and 420 count until oscillator clock pre - scaler 420 reaches all ones . at this point the clocks to both the reference and oscillator pre - scalers are shut off . this sets the opso a one . this one is detected by the ring control 303 . ring control 303 then waits until software reads the reference pre - scaler value . after the read , reference clock pre - scaler 410 and oscillator clock pre - scaler 420 are initialized again when pre - scaler enable signal pre_ena becomes 0 . this is achieved by writing to local oscillator control register 307 to set the omode to 100 followed by another write to set the omode field to another calibration mode ( 101 , 110 or 111 ). ring control 303 detects this action by detecting an opso value of zero and a pre - scaler enable signal pre_ena value of one . at this point , ring control 303 uses the least significant bit of the omode field , bit 0 , to determine whether to increase or decrease the ring delay ( see table 3 ). after adjusting the ring delay , the ring control 303 turns on the pre - scaler clocks and a new calibration cycle begins . when local oscillator 245 is initialized with local oscillator enable signal losc_ena as 0 , the more_e and more_o signals are asserted simultaneously . this sets the ring delay to its maximum causing local oscillator 245 to begin from its slowest frequency as defined by the fixed delay selected and variable delay . [ 0155 ] fig9 illustrates the states of frequency comparison state machine 520 . these states are gray coded so that all state transitions change only a single bit in the state encoding . this frequency comparison state machine 520 manages ring oscillator 305 by controlling the variable delay line length . the frequency comparison state machine 520 operates in two modes as defined by the local oscillator control register 307 : a normal / test mode ; and a calibration mode . switching between these two modes is only permitted to an from when local oscillator enable signal losc_ena is 0 at the beginning or end of the mode change . there are three functions performed by frequency comparison state machine 520 in normal / test mode : wait for effects of update ; frequency comparison ; and position counter update . the wait states are states 0 , 1 , and 3 . frequency comparison machine 520 is asynchronously set to state 0 when local oscillator enable signal losc_ena is 0 . this state is just an initial delay state with no action during normal operation except waiting on the local oscillator enable signal losc_ena . when local oscillator enable signal losc_ena is set to 1 , frequency comparison state machine 520 moves from state 0 to state 1 . in states 1 and 3 , frequency comparison state machine 520 waits for an oscillator pre - scaler leading edge to proceed . when frequency comparison state machine 520 reaches state 1 , the position counter output is used to set the specified ring delay . frequency comparison state machine 520 remains in state 1 until an oscillator pre - scaler leading edge is detected . frequency comparison state machine 520 then moves to state 3 where it waits for a second oscillator pre - scaler leading edge . frequency comparison state machine 520 then proceeds to state 7 where it begins frequency comparison . the wait generated by state 1 and 3 are used to wait for the ring oscillator adjustments to take effect after a change in the ring delay . the frequency comparison states are 7 , 6 , and 5 . once an oscillator pre - scaler leading edge is detected in state three , frequency comparison state machine 520 progresses to state 7 . in this state , frequency comparison state machine 520 looks for the occurrence of a reference pre - scaler leading or trailing edge or oscillator pre - scaler leading edge without both being present . when a stand alone reference pre - scaler edge is detected , frequency comparison state machine 520 moves to state 5 . when a stand alone oscillator pre - scaler leading edge is detected , frequency comparison state machine 520 moves to state 6 . when no edge is detected , the state remains 7 . if an oscillator clock pre - scaler 420 leading edge is detected in state 5 before a reference clock pre - scaler 410 edge , frequency comparison state machine 520 moves back to state 7 . if a reference clock pre - scaler 410 edge is detected first or coincident with an oscillator clock pre - scaler 420 leading edge , frequency comparison state machine 520 has determined that the oscillator frequency is too low and it moves to state 4 . the state activity in state 6 mirrors that of state 5 . if a reference pre - scaler edge is detected in state 6 before an oscillator pre - scaler positive edge , frequency comparison state machine 520 moves back to state 7 . if an oscillator pre - scaler positive edge is detected first or coincident with a reference pre - scaler edge , frequency comparison state machine 520 has determined that the oscillator frequency is too high and it moves to state 2 . frequency comparison state machine 520 states 4 and 2 adjust ring oscillator 305 delay . when frequency comparison state machine 520 determines the oscillator frequency is too low , it moves to state 4 where the ring delay is decreased by subtracting ring delay . either the more_e signal or the more_o signal is generated depending on the last ring control command issued as shown in table 5 . when frequency comparison state machine 520 determines the oscillator frequency is too high , it moves to state 2 where the ring delay is increased by adding ring delay . table 5 lists the update signal sequence . the next clock moves frequency comparison state machine 520 to state 0 , a delay state which begins the wait for effects of update process . [ 0161 ] fig1 illustrates the structure of ring oscillator 305 . ring oscillator 305 generates the ring oscillator clock ock . ring oscillator 305 includes two sub - block types : glitch filter / fixed delay 610 ; and a number of delay elements 611 to 619 . there is only one glitch filter / fixed delay 610 but there can be as many delay elements 611 to 619 as necessary to create the frequency range required . [ 0162 ] fig1 illustrates the details of glitch filter / fixed delay 610 is shown in fig1 . glitch filter / fixed delay 610 includes glitch filter 701 , inverters 702 and 703 , fixed delays 711 , 712 , 713 and 714 , multiplexer 715 and output and gate 717 . local oscillator 245 is turned on when local oscillator enable signal losc_ena is 1 . ring oscillator signal ock is held high when local oscillator enable losc_ena is 0 by and gate 717 . supplying the local oscillator enable signal losc_ena to and gate 717 assures that runt clock pulses will be filtered out by glitch filter 701 . the output of glitch filter 701 is supplied to the chained inverters 702 and 703 . the output of inverter 702 supplies the cascade fixed delays 711 , 712 , 713 and 714 . multiplexer 715 selects the output of one of fixed delays 711 , 712 , 713 and 714 as determined by the fixed field of local oscillator control register 307 . this effectively selects one , two , three or four of the fixed delays as illustrated in fig5 . glitch filter 701 is designed to reliably reject glitches , that is pulses less than a predetermined length , created by changing delay variable delay line settings on the fly . a single delay element can be switched in or out at one time . frequency comparison state machine 520 limits the occurrence of delay adjustments to 6 clocks minimum . this assures that there is adequate time for the disconnected part of the variable delay to purge after a switch . as will be described below , generally only one element has to purge per clock . two delay elements 614 and 615 are shown in fig1 . delay element 614 is designated as odd and delay element 615 is designated as even . delay element 614 is controlled by the more_o and less_o ring control outputs while delay element 615 is controlled by the more_o and less_o ring control outputs . each delay element includes a pair of r - s latch control and gates ( 801 , 802 and 811 , 812 ), a r - s latch ( 803 and 813 ) and a set of ring length control and gates ( 804 , 805 , 806 and 814 , 815 , 816 ). with r - s latch 803 , 813 is a first state , and gate 804 , 814 passes a received propagate signal from the prior delay element to the next delay element via a propagate output . at the same time , and gate 805 , 815 blocks return of a received propagate signal via return output via and gate 806 , 816 . with r - s latch 803 , 813 in the second opposite state , and gate 805 , 815 passes a received propagate signal from the prior delay element to the prior delay element via a return output . at the same time , and gate 804 , 815 blocks further propagation of a received propagate signal . the number of delay elements included in the ring delay is controlled by a master - slave - like shift register mechanism built into each delay element . the control state of each element is stored locally in the r - s latch 803 , 813 . adjacent cells ( even and odd ) have different clocks updating these cells . this means adjacent the control state latches can be used like the front and back ends of a master - slave flip - flop . when the cells are connected together they form a left / right shift register . the alternating more_o and more_e signals cause the shift register to shift right one bit by enabling and gate 801 , 811 to pass the go input signal from the prior delay element to set r - s latch 803 , 813 . only half the cells are updated at any one time . a cell that was last updated with a right shift will contain the last 1 when the shift register structure is viewed from left to right . when the opposite set of cells is updated , a 1 is moved into the cell to the right of the cell that previously held the last 1 . this process continues as more_e and more_o are alternately generated . the circuit looks like a shift register that shifts right filling with 1 . alternating less_o and less_e signals cause the shift register to shift left one bit by enabling and gate 802 , 812 to pass the stop input signal from the next delay element to reset r - s latch 803 , 813 . again , only half the cells are updated at any one time . a cell that was last updated with a left shift will contain the last 0 when the shift register structure is viewed from right to left . when the opposite set of cells is updated , a 0 is moved into the cell to the left of the cell that previously held the last zero . this process continues as less_e and less_o are alternately generated . the circuit looks like a shift register that shifts left , filling with 0s . when a less directive follows a more directive , it will update the same set of delay elements as the more directive . when a more directive follows a less directive , it will update the same set of delay elements as the less directive . this is clearly shown in table 5 . this implementation efficiently employs area as each delay element consumes just 7 gates . it is also relatively easy to test with functional tests that measure the oscillator frequency . when the control state is a zero ( go ), the propagate out ( p_o ) signal to the next delay element is forced to a 1 . beginning from the glitch catcher and fixed delay block and proceeding through the elements , the first element with a control state ( go ) that is a 0 is the point where the delay element connects p_i to r_o . this bit defines the terminating delay element . all bits to the right of the bit defining the terminating element register bits would also be 0 , with these delay elements inactivated . the register can be any length necessary to implement the desired variable delay function . changing the length does not affect the local oscillator control register 307 definitions . table 6 shows an example variable delay with seven delay elements . when the local oscillator is disabled , the variable delay is set to maximum or + 7 . this is accomplished by making more_e and more_o active simultaneously . this creates a run through condition for the storage elements and is equivalent to holding master and slave both high in a master - slave flip - flop . this propagates a 1 to the control state of all storage elements . table 6 illustrates the state of the 6 delay element chain for various delay lengths . note that the left most 0 defines the last delay element currently employed . as illustrated in fig1 , the propagate output of the last delay element 619 is connected to its return input defining the longest delay . [ 0170 ] fig1 illustrates the various means for loading the clock control data into local oscillator control register 307 . local oscillator control register 307 may be memory mapped into the memory space of cpu core 201 and thus accessible via cpu bus 901 . alternatively , local oscillator clock control register 307 may be written into via indirect access register 921 . the data is written to indirect access register 921 from cpu bus 910 . indirect access register 921 passes the data to local oscillator control register 307 via private bus 923 . it is typical for indirect access register 921 to receive control data together with the data for local oscillator control register 307 . this may include routing data so that indirect access register 921 can service plural indirectly accessed registers . note that because the real time data exchange process can control all systems available to cpu core 201 , these data writes can be controlled external to target system 140 via real - time data exchange export 241 , which is preferably bi - directional . as a final alternative , local oscillator control register 307 may be loaded via a jtag serial scan system including scan - in line 931 and scan - out line 933 . any particular target system may use one , two or all these alternatives . in the preferred embodiment , oscillator 307 is loaded via indirect access register 921 which also provides indirect access to other control registers of the debug system .