This syntax is illegal. There are some very subtle differences between a concatenation {} and and assignment pattern '{}, both of which can be used to assign an unpacked array. A key requirement in a concatenation is that the types of all items must be self-determined, and '{RISE,2} and '{FALL,1.5} are both assignment patterns without self-determined type. You can make the items self-determined by writing the code as
timing_para_t timing_db[] = { // this is an array concatenation
timing_para_t'{RISE, 2}, // self-determined assignment pattern
timing_para_t'{FALL, 1.5}// self-determined assignment pattern
};
But there is a simpler solution using an assignment pattern to assign the dynamic array because it uses a context determined type.
timing_para_t timing_db[] = '{ // this is an array assignment pattern
'{RISE, 2}, // context determined assignment pattern
'{FALL, 1.5}// context determined assignment pattern
};
Thanks Ajeetha and Dave for your suggestions, now it’s working.
one thing i want to ask is that the code i had written(without the tick that you guys suggested) is working properly with VCS without any error or warning but it is giving error in Questa sim. Why is it so?
Because VCS is not following the rules of the LRM. (See section 10.10 of the 1800-2012 LRM). And in 10.10.1, there is an explicit example showing a similar case that is illegal:
A9 = {A3, '{4,5,6,7,8,9} }; // illegal, '{...} is not self-determined
In your particular case there is no ambiguity in what you are writing, but in general, the LRM does not like to define syntax grammar rules based on the context. As soon as you introduce parametrized types, then it possible the compiler will not understand the syntax of what is written.