Skip to content

BSV utilities to bridge between simulator and unix host system

Notifications You must be signed in to change notification settings

CTSRD-CHERI/BlueUnixBridges

Repository files navigation

BlueUnixBridges

This repository provides a set of utilities to enable bluespec simulators to expose some of their I/O ports to their host systems via unix fifo or sockets (currently only fifos). It also provides some utility functions to enable writing host tools to communicate with simulators. See the examples for more details.

APIs

The BlueUnixBridges library provides a set of C and BSV functions. The C functions are prefixed by the initials of each word in the library name, bub, followed by one of fifo or socket, and then followed by the actual function name.

1. Unix fifos API

1.1. "Simulator" Bluespec SystemVerilog API

module mkUnixFifoSource #(String pathname) (Source #(t));
module mkUnixFifoSink #(String pathname) (Sink #(t))

1.2. "Host" C API

fifo_desc_t* bub_fifo_OpenAsProducer (char* pathname, size_t bytesize, encoder_t encoder);
fifo_desc_t* bub_fifo_OpenAsConsumer (char* pathname, size_t bytesize, decoder_t decoder);
fifo_desc_t* bub_fifo_OpenAsProducerConsumer (char* pathname, size_t bytesize, encoder_t encoder, decoder_t decoder);
bool bub_fifo_Consume (fifo_desc_t* desc, void* elemdest);
bool bub_fifo_Produce (fifo_desc_t* desc, void* elemsrc);
void bub_fifo_Close (fifo_desc_t* desc);

2. Future work

2.1. Socket bridges

2.2. more documentation

2.3. catch simulator termination and destroy unix fifos

About

BSV utilities to bridge between simulator and unix host system

Resources

Stars

Watchers

Forks

Packages

No packages published