Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

1 HZ square wave generation without giving clock as input signal.

Status
Not open for further replies.

jasi

Newbie level 5
Joined
Jan 23, 2018
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
74
I wanted to implement 1 HZ square wave in verilog with out giving system clock signal as input.in which first 500 ms the signal should be high,and remaining 500 ms the clock should be low. i write the delay program by using my logic but clock is always high

my code

Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module clkgeneration2 (enable,clkout
    );
    input enable;
    output reg clkout;
    reg temp;
    integer a;
    always@(a)
    begin
        for (a=0;a<500;a=a+1)
        begin
          if (a<500)
           
           temp<= 1'b1;
          else
           temp<= 1'b0;
        end
    end
    always@(enable) 
    begin
       if (enable)
       clkout<=temp;
       else 
       clkout<=0;
    end
    endmodule





anyone please help me .what is the error in this program.or give me logic how to create synthesizable delay of 500 ms .I browsed a lot regarding delay, while doing so I came across a delay formula:( # num).but it is only for simulation.when approaching to synthesizing this delay formula does not work.
 
Last edited by a moderator:

Hi,

I assume you need an input clock in any case.

Your code seems to count 0...499. This let's me assume that there is a clock with 1ms cycle time = 1kHz input clock.

Klaus
 

The shown logic won't even work with an input clock. It's missing an edge sensitive condition in the always block, required to make a clock counter.

Your stumbling upon the fundamentals of programmable logic design. I presume there are some examples or tutorial designs shipped with the PSoC development tools?
 

Is this for simulation or actual hardware? Where did you hear about the delay formula? Was it in the context of simulation or hardware logic?
 

Is this for simulation or actual hardware? Where did you hear about the delay formula? Was it in the context of simulation or hardware logic?


It is for actual hardware. Iam using psoc 3. 1000 ms corresponds to 1 HZ. so iam using counter that counts up to 1000. In it there was a high pulse upto 500 and remaining 500 as low pulse. i don't know this method is correct or not. for simulation we use delay such as( #num).
for example # 5 a=b .but for synthesis it is not possible. my ultimate aim is to produce 500 ms delay .in that delay signal should be high. and also produce another 500 ms delay in this delay signal should be low. i need 1 HZ pulse using this delay.should not use clock as input signal....
 

Hi,

It is for actual hardware. Iam using psoc 3. 1000 ms corresponds to 1 HZ. so iam using counter that counts up to 1000.
This means your counter needs to count up every ms. Which equals an counter clock frequency of 1kHz.
Where do you think this frequency does come from? --> it needs an input clock.

Klaus
 

Hi,


This means your counter needs to count up every ms. Which equals an counter clock frequency of 1kHz.
Where do you think this frequency does come from? --> it needs an input clock.

Klaus





is there any option to produce 500 ms delay without using counter in verilog. because counter needs clock input. Iam unable to use clock as input signal.
 

Without a clock of some sort, with a known delay, how are you going to measure time?
 

is there any option to produce 500 ms delay without using counter in verilog. because counter needs clock input. Iam unable to use clock as input signal.

If possible can you please share why such requirement is needed, may be some alternative can be suggested.
 

Simulation only!


Code Verilog - [expand]
1
2
initial 
   forever #1 Clk = ~Clk;



Where #1 is the time delay

For anything synthesised, you can't just magic out of thin air a timed signal. You need it to be relative to some input clock
 

Square up a suitable RC output?
You mentioned a PSOC 3 - it always has a clock of some sort otherwise it would not run.
However one important consideration is how accurate the 1Hz needs to be and over what period of time (drift) and this has not been mentioned at all.
Susan
 

PSOC 3 needs a clock. If you don't have a clock, then you're wasting your (and our) time using a PSOC.

Maybe you could use a multivibrator circuit to generate your 1Hz. Or a 555 timer. You REALLY need to be clear about what you're trying to do here.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top