Circular Buffer Has New Data Circular Buffer Read navigation bar

Table of Contents

Circular Buffer Initialize

Initializes a circular buffer.

Library

QUARC Targets/Advanced/Asynchronous

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

qc_open_library('quarc_library/Advanced/Asynchronous')

Description

Circular Buffer Initialize

The Circular Buffer Initialize block creates and initializes a circular buffer. The circular buffer may be used to communicate between synchronous, or fixed sample rate, threads and asynchronous threads which have no sample rate. Like FIFO queues, circular buffers are identified by name. However, circular buffers are more general than FIFO queues. There may be any number of Circular Buffer Read, Circular Buffer Write or Circular Buffer Clear blocks in a model, all referring to the same circular buffer. Atomic access by each block to the circular buffer is guaranteed, so that the buffer may be accessed from multiple threads. Each Circular Buffer Initialize block defines a new circular buffer. The name of each circular buffer must be unique throughout the diagram.

To read from and write to a circular buffer, use the Circular Buffer Read and Circular Buffer Write blocks respectively. It is also possible to clear the contents of the circular buffer using the Circular Buffer Clear block.

The Circular Buffer Initialize block is typically used to create a circular buffer to communicate between the main diagram, which runs a fixed sample rate, and blocks inside the Function Call Subsystem attached to an Asynchronous Thread block, which have no associated sample rate. However, the Circular Buffer blocks may be used anywhere in the diagram. Also, any number of these blocks may be placed in the model, although it is more efficient to use fewer blocks.

The Circular Buffer Initialize block defines both the name and the size of the buffer. The size of the buffer is specified in bytes since it is actually possible to write multiple data types to a circular buffer. The number of bytes must be calculated based on the size of the data types which will be written to the circular buffer. For example, the data type typically used for signals in a Simulink model is the double. Each double occupies 8 bytes. Hence, a circular buffer of 8000 bytes is capable of storing 1000 doubles.

Input Ports

This block has no input ports.

Output Ports

This block has no output ports.

Data Type Support

Circular buffers may store any of the built-in Simulink datatypes, except fixed point.

Parameters and Dialog Box

Circular Buffer Initialize

Go to Circular Buffer blocks using this buffer

Opens a dialog that lists all the Circular Buffer blocks in the model which are currently using the same interface selected in the Buffer name parameter. The dialog may be used to go to another Circular Buffer block in the model just by double-clicking on the name of the block in the dialog box.

Buffer name

The name to assign to the circular buffer. This name will show up in the list of buffers in the other Circular Buffer blocks.

Size of the buffer in bytes

The size of the circular buffer in bytes. Be sure to account for the size of the data types that will be stored in the circular buffer when entering this parameter. For examples, a double value requires 8 bytes.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar