chipscopy.HardenedDebugPCIe

class chipscopy.api.hardened_pcie.HardenedDebugPCIe(pcie_tcf)[source]

API wrapper for the CPM6 PCIe core.

Provides access to register properties, LTSSM state trace, and graph visualization for PCIe controllers.

get_dot()[source]

Returns the PCIe LTSSM graph in DOT format.

Graph topology is derived from the server’s encoding file. States are colored: orange=current, green=visited, gray=unvisited. Edge labels show transition counts.

Return type:

str

Returns current link status as a dict.

Keys: speed, width, ltssm_state, link_info. Values are human-readable strings when encoding is available.

Return type:

Dict[str, Any]

get_plt()[source]

Renders the CPM6 Hardened Debug PCIe LTSSM graph as a matplotlib figure.

State node colors mirror the soft AXIS-PCIe convention:
  • orange – most-recently seen state (end of captured trace)

  • green – visited at least once during the trace

  • gray – not visited

The PCIe recovery path (L0→R.Lock→R.Cfg→R.Idle→L0, and the Gen3 equalization sub-path R.Lock→R.Eq→R.Speed→R.Lock) is drawn in blue so the hot path stands out at a glance — matching the blue-edge convention used by the soft AXIS-PCIe get_plt(). All other edges are black.

Visited edges are drawn thicker; unvisited edges are drawn thinner and lighter. Edge-transition counts appear as labels on each arrow; zero counts are suppressed for readability. A legend and the detected link speed/width are included in the figure.

Returns the matplotlib.pyplot module so the caller can do:

plt = pcie.get_plt()
plt.show()
# or: plt.savefig("ltssm.png", dpi=150, bbox_inches="tight")
get_properties()[source]

Get all properties including name and node props.

Return type:

Dict[str, Any]

get_property(property_name_list=None)[source]

Get values for specified properties, or all if none specified.

Return type:

Dict[str, Any]

get_raw_trace()[source]

Returns decoded per-word LTSSM trace data including durations.

Each entry is a dict with keys: raw, duration_us, prev_state, prev_state_code, curr_state, curr_state_code, overflow.

Return type:

List[Dict[str, Any]]

get_trace_data()[source]

Returns the raw hex word list from LTSSM trace memory.

Each entry is a hex string like “0x00012345”. Integer entries from the server are normalized to hex strings. This is the simplest raw dump – no decoding is performed.

Return type:

List[str]

get_trace_summary()[source]

Returns a structured summary of the current trace.

Keys: entry_count, unique_states, loop_count, current_state, link_info.

Return type:

Dict[str, Any]

Returns True if the PCIe link has reached L0 (trained).

LTSSM_STATE carries the raw state code rather than a name, so it is matched against every spelling of L0 the server may report: “0x11” from a register alias, “17” if it arrives as a decimal, and “l0” if a future encoding resolves it to a name.

Return type:

bool

print_trace()[source]

Prints the LTSSM state trace to console with formatted output.

Return type:

None

read_ltssm_trace()[source]

Read LTSSM trace memory and update properties. Same as refresh().

Return type:

None

refresh()[source]

Read the LTSSM trace memory and update internal properties.

Return type:

None

reset_core()[source]

Reset the LTSSM trace capture.

Disables LTSSM feature, zeros trace memory, re-enables capture, and clears all cached state/edge/trace properties.

Return type:

None

save_trace(path, fmt='json')[source]

Export trace data to a file.

Parameters:
  • path (str) – Output file path.

  • fmt (str) – Format – “json” for full decoded trace, “csv” for tabular.

Return type:

None