UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Adventurer
Adventurer
1,133 Views
Registered: ‎03-22-2018

Merging a MicroBlaze and a Image Processing IP Block

Hi,

 

I need some tips do implement a project: I need to connect a MicroBlaze processor to a Convolution IP Block that i've just implemented using HLS. There must be a Image stored in MicroBlaze and that image must be transfered to the IP Block, be processed and return to the MicroBlaze. 

 

Whats is the best way to do this? It's a single image that a need to send.

 

For now, that is the blocks I have:

BlockDesign.PNG

The Conv HLS code is the following:

#include "conv.h"

void conv(uint8_t image_in[rows*collums],uint8_t image_out[rows*collums]){
	#pragma HLS INTERFACE m_axi depth=1440000 port=image_out offset=slave bundle=CRTL_BUS
	#pragma HLS INTERFACE m_axi depth=1440000 port=image_in offset=slave bundle=CRTL_BUS
	#pragma HLS DATAFLOW
	#pragma HLS INTERFACE s_axilite port=return bundle=lite

   const char coefficients[3][3] = { {-1,-2,-1},
                                     { 0, 0, 0},
                                     { 1, 2, 1} };

   hls::Mat<collums,rows,HLS_8UC1> src;
   hls::Mat<collums,rows,HLS_8UC1> dst;

   hls::AXIM2Mat<rows,uint8_t,collums,rows,HLS_8UC1>(image_in,src);
   hls::Window<3,3,char> kernel;

   for (int i=0;i<3;i++){
      for (int j=0;j<3;j++){
         kernel.val[i][j]=coefficients[i][j];
      }
   }

   hls::Point_<int> anchor = hls::Point_<int>(-1,-1);
   hls::Filter2D(src,dst,kernel,anchor);
   hls::Mat2AXIM<rows,uint8_t,collums,rows,HLS_8UC1>(dst,image_out);
}
0 Kudos
7 Replies
Scholar hbucher
Scholar
1,105 Views
Registered: ‎03-22-2016

Re: Merging a MicroBlaze and a Image Processing IP Block

 @tiago0297 Create a block with BRAM or DDR. It will expose a slave port.

Then connect both MicroBlaze and Conv's master ports to it through an AXI interconnect. Connection automation should take care of this for you.

You also need to make s_axi_lite a slave of the Microblaze so you can start/stop/configure your block.

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
0 Kudos
Adventurer
Adventurer
1,099 Views
Registered: ‎03-22-2018

Re: Merging a MicroBlaze and a Image Processing IP Block

The image will be stored in the BRAM? How it's done?

 

When I do this, the MicroBlaze will be able to get it from the BRAM and send it to the Conv, then Conv will send it back to the BRAM?

0 Kudos
Scholar hbucher
Scholar
1,092 Views
Registered: ‎03-22-2016

Re: Merging a MicroBlaze and a Image Processing IP Block

@tiago0297 The way you set up, you have an AXI master. It will issue AXI read and then write commands to the interconnect and fetch the data for you. This is already done by HLS in your block.

Microblaze only has to configure the IP's slave offset and start the IP block using the SDK-provided API. 

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
0 Kudos
Adventurer
Adventurer
1,043 Views
Registered: ‎03-22-2018

Re: Merging a MicroBlaze and a Image Processing IP Block

Nice, I think I understood. But I still have some questions, i'm new to Vivado.

 

So the MicroBlaze will be in charge to get the image from the BRAM and send it to Conv. But my Image is a .jpeg file and I don't understood how can I load this file in the BRAM. How can I do this?

0 Kudos
Scholar hbucher
Scholar
1,038 Views
Registered: ‎03-22-2016

Re: Merging a MicroBlaze and a Image Processing IP Block

Microblaze will just fetch this image and decompress it in memory. Not sure if opencv is available for microblaze but if it does you can use cvloadimage. Otherwise I remember tinydnn comes with a header only jpeg/png reader. 

You can alternatively use "convert" on Linux to generate a raw file and then upload to Bram using XSCT 

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
0 Kudos
Adventurer
Adventurer
1,011 Views
Registered: ‎03-22-2018

Re: Merging a MicroBlaze and a Image Processing IP Block

I"m still confused about how I can initialize my memory with my image. What's the best way to do this? 

0 Kudos
Adventurer
Adventurer
987 Views
Registered: ‎03-22-2018

Re: Merging a MicroBlaze and a Image Processing IP Block

I've connected the MicroBlaze, the Conv IP Block and a BRAM. I'm attaching the pdf of my design. Now, I want to initialize my memory with a Image I have stored in my computer, then send this image to the Conv and get it back to the memory. Am I on the right way to do this?

 

I've tryied to use the Memory Configuration File Generator on Tools of the Vivado, selecting my image and asking it to generate a file for me. I'm a very beginner user, so I really don't know if it's the best way to generate a initialization file for my BRAM. Unfortunately, this didn't work for me because of the following error: [Writecfgmem 68-4] Bitstream at address 0x00000000 has size 385828 bytes which cannot fit in memory of size 2097152 bytes.

0 Kudos