The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Apr 19th, 2024, 8:05pm
Pages: 1
Send Topic Print
Timer statement inside a for loop (Read 789 times)
knark
New Member
*
Offline



Posts: 2

Timer statement inside a for loop
Mar 28th, 2019, 2:09am
 
Hello everyone,

I want to generate control signals that turn on a series of switches consecutively with a spacing of 1ps in between two consecutive signals going high.

My code :

`include "constants.vams"
`include "disciplines.vams"

module SourceResBank (p,n);

inout [1:2] p;
inout n;
electrical [1:2] p;
electrical n;

real expr [1:2];
genvar k;

analog begin

for (k=1 ; k<1+1 ; k=k+1)
begin

 @(timer(0, 1))
     expr[k] = 0;

 @(timer(1p*k,1))
     expr[k] = 1;

  V(p[k]) <+ transition(expr[k]);
end
 
 V(p[2]) <+ transition(expr[2]);
end

endmodule


The @timer statements inside the loop operate only once as the output p[1] gets a transition from low to high but the second (and third and so on) remain low.
However, if I write the @timer statements individually for all bits without the loop, that would work fine and all bits would transition from low to high.

Is there some restriction on timer statements in loops which only allows it to be operated only once ?

Back to top
 
 
View Profile   IP Logged
knark
New Member
*
Offline



Posts: 2

Re: Timer statement inside a for loop
Reply #1 - Mar 28th, 2019, 2:41am
 
I found out I made a silly mistake in the code. There is no restriction on timer statements in a loop.

Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.