Ethan Link
Ethan Link

Reputation: 13

Microblaze How to use AXI Stream?

I have a microblaze instantiated with 16 stream interfaces with a custom IP attached to two. What is the correct header file or function to communicate over these interfaces in Vitis (Not HLS)?

Upvotes: 1

Views: 1935

Answers (1)

Fra93
Fra93

Reputation: 2082

Based on the full example that you can find here, I am going to provide a general idea:

  • Include the mb_interface.h in your C source
  • Use the putfsl and getfsl macros to write and read from the stream.

Such macros are wrapper around special assembly instructions that the microblaze will execute by writing the data on the axi stream interface. The ìd is the stream id. Here you can find all the possible functions and here you can explore the ISA.

#define putfsl(val, id)         asm volatile ("put\t%0,rfsl" stringify(id) :: "d" (val))

The fundamental issue is that

#include "mb_interface.h"

/*
 * Write 4 32-bit words.
 */
static void inline write_axis(volatile unsigned int *a)
{
    register int a0,  a1,  a2,  a3;

    a3  = a[3];  a1  = a[1];  a2  = a[2];  a0  = a[0];

    putfsl(a0,  0); putfsl(a1,  0); putfsl(a2,  0); putfsl(a3,  0);
}


int main()
{
    volatile unsigned int outbuffer[BUFFER_SIZE] = { 0x0, 0x1, 0x2, 0x3 }
    };

    /* Perform transfers */
    write_axis(outbuffer);

    return 0;
}

Upvotes: 2

Related Questions