0% found this document useful (0 votes)
16 views

TLM-1 Implementation

Uploaded by

rno68792
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

TLM-1 Implementation

Uploaded by

rno68792
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

‭TLM-1 Implementation: Key Points‬

‭2.3.1 Basics‬

‭●‬ ‭Transactions‬‭:‬
‭○‬ ‭Represent a unit of communication between components.‬
‭○‬ ‭Encapsulate data (e.g.,‬‭data‬‭,‬‭addr‬‭,‬‭kind‬‭), constraints,‬‭and‬
‭methods.‬
‭○‬ ‭Can be‬‭composed, decomposed, or extended‬‭for‬
‭higher-level or detailed models.‬

‭ .3.1.1 Transactions Example:‬


2
‭Example:‬
class simple_trans extends uvm_sequence_item;‬

rand data_t data;‬

rand addr_t addr;‬

rand enum {WRITE, READ} kind;‬

constraint c1 { addr < 16’h2000; }‬

endclass‬

‭2.3.1.2 Transaction-Level Communication:‬

‭‬ T
● ‭ LM Port‬‭: Defines methods (API) for communication.‬
‭●‬ ‭TLM Export‬‭: Supplies the implementation of the methods.‬
‭●‬ ‭Connection‬‭: Port connects to export, enabling modularity‬‭and‬
‭reuse.‬

‭2.3.1.3 Basic Communication Methods:‬

‭1.‬ ‭put()‬‭Method‬‭:‬
‭○‬ ‭Producer sends transactions to a consumer.‬

‭ xample:‬
E
put_port.put(t); // Producer calls put‬

task put(simple_trans t); // Consumer implements put‬

‭○‬ ‭Blocking operation until consumer finishes processing.‬

‭2.‬ ‭get()‬‭Method‬‭:‬

‭○‬ ‭Consumer requests transactions from a producer.‬


‭ xample:‬
E
get_port.get(t); // Consumer calls get‬

task get(output simple_trans t); // Producer‬

implements get‬

‭○‬ ‭Blocking operation until producer finishes providing data.‬

‭TLM Concepts:‬

‭‬ B
● ‭ locking‬‭: Operations like‬‭put()‬‭and‬‭get()‬‭halt until‬‭completed.‬
‭●‬ ‭Modularity‬‭: Components (producer/consumer) can be‬‭replaced or‬
‭reused easily.‬
‭●‬ ‭Independent Implementation‬‭: Producer and consumer‬‭operate‬
‭independently, connected by a well-defined interface.‬

‭2.3.1.4 Communicating Between Processes‬

‭●‬ U ‭ se‬‭uvm_tlm_fifo‬‭for independent communication between‬


‭producer and consumer.‬
‭●‬ ‭put()‬‭: Adds transaction to FIFO; blocks if FIFO is‬‭full, else returns‬
‭immediately.‬
‭●‬ ‭get()‬‭: Removes transaction from FIFO; blocks if empty,‬‭else‬
‭returns immediately.‬
‭●‬ ‭peek()‬‭: Returns a copy of the transaction without‬‭removing it. Two‬
‭consecutive peeks return the same transaction.‬

‭2.3.1.5 Blocking vs. Nonblocking‬

‭●‬ ‭Blocking calls‬‭(e.g.,‬‭put()‬‭,‬‭get()‬‭):‬


‭○‬ ‭Block execution until complete, consume simulation time.‬
‭●‬ ‭Nonblocking calls‬‭(e.g.,‬‭try_get()‬‭,‬‭try_peek()‬‭):‬
‭○‬ ‭Return immediately within the same delta cycle.‬

‭ xample:‬
E
if (get_port.try_get(t)) { // Do something with t }‬

‭2.3.1.6 Connecting Transaction-Level Components‬

‭●‬ ‭connect()‬‭method:‬
‭○‬ ‭Used in the‬‭parent environment‬‭to connect ports and‬
‭exports.‬
‭Example:‬

producer.blocking_put_port.connect(fifo.put_export);‬

get_consumer.get_port.connect(fifo.get_export);‬

‭2.3.1.7 Peer-to-Peer Connections‬

‭‬ P
● ‭ orts and exports are connected at the‬‭same level‬‭of hierarchy‬‭.‬
‭●‬ ‭Connections are defined in the‬‭parent's connect()‬‭method‬‭.‬

‭2.3.1.8 Port/Export Compatibility‬

‭●‬ ‭Compatibility checks‬‭ensure that:‬


‭○‬ ‭The‬‭export implements all methods‬‭required by the‬‭port.‬
‭○‬ ‭The‬‭transaction type parameter matches‬‭between port‬
‭and export.‬
‭●‬ ‭Example:‬
‭○‬ ‭A‬‭blocking_put_port‬‭can connect to‬‭blocking_put_export‬‭or‬
‭put_export‬‭.‬

‭2.3.2 Encapsulation and Hierarchy‬

‭●‬ T ‭ LM interfaces‬‭isolate components, enabling independent‬‭design‬


‭and connection.‬
‭●‬ ‭Smaller components can be grouped hierarchically into larger‬
‭components.‬
‭●‬ ‭Parent components expose interfaces of child components to‬
‭higher levels of the hierarchy.‬

‭2.3.2.1 Hierarchical Connections‬

‭ tandard peer-to-peer connections‬‭: Ports connect directly‬‭to exports.‬


S
‭Example:‬
gen.put_port.connect(fifo.put_export); // Connection‬

A‬

‭●‬ H
‭ ierarchical connections‬‭: Used for crossing boundaries‬‭in‬
‭complex designs.‬
‭ ort-to-Port‬‭: Imports a port to the outer component.‬
P
‭Example:‬
c.put_port.connect(put_port); // Connection C‬

‭ xport-to-Export‬‭: Exports an implementation upwards‬‭in the hierarchy.‬


E
‭Example:‬
put_export.connect(fifo.put_export); // Connection E‬

‭2.3.2.2 Connection Types Summary‬

‭Connection‬ ‭connect() Form‬ ‭Purpose‬


‭Type‬

‭ ort-to-Expo‬ c‭ omp1.port.connect(comp2.e‬ P
P ‭ eer-to-peer‬
‭rt‬ ‭xport);‬ ‭connection.‬

‭Port-to-Port‬ s‭ ubcomponent.port.connect(p‬ I‭mport port to a higher‬


‭ort);‬ ‭hierarchy.‬

‭ xport-to-Ex‬ ‭export.connect(subcomponen‬ E
E ‭ xport implementation‬
‭port‬ ‭t.export);‬ ‭upwards.‬

‭Key Notes‬

‭●‬ E ‭ very TLM connection‬‭resolves to a‬‭port connected‬‭to an‬


‭export‬‭.‬
‭●‬ ‭Port-to-Port and Export-to-Export‬‭connections bring‬‭interfaces‬
‭to hierarchical boundaries for access at higher levels.‬

‭2.3.3 Analysis Communication‬

‭●‬ U
‭ sed to‬‭distribute collected transactions‬‭(e.g., for‬‭scoreboards,‬
‭coverage).‬
‭●‬ A
‭ llows a‬‭monitor to produce a transaction stream‬
‭independently of the number of connected components.‬

‭2.3.3.1 Analysis Ports‬

‭●‬ ‭uvm_analysis_port‬‭:‬
‭○‬ ‭Specialized TLM port with a single‬‭write()‬‭function.‬
‭○‬ ‭Can connect to‬‭zero, one, or many analysis_exports‬‭.‬
‭○‬ ‭If nothing is connected,‬‭write()‬‭simply returns.‬
‭○‬ ‭Executes in‬‭same delta cycle‬‭, regardless of connections.‬

‭Example:‬

ap = new("analysis_port", this);‬

‭p.write(t); // Write transaction to connected‬


a
exports.‬

‭2.3.3.2 Analysis Exports‬

‭●‬ C
‭ onnected components must implement‬‭write()‬‭via‬
‭uvm_analysis_export‬‭.‬

‭ se‬‭uvm_subscriber‬‭for easier implementation of analysis‬


U
‭components.‬
‭Example:‬
class sub1 extends uvm_subscriber #(T);‬

function void write(T t);‬


// Perform operation‬

endfunction‬

endclass‬

‭●‬ ‭Connecting multiple exports‬‭:‬


‭○‬ ‭An‬‭analysis_port‬‭can connect to multiple subscribers.‬
‭○‬ ‭Each‬‭write()‬‭call passes the same transaction pointer.‬
‭○‬ ‭Subscribers must make local copies‬‭to avoid corruption.‬

‭Example:‬
g.ap.connect(s1.analysis_export);‬

‭.ap.connect(s2.analysis_export); // Connect to‬


g
multiple subscribers.‬

‭Additional Features‬

‭●‬ ‭uvm_analysis_fifo‬‭:‬
‭○‬ ‭Acts as a buffer with‬‭analysis_export‬‭.‬
‭○‬ ‭Ensures‬‭write()‬‭always succeeds immediately.‬
‭○‬ ‭Downstream components process transactions at their‬
‭convenience.‬

‭Key Notes‬

‭●‬ A ‭ nalysis ports allow seamless distribution of transactions to‬


‭multiple components.‬
‭●‬ ‭write()‬‭is‬‭non-blocking‬‭and completes immediately.‬
‭●‬ ‭Always make a‬‭local copy‬‭of the transaction in subscribers‬‭for‬
‭safe processing.‬

‭**********************************************************************************‬

You might also like