Update a signal and use signal attributes in the same process block

OP (Company: Lab Instructor) #5220353
Rate this post
useful
not useful
process
    begin
      clk <= not clk;
      wait for 10ns;
end process;

process(clk)
   begin
     if(clk = '1' and clk'event) then
     --Do something
     end if;
end process;

Presently I am using 2 process blocks to implement the condition above. 
Is there a way I can do it in a single process block?

Something like the code described below. However, the problem with the 
code described below is that the rising edge of the clock is never 
sensed in the simulation. I tried using a blocking assignment 
(variables), but that was not successful either.

I am pretty sure my understanding is missing something. But i cant 
figure out what.

process
   begin
      clk <= not clk;
      wait for 10ns;

     if(clk = '1' and clk'event) then
     --Do something
     end if;
end process;

Thanks in advance.
Moderator (Company: Titel) #5220510
Rate this post
useful
not useful
Peter wrote:
> You forgot the sensitivity list of the process.
There's a wait in the process, therefore there's no need for a 
sensitivity list

Rejoy M. wrote:
> Is there a way I can do it in a single process block?
Generate the clock without a process:
clk <= not clk after 10ns;

Or do it that way:
process begin
wait for 10ns;
--Do something
end process;

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now