MFC input and output macros

The C/C++ Language Extensions for Cell Broadband Engine architecture specification also defines a set of optional convenience macros to assist in accessing the SPU and MFC facilities available through the channel interface.

These macros, specified in spu_mfcio.h , can either be implemented as macros or as built-in functions within the compiler.

Table 1. MFC Input and Output Macros
Macro Description
Effective Address Utilities
mfc_ea2h(ea) Extract higher 32-bits from effective address
mfc_ea2l(ea) Extract lower 32-bits from effective address
mfc_hl2ea(high, low) Concatenate higher and lower 32-bits of an effective address
mfc_ceil128(value) Round up value to the next multiple of 128
DMA Commands
mfc_put(ls, ea, size, tag, tid, rid) Move data from local storage to effective address
mfc_putb(ls, ea, size, tag, tid, rid) Move data from local storage to effective address with barrier
mfc_putf(ls, ea, size, tag, tid, rid) Move data from local storage to effective address with fence
mfc_get(ls, ea, size, tag, tid, rid) Move data from effective address to local storage
mfc_getb(ls, ea, size, tag, tid, rid) Move data from effective address to local storage with barrier
mfc_getf(ls, ea, size, tag, tid, rid) Move data from effective address to local storage with fence
List DMA Commands
mfc_putl(ls, ea, list, list_size, tag, tid, rid) Move data from local storage to effective address using MFC list
mfc_putlb(ls, ea, list, list_size, tag, tid, rid) Move data from local storage to effective address using MFC list with barrier
mfc_putlf(ls, ea, list, list_size, tag, tid, rid) Move data from local storage to effective address listing MFC list with fence
mfc_getl(ls, ea, list, list_size, tag, tid, rid) Move data from effective address to local storage using MFC list
mfc_getlb(ls, ea, list, list_size, tag, tid, rid) Move data from effective address to local storage using MFC list with barrier
mfc_getlf(ls, ea, list, list_size, tag, tid, rid) Move data from effective address to local storage using MFC list with fence
Atomic Update Commands
mfc_getllar(ls, ea, tid, rid) Get lock line and create reservation
mfc_putllc(ls, ea, tid, rid) Put lock line if reservation for effective address exists
mfc_putlluc(ls, ea, tid, rid) Put lock line unconditional
mfc_putqlluc(ls, ea, tag, tid, rid) Put queued lock line unconditional
Synchronization Commands
mfc_sndsig(ls, ea, tag, tid, rid) Send signal
mfc_sndsigb(ls, ea, tag, tid, rid) Send signal with barrier
mfc_sndsigf(ls, ea, tag, tid, rid) Send signal with fence
mfc_barrier(tag) Enqueue mfc_barrier command into DMA queue
mfc_eieio(tag, tid, rid) Enqueue mfc_eieio command into DMA queue
mfc_sync(tag) Enqueue mfc_sync command into DMA queue
DMA Status
mfc_stat_ cmd_queue() Check number of available entries in MFC DMA queue
mfc_write_tag_mask(mask) Set tag mask to select tag groups to be included in query operation
mfc_read_tag_mask() Read tag mask indicating groups to be included in query operation
mfc_write_tag_update(ts) Request the tag status to be updated
mfc_write_tag_update_immediate() Request that tag status be updated immediately
mfc_write_tag_update_any() Request that tag status be updated when any tag groups complete
mfc_write_tag_update_all() Request that tag status be updated when all tag groups complete
mfc_stat_tag_update() Check availability of tag Update Request Status channel
mfc_read_tag_status() Wait for an updated tag status
mfc_read_tag_status_immediate() Wait for the updated tag status of any enabled group
mfc_read_tag_status_any() Wait for no outstanding operations for any enabled groups
mfc_read_tag_status_all() Wait for no outstanding operations for all enabled groups
mfc_stat_tag_status() Check availability of MFC_RdTagStat channel
mfc_read_list_stall_status() Read list DMA stall-and-notify status
mfc_stat_list_stall_status() Check availability of List DMA stall-and-notify status
mfc_write_list_stall_ack(tag) Acknowledge tag group containing stalled DMA list commands
mfc_read_atomic_status() Check availability of atomic command status
Multisource Synchronization Request
mfc_write_multi_src_sync_request() Request multisource synchronization
mfc_stat_multi_src_sync_request() Check status of multisource synchronization request
SPU Signal Notification
spu_read_signal1() Atomically read and clear Signal Notification 1 channel
spu_stat_signal1() Check if pending signals exist on Signal Notification 1 channel
spu_read_signal2() Atomically read and clear Signal Notification 2 channel
spu_stat_signal2() Check if pending signals exist on Signal Notification 2 channel
SPU Mailboxes
spu_read_in_mbox() Read next data entry in the SPU Inbound Mailbox
spu_stat_in_mbox() Get the number of data entries in the SPU Inbound Mailbox
spu_write_out_mbox(data) Send data to the SPU Outbound Mailbox
spu_stat_out_mbox() Get the available capacity of the SPU Outbound Mailbox
spu_write_out_intr_mbox(data) Send data to the SPU Outbound Interrupt Mailbox
spu_stat_out_intr_mbox() Get the available capacity of the SPU Outbound Interrupt Mailbox
SPU Decrementer
spu_read_decrementer() Read the current value of the decrementer
spu_write_decrementer(count) Load a value into the decrementer
SPU Events
spu_read_event_status() Read the event status or stall until status is available
spu_stat_event_status() Check availability of event status
spu_write_event_mask(mask) Select events to be monitored by event status
spu_write_event_ack(ack) Acknowledge events
spu_read_event_mask() Read Event Status Mask
SPU State Mangement
spu_read_machine_status() Read current SPU machine status
spu_write_srr0(srr0) Write to the SPU Save Restore Register 0
spu_read_srr0() Read the SPU Save Restore Register 0
To facilitate cooperative use of MFC tag ID's amongst multiple autonomous software components, a tag manager is provided. The functions provided by the tag manager are specified in Table 2.
Table 2. MFC Tag Manager Functions
Function Description
mfc_tag_reserve() Reserve a single tag for exclusive use
mfc_tag_release() Release a single tag from exclusive use
mfc_multi_tag_reserve() Reserve a sequential group of tags for exclusive use
mfc_multi_tag_release() Release a sequential group of tags from exclusive use