Forum Discussion
Altera_Forum
Honored Contributor
11 years agoHi Daixiwen,
I got the same error while trying to create custom component with quartus version 13.1 in qsys which has parameter dependent address width. I tried two cases to generate component but in both the cases i got same error that is "Error: Width of port av_d_addr_word_i/av_c_addr_word_i is invalid + (non-static) - (0) + 1 (must be an integer or parameter name)" The tried case is in texts below. ****************************************************************************************************** // for case_1 // parameter for simulation purpose parameter SIMULATION = 1'b0; // parameter for specifying the memory depth in KBytes parameter MEMORY_DEPTH_IN_KBYTES = 16; // Local Parameter for memory depth in bytes. localparam MEM_DEPTH_8 = ( MEMORY_DEPTH_IN_KBYTES * 1024 ); // Local Parameter for memory address width.(_8 prefix indicates this is for byte(8 bit)). localparam MEM_ADDR_WIDTH_8 = clogb2( MEM_DEPTH_8 ); // Local Parameter for avalon slave component address width ( 32 bit aligned ) localparam AV_ADDR_WIDTH = ( MEM_ADDR_WIDTH_8 - 2 ); input [(AV_ADDR_WIDTH-1):0] av_d_addr_word_i; input [(AV_ADDR_WIDTH-1):0] av_c_addr_word_i; function integer clogb2; input integer depth; integer i; integer result; begin result = 0; for ( i = 0; 2 ** i < depth; i = i + 1 ) begin result = i + 1; end clogb2 = result; end endfunction ****************************************************************************************************** ****************************************************************************************************** For case_2 // parameter for simulation purpose parameter SIMULATION = 1'b0; // parameter for specifying the memory depth in KBytes parameter MEMORY_DEPTH_IN_KBYTES = 16; input [clogb2((MEMORY_DEPTH_IN_KBYTES * 1024)-2) -1 : 0] av_d_addr_word_i; input [clogb2((MEMORY_DEPTH_IN_KBYTES * 1024)-2) -1 : 0] av_c_addr_word_i; function integer clogb2; input integer depth; integer i; integer result; begin result = 0; for ( i = 0; 2 ** i < depth; i = i + 1 ) begin result = i + 1; end clogb2 = result; end endfunction ****************************************************************************************************** Is there any other way to do this! Will be looking forward to your reply. Regards, Hitesh.