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

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.