# US 2021/0232486 A1 · Synthesizing printf and scanf statements for generating debug messages in high-level synthesis (hls) code

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0232486 A1
- Document ID: US20210232486A1
- Status: Published application
- Kind: A1
- Application number: 17/123,924
- Filed: 2020-12-16
- Published: 2021-07-29
- Earliest claimed: 2020-01-28
- Assignees: Tata Consultancy Services Limited
- Applicants: Tata Consultancy Services Limited
- Inventors: Mahesh Damodar BARVE; Sunil Anant PURANIK; Manoj Karunakara NAMBIAR; Swapnil Shashikant RODI
- Web page: https://patentgrep.com/patent/US20210232486A1

## CPC

- G06F 11/261: {by simulating additional hardware, e.g. fault simulation}
- G06F 11/364: {tracing values on a bus}
- G06F 11/3648: {using additional hardware}
- G06F 11/3656: {using a specific debug interface}
- G06F 11/3698: Environments for analysis, debugging or testing of software
- G06F 13/28: using burst mode transfer, e.g. direct memory access {DMA}, cycle steal (G06F13/32 takes precedence)
- G06F 13/4282: {on a serial bus, e.g. I2C bus, SPI bus (on daisy chain buses G06F13/4247)}
- G06F 2213/0026: PCI express
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

High level synthesis (HLS) begins with high-level specification of a problem, where behavior is generally decoupled from e.g., clock-level timing. Programming code can be run and debugged during functional simulation using debugging techniques. However, it is not possible to understand execution flow of register transfer level instructions (RTL) generated during RTL debug. Conventionally, it is challenging and not possible due to nature of debugging techniques which ignore printf statements in code for invocation. Systems and methods of present disclosure synthesize printf and/or scanf statements for generating debug messages in HLS code, wherein printf and/or scanf statements is/are included before/after function(s) in sections comprising instructions in code and synthesized as a block during run-time which communicate with host system and debug messages are generated for display on screen. This enables traceability of the code execution on the screen and printf/scanf statements output can be observed without any challenges.

## Claims

### Claim 1

A processor implemented method, comprising:
obtaining, via one or more hardware processors, a machine programming language (MPL) code from a user, wherein the MPL code comprises at least one of one or more printf statements and one or more scanf statements for debugging the MPL code;
converting, via a synthesizable logic, the MPL code comprising the at least one of one or more printf statements and one or more scanf statements to register transfer language (RTL) instructions, wherein the RTL instructions comprises a logic; and
synthesizing, at run-time, at least one of one or more printf statements and one or more scanf statements by:
executing, via the one or more hardware processors, the logic, wherein the logic when executed interacts with a local field-programmable gate array (FPGA) memory and writes one or more debug messages on the local FPGA memory;
transmitting, via the one or more hardware processors, the one or more written debug messages to a Direct Memory Access (DMA) block;
transmitting, via the one or more hardware processors, the one or more written debug messages by the DMA block to a host memory based on an interaction of the DMA block with a controller; and
writing, via a device driver executed by the one or more hardware processors, the one or more transmitted debug messages to a file system, wherein an output file is generated that comprises the one or more debug messages, wherein a debug message reader reads the one or more debug messages and prints the one or more debug messages thereof, and wherein the printed one or more debug messages are indicative of (i) an execution flow of the (RTL) instructions at run-time, and (ii) one or more values associated with one or more parameters comprised in the (RTL) instructions.

### Claim 2 (depends on 1)

The processor implemented method of claim 1, wherein the one or more printf statements are one or more High-level synthesis (HLS) printf statements, and wherein the one or more scanf statements are one or more HLS scanf statements.

### Claim 3 (depends on 1)

The processor implemented method of claim 1, wherein the one or more printf statements and the one or more scanf statements are specified before or after at least one of (i) one or more functions and (ii) one or more sections having instructions comprised in the MPL code.

### Claim 4 (depends on 1)

The processor implemented method of claim 1, wherein the controller is a peripheral component interconnect express (PCI-e) hard macro controller.

### Claim 5 (depends on 1)

The processor implemented method of claim 1, wherein the one or more debug messages are written in a High-level synthesis (HLS) code.

### Claim 6

A system, comprising:
a memory storing instructions;
one or more communication interfaces;
one or more hardware processors coupled to the memory via the one or more communication interfaces, wherein the one or more hardware processors are configured by the instructions to:
obtain a machine programming language (MPL) code from a user, wherein the MPL code comprises at least one of one or more printf statements and one or more scanf statements for debugging the MPL code; and
a synthesizable logic that converts the MPL code comprising the at least one of one or more printf statements and one or more scanf statements to register transfer language (RTL) instructions, wherein the RTL instructions comprises a logic,
wherein the one or more hardware processors synthesize, at run-time, the at least one of one or more printf statements and one or more scanf statements by:
executing, the logic, wherein the logic when executed interacts with a local field-programmable gate array (FPGA) memory and writes one or more debug messages on the local FPGA memory;
transmitting the one or more written debug messages to a Direct Memory Access (DMA) block;
transmitting the one or more written debug messages by the DMA block to a host memory based on an interaction of the DMA block with a controller; and
writing, via a device driver executed by the one or more hardware processors, the one or more transmitted debug messages to a file system, wherein an output file is generated that comprises the one or more debug messages, and wherein a debug message reader comprised in the system reads the one or more debug messages and prints the one or more debug messages thereof at run time, and wherein the printed one or more debug messages are indicative of (i) an execution flow of the (RTL) instructions at run time, and (ii) one or more values associated with one or more parameters comprised in the (RTL) instructions.

### Claim 7 (depends on 6)

The system of claim 6, wherein the one or more printf statements are one or more High-level synthesis (HLS) printf statements, and wherein the one or more scanf statements are one or more High-level synthesis (HLS) scanf statements.

### Claim 8 (depends on 6)

The system of claim 6, wherein the one or more printf statements and the one or more scanf statements are specified before or after at least one of (i) one or more functions and (ii) one or more sections having instructions comprised in the MPL code.

### Claim 9 (depends on 6)

The system of claim 6, wherein the controller is a peripheral component interconnect express (PCI-e) hard macro controller.

### Claim 10 (depends on 6)

The system of claim 6, wherein the one or more debug messages are written in a High-level synthesis (HLS) code.

### Claim 11

One or more non-transitory machine-readable information storage mediums comprising one or more instructions which when executed by one or more hardware processors cause synthesizing printf statements for generating debug messages in High-Level Synthesis (HLS) code by:
obtaining, via the one or more hardware processors, a machine programming language (MPL) code from a user, wherein the MPL code comprises the at least one of one or more printf statements and one or more scanf statements for debugging the MPL code;
converting, via a synthesizable logic, the MPL code comprising the at least one of one or more printf statements and one or more scanf statements to register transfer language (RTL) instructions, wherein the RTL instructions comprises a logic; and
synthesizing, at run-time, the at least one of one or more printf statements and one or more scanf statements by:
executing, via the one or more hardware processors, the logic, wherein the logic when executed interacts with a local field-programmable gate array (FPGA) memory and writes one or more debug messages on the local FPGA memory;
transmitting, via the one or more hardware processors, the one or more written debug messages to a Direct Memory Access (DMA) block;
transmitting, via the one or more hardware processors, the one or more written debug messages by the DMA block to a host memory based on an interaction of the DMA block with a controller; and
writing, via a device driver executed by the one or more hardware processors, the one or more transmitted debug messages to a file system, wherein an output file is generated that comprises the one or more debug messages, wherein a debug message reader reads the one or more debug messages and prints the one or more debug messages thereof, and wherein the printed one or more debug messages are indicative of (i) an execution flow of the (RTL) instructions, and (ii) one or more values associated with one or more parameters comprised in the (RTL) instructions.

### Claim 12 (depends on 11)

The one or more non-transitory machine-readable information storage mediums of claim 11, wherein the one or more printf statements are one or more High-level synthesis (HLS) printf statements, and wherein the one or more scanf statements are one or more HLS scanf statements.

### Claim 13 (depends on 11)

The one or more non-transitory machine-readable information storage mediums of claim 11, wherein the one or more printf statements and the one or more scanf statements are specified before or after at least one of (i) one or more functions and (ii) one or more sections having instructions comprised in the MPL code.

### Claim 14 (depends on 11)

The one or more non-transitory machine-readable information storage mediums of claim 11, wherein the controller is a peripheral component interconnect express (PCI-e) hard macro controller.

### Claim 15 (depends on 11)

The one or more non-transitory machine-readable information storage mediums of claim 11, wherein the one or more debug messages are written in a High-level synthesis (HLS) code.
