Frequency divider ?

I feel it is better to start a new thread, I have compiled my divide oscillator clock by ten module, what do I do now?

//////////////////////////////////////////////////////////////////////////// ////// module clkdiv10mod(in, out); input in; output out;

reg [3:0] cnt;

always @ (in) begin cnt=cnt+1; if (cnt ==9) begin cnt =0; cnt =!cnt; end end

endmodule

Here is my console output:

=========================================================================

  • HDL Compilation * ========================================================================= Compiling verilog file "clkdiv10mod.v" in library work Module compiled No errors in compilation Analysis of file succeeded.

=========================================================================

  • Design Hierarchy Analysis * ========================================================================= Analyzing hierarchy for module in library .

Building hierarchy successfully finished.

=========================================================================

  • HDL Analysis * ========================================================================= Analyzing top module . Module is correct for synthesis.

=========================================================================

  • HDL Synthesis * =========================================================================

Performing bidirectional port resolution...

Synthesizing Unit . Related source file is "clkdiv10mod.v". WARNING:Xst:647 - Input is never used. WARNING:Xst:1306 - Output is never assigned. Found 4-bit adder for signal . Summary: inferred 1 Adder/Subtractor(s). Unit synthesized.

========================================================================= HDL Synthesis Report

Macro Statistics # Adders/Subtractors : 1 4-bit adder : 1

=========================================================================

=========================================================================

  • Advanced HDL Synthesis * =========================================================================

========================================================================= Advanced HDL Synthesis Report

Macro Statistics # Adders/Subtractors : 1 4-bit adder : 1

=========================================================================

=========================================================================

  • Low Level Synthesis * =========================================================================

Optimizing unit ...

=========================================================================

  • Partition Report * =========================================================================

Partition Implementation Status

-------------------------------

No Partitions were found in this design.

------------------------------- WARNING:ProjectMgmt - "C:/Xilinx/clkdiv10/clkdiv10mod.ngc" line 0 duplicate design unit: 'Module|clkdiv10mod'

Process "Synthesize" completed successfully

Command Line: C:\Xilinx\bin\nt\ngdbuild.exe -ise c:/Xilinx/clkdiv10/clkdiv10.ise

-intstyle ise -dd _ngo -i -p xc9500 clkdiv10mod.ngc clkdiv10mod.ngd

Reading NGO file 'c:/Xilinx/clkdiv10/clkdiv10mod.ngc' ... Loading design module "c:\Xilinx\clkdiv10/clkdiv10mod.ngc"... WARNING:NgdBuild:578 - Design contains no instances.

Checking timing specifications ... Checking Partitions ... Checking expanded design ...

Partition Implementation Status

-------------------------------

No Partitions were found in this design.

-------------------------------

NGDBUILD Design Results Summary: Number of errors: 0 Number of warnings: 1

Writing NGD file "clkdiv10mod.ngd" ...

Writing NGDBUILD log file "clkdiv10mod.bld"...

NGDBUILD done.

Process "Translate" completed successfully

Started : "Fit". ERROR:Cpld:1005 - Design 'clkdiv10mod' has no outputs.

Process "Fit" failed

Reply to
<222>
Loading thread data ...

Get out a simulator and see if it works. Once you've done some of your own work, perhaps ask for some help.

KJ

Reply to
KJ

own

No, no need to simulate, I am ready for the real thing Please contine (as opposed to 'break')

Reply to
<222>

You have EVERY reason to simulate.. By trivial inspection I can tell that your design doesn't do anything at all. You could start by pondering on the warning messages out of the HDL Synthesis that 'warn' you that input 'in' is never used and output 'out' is never assigned and try to figure out why that would be (Hint: Input 'in' is never used BECAUSE output 'out' is never assigned and since 'out' is the only output this would imply that there is no need for any inputs). Since no inputs or resources of any kind are needed to implement your code, eventually this leads to the fitting error....once again, perhaps read the error message that says that your module has no outputs.

In any case, I'll repeat the suggestion to start to use a simulator and simulate your code. There is not much point in running through the synthesis process until you have functioning code....and you can't say you have functioning code until it works at least in a simulation environment.

KJ

Reply to
KJ

the

is

that

Why do you say that my input is never used, what about

always @ (in) ?

What about

out = !out is that not an assignment ?

Please explain how to simulate, my device is xc9536 and the software is Xilinx ISE 8.2i

Tia.

Reply to
<222>

If I run your design through leda (a linter for VHDL and Verilog) I get the following two warnings:

  • Signal cnt is missing in the sensitivity list
  • An asynchronous feedback loop was detected on cnt.

What it boils down to is that if you have an @() statement with only signals in it (no posedge or negedge) the synthesizer will infer combinatorial logic from it. And the synthesizer will not care about the sensitivity list at all basically. (It will handle it like you wrote always @* in Verilog 2001 more or less.)

If you want something to synthesize, restrict yourself to always @(*) and always @(posedge clocksignal).

If you want an asynchronous reset you can also use something like always @(posedge clocksignal or posedge resetsignal).

(Or negedge as appropriate.)

Otherwise you will most likely get a design that will not work in the same way as your simulation.

/Andreas

Reply to
Andreas Ehliar

What is a sensitivity list, please add it as appropriate so that I can recompile the program.

Please, can you correct the feedback, I have no idea where this feedback is coming from, thanks.

There currently is no sensitivity list, hence I assume combinational logic is what we want.

Reply to
<222>

This thread is getting more amusing the longer it gets. :)

Mike

Reply to
Mike Lewis

Does anyone else suspect that '222' is actually a Turing machine configured to teach itself Verilog programming by holding pseudo-natural-language conversations on Usenet?

It's certainly neither an engineer nor anyone who's ever going to be one.

Will

Reply to
Will Dean

He should start another one...again.

Your absolute lack of understanding is astounding. Even after people have given more help than you deserve, you continue to post things that make no sense.

"out = !out is that not an assignment ?" Yes, it is. Too bad you are not using it.

I dare you to try and draw the hardware you are attempting to make. Becuase what you have so far is awesome. I am incorporating it into my current design. It is basically a neural-computer that posts to forums in search of answers for every single issue for everything in life. Otherwise, I may have to read a manual or book to learn something.

always @(anything_i_dont_understand_immediately) post_to_forum = 1'b1;

always @(always) //is this a verilog construct...hmmmmmm, I wish. rtfm = 1'b0;

Here is how I suggest you code you counter:

always @(when_you_should) divide_my_clock_by_10

There has to be some synthesis tool that will infer correctly from here.

Oh, and keep making the same signal equal to two different values at the same time. That will always work out for you. Wired-OR is your friend too.

Sorry if this is a mean post, but some people aren't cut out for this stuff.

Reply to
motty

Solid play.

Reply to
motty

Reply to
Peter Alfke

Reply to
Peter Alfke

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.