cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Diwen
Visitor
Visitor
342 Views
Registered: ‎01-23-2021

Set axi master address through instruction set

Greetings,

I am still quite new to HLS and I still not sure how to use HLS in correct way. So, suppose I want to create custom IP that can be controlled through custom instruction set. For example, my instruction set will have width of 128-bit with the offset as following:

bit 31-0 : DDR addr 1

bit 63-32 : DDR addr 2

bit 95-64 : DDR addr 3

bit 127-96 : parameter A

How should I write my top level function? What I have tried for now is something like this:

void Top_Level(DataA_t* dataA, DataB_t* dataB, DataC_t* dataC, ap_uint<128>* instruction, int num_Of_Instruction)
{
	// DataA_t* dataA is axi master port for dataA
	// DataB_t* dataB is axi master port for dataB
	// DataC_t* dataC is axi master port for dataC
	// Instruction_t* instruction is axi master port for instructions
	// int num_Of_Instruction is axi lite port for specifying total number of instruction that will be given to

	/* Burst Read the instruction from DDR and store in BRAM */
	ap_uint<128> bramInstruction[MAX];
	for (int i = 0; i < num_Of_Instruction; i++) {
		bramInstruction[i] = instruction[i];
	}

	/* Main loop that execute all of the instructions */
	ap_uint<128> temp;
	for (int i = 0; i < num_Of_Instruction; i++) {
		temp = bramInstruction[i];

		// Code to decode instruction
		dataA = (DataA_t*)temp.range(31,0);
		dataB = (DataA_t*)temp.range(63,32);
		dataC = (DataA_t*)temp.range(95,64);
		int parameterA = (DataA_t*)temp.range(127,96);

		// Code to pass parameter from instruction to my custom IP
		CustomIP(dataA, dataB, dataC, parameterA);
	}
}

The code above is actually simplification of what I actually made. The code works nicely in csim, but it failed to synthesis will following errors:

Diwen_0-1613705751243.png

It says that "Call parameter type does not match function signature!". What does it exactly mean?  I suspect that the reason is because I am doing pointer casting as you can see from my code? If that is really the case, then how do you pass the axi master address in instruction form?

Tags (2)
0 Kudos
1 Reply
Diwen
Visitor
Visitor
308 Views
Registered: ‎01-23-2021

It seems the cause of error is indeed because of pointer typecasting. I have tried another approach where I create the struct data type for Instruction_t to become like this:

struct Instruction_t {
	DataA_t* aAddr;
	DataB_t* bAddr;
	DataC_t* cAddr;
	int parameters;
};

and so my toplevel become like this:

void Top_Level(DataA_t* dataA, DataB_t* dataB, DataC_t* dataC, Instruction_t* instruction, int num_Of_Instruction)
{
	// DataA_t* dataA is axi master port for dataA
	// DataB_t* dataB is axi master port for dataB
	// DataC_t* dataC is axi master port for dataC
	// Instruction_t* instruction is axi master port for instructions
	// int num_Of_Instruction is axi lite port for specifying total number of instruction that will be given to

	/* Burst Read the instruction from DDR and store in BRAM */
	Instruction_t bramInstruction[MAX];
	for (int i = 0; i < num_Of_Instruction; i++) {
		bramInstruction[i] = instruction[i];
	}

	/* Main loop that execute all of the instructions */
	Instruction_t temp;
	for (int i = 0; i < num_Of_Instruction; i++) {
		temp = bramInstruction[i];

		// Code to decode instruction
		dataA = temp.aAddr;
		dataB = temp.bAddr;
		dataC = temp.cAddr;
		int parameterA = temp.parameters;

		// Code to pass parameter from instruction to my custom IP
		CustomIP(dataA, dataB, dataC, parameterA);
	}
}

Unfortunately, this also cause another error. It cannot be synthesized, according to vitis HLS this is because my struct contains pointer type.

 

Is there any other approach so I can avoid pointer type casting for passing the address?

0 Kudos