cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
SHik1300
Observer
Observer
658 Views
Registered: ‎05-09-2020

system generator

Jump to solution

Hi

I want to build for loop with one Mcode block and one Counter block . This loop has to seperate first 10 bits after counter=1 ,second 10 bits after counter = 2 and .... .

I have used xl_slice statement for this reason . The code is : ( x as input bits and i as counter)

function y = start11(x,i)

 y = xl_slice(x,(i*10)-1,(i-1)*10);

but i have this error in sytem generator simulink:Error("start11.m"): line 2:27 the 3rd argument must be a constant

Numbers produced by Conter block are not constant .

What i have to do to solve this ?

Thanks !

 

 

1 Solution

Accepted Solutions
vkanchan
Xilinx Employee
Xilinx Employee
553 Views
Registered: ‎09-18-2018

Hi @SHik1300 ,

The Xl_slice function uses the constant value such that its value is known to realize the function.

This is why I think it is hard to realize this function by using a variable as an argument.

One way to overcome this is to write a HDL code that slices bits of input bus and import it through HDL black box.

View solution in original post

1 Reply
vkanchan
Xilinx Employee
Xilinx Employee
554 Views
Registered: ‎09-18-2018

Hi @SHik1300 ,

The Xl_slice function uses the constant value such that its value is known to realize the function.

This is why I think it is hard to realize this function by using a variable as an argument.

One way to overcome this is to write a HDL code that slices bits of input bus and import it through HDL black box.

View solution in original post