VHDL simulating a clock that doesn't run all the time

Status
Not open for further replies.

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
Hello,

Signal x is a simulated clock that's defined as follows:
Code:
signal x : std_logic := '0' ;
x <= not x after 10ns ;

Suppose, I want x to start running after 100ns and stop after 1000ns.
The obvious solution will be to mux it...my question:

Is there a simple simulation syntax that allows to do that without using a mux?
 

You can use this.
x <= '0', not x after 100 ns, '0' after 1000 ns;
 
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
You can use this.
x <= '0', not x after 100 ns, '0' after 1000 ns;

That wont make a clock, that will just set it high for 900 ns.

The easiest option is a mud like you suggested, or a process with control loops.
 

Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
Process
Begin
  input <= '0';
  wait for 100ns;
 
  for I in 1 to 90 loop 
    input <= not input;
    wait for 10 ns;
  end loop;
 
 input <= '0';
End process;

 
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
A terminating wait statement should stop further process schedule.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…