# 1. C/C++ Portal¶

## 1.1. Connecting to Bluesim¶

BLUESIM_SOCKET_NAME

Controls the name of the socket used for connecting software and hardware simulated by bluesim.

## 1.2. Connecting to Xsim and Verilator¶

SOFTWARE_SOCKET_NAME

Controls the name of the socket used for connecting software and hardware simulated by xsim/verilator.

## 1.3. Automatically Programming the FPGA¶

Connectal application executables or shared objects contain the FPGA bitstream in the “fpgadata” section of the ELF file. When the application (or library) first tries to access the hardware, the Connectal library automatically programs the FGPA with the associated bitstream, unless noprogram is set to a non-zero value or environment variable NOPROGRAM is nonzero.

In the case of simulation hardware, the simulator is launched when the application first tries to access the hardware. This behavior is also suppressed by a nonzero value for either noprogram or NOPROGRAM.

int noprogram

If noprogram is set to a non-zero value, then the FPGA is not programmed automatically.

## 1.4. Tracing Simulation¶

DUMP_VCD

If set, directs the simulator to dump a VCD trace to the \$DUMP_VCD.

int simulator_dump_vcd

The application can enable VCD tracing by setting simulator_dump_vcd to 1. It takes the file name from simulator_vcd_name. DUMP_VCD overrides this variable.

const char *simulator_vcd_name;

Specifies the name of the vcd file. Defaults to “dump.vcd”. DUMP_VCD overrides this variable.

## 1.5. Zynq Clock Control¶

void setClockFrequency(int clkNum, long requestedFrequency, long *actualFrequency)

Changes the frequency of Zynq FPGA Clock clkNum to the closest frequency to requestedFrequency available from the PLL. If the actualFrequency pointer is non-null, stores the actual freqency before returning.

## 1.6. Portal Memory¶

int portalAlloc(size_t size, int cached)

Uses portalmem to allocate a region of size bytes.

On platforms that support non-cache-coherent I/O (e.g., zedboard), cached=0 indicates that the programmable logic will use a port to memory that is not snooped by the CPU’s caches. In this case, it is up to the allocation to flush or invalidate the CPU cache as needed, using portalCacheFlush().

Returns the file descriptor associated with the memory region.

void *portalMmap(int fd, size_t size)

Memory maps size bytes of the portal memory region indicated by fd.

Returns a pointer to memory on success or -1 on failure.

portalCacheFlush(int fd, void *__p, long size, int flush)

# 2. PortalPoller¶

class PortalPoller

Polls portals

PortalPoller::PortalPoller(int autostart = 1)

If autostart is 1, then invoke start() from registerInstance()

void PortalPoller::start();

Starts the poller. Called automatically from registerInstance() if autostart is 1.

void PortalPoller::stop();

Stops the poller.

int PortalPoller::timeout

The timeout value, in milliseconds, passed to :c:function:poll()

## 2.1. Deprecated Functions¶

void *portalExec(void *__x)
Polls the registered portals and invokes their callback handlers.()
void portalExec_start()
void portalExec_poll()