The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 7th, 2024, 8:38pm
Pages: 1
Send Topic Print
from verilog-ams to verilog-hdl (Read 1964 times)
douglas
New Member
*
Offline



Posts: 1

from verilog-ams to verilog-hdl
Oct 30th, 2006, 1:50am
 
Hello everybody,

time ago I used to make some verilogams codes. I've been inactive for a while and I've lost the practice.

now I'm trying to make a code, but totally digital (and using verilog hdl). the point with verilogams is that I'm trying to use something from it in my verilog-hdl code but I don't get it to work.

let me explain, its easy but I just can get it:

I have an ENABLE signal. when ENABLE goes high, an ouput clock must start (with a defined period). when enable goes down, this clock must goes to zero and stay at zero.

in verilog ams I could use the always block without a sensitivity list, for example:

always if (V(ENABLE)) Clk = ...
else Clk = ...

but in HDL I can't. the main problem Im having is stopping the Clk when Enable goes to zero.
if somebody can give me a tip or tell me what Im doing wrong I would be very grateful.

this is what Im doing:

reg Clk;
initial Clk = 0;
parameter delay = ...
parameter period = ...

always @(VLOEN)
   if (VLOEN==1) begin
      #(delay) Clk <= 1'b1; //some delay
      forever begin: COUNTING
         #(period * 0.5) Clk = ~Clk;
         if (VLOEN==0) disable COUNTING;
      end
   end else if (VLOEN==0) Clk <= 1'b1;


I
Thanks in advance.




Back to top
 
 
View Profile   IP Logged
Eugene
Senior Member
****
Offline



Posts: 262

Re: from verilog-ams to verilog-hdl
Reply #1 - Oct 30th, 2006, 7:59am
 
This may not do exactly what you want but it may give you some ideas.

always wait (ENABLE) #(0.5 * period) clk = ~clk;
wire GatedClk = clk & ENABLE;

The first line produces a clock only when ENABLE is high. The second line ensures the end result, GatedClk, is zero when ENABLE is zero.

I don't have my reference book with me or I'd check, but you may need an @ somewhere in the above lines.
I just checked. You don't need the @.
Back to top
 
« Last Edit: Oct 30th, 2006, 2:58pm by Eugene »  
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.