1. In a system for modeling multiple instances of an electronic circuit using an imperative programming language function in a program, said electronic circuit having an internal state, said imperative programming language function having a persistent variable associated with said internal state, a method comprising: maintaining, using a computer, a first lookup table and a second lookup table throughout multiple calls of said imperative programming language function by said program; wherein said first lookup table includes values of said persistent variable respectively associated with keys, each of said keys being defined by a call path to said imperative programming language function in said program and a name of said persistent variable; wherein said second lookup table includes a last call path value associated with a key, said last call path variable being indicative of a last call path to said imperative programming language function in said program, said key being defined by said name of said persistent variable and a name of said imperative programming language function; wherein said step of maintaining comprises, for each of said multiple calls: accessing said second lookup table to obtain said last call path value; storing a current value of said persistent variable in said first lookup table using a current key defined by said last call path value and said name of said persistent variable; and; updating said last call path value in said second lookup table to refer to a current call path to said imperative programming language function in said program.