cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
macellan85
Explorer
Explorer
1,278 Views
Registered: ‎01-05-2017

how to instantiate a binary counter module multiple times

 

Hi I want to design a multi channel counting module with individual binary pulse inputs. Is this possible by using generate statement? Or is there anyother method instead of replicating the same counter? If any of these is possible could you please give me an example for clarifying?

 

p.s The total number will be something like 50 individual counter all have specific inputs and outputs. 

 

Thanks in advance and best wishes :)

0 Kudos
Reply
4 Replies
markcurry
Scholar
Scholar
1,272 Views
Registered: ‎09-16-2009

 

A "generate" loop is a fine solution for what you're trying to do.

 

There's many examples out there - both on these forums, and on the net in general.  Give it a shot, and let us know if you're having trouble.

 

Regards,

 

Mark

0 Kudos
Reply
macellan85
Explorer
Explorer
1,243 Views
Registered: ‎01-05-2017

 

Dear @markcurry thank you for the answer. 

 

For sure I did make search on the web. Most of the examples based on a half adder design using a d flip-flop and I didn't understand very well how individual inputs gets in and individual outputs goes out. But anyway I'll search again since you also stated that this is the correct way. Later on when I get it I'll write here!

 

Best wishes

 

 

0 Kudos
Reply
eilert
Teacher
Teacher
1,216 Views
Registered: ‎08-14-2007

Hi,

just a little hint:

Use your generate_loop value for indexing the inputs and outputs of each counter instance.

This requires I/Os of a type that can be indexed. (e.g. std_logic_vectors or arrays of some kind.)

 

Have a nice synthesis

  Eilert

 

 

0 Kudos
Reply
hgleamon1
Teacher
Teacher
1,205 Views
Registered: ‎11-14-2011

Another tip is to draw a block diagram of what a single counter would look like, especially with regards to input size, output size, counter size.

 

Will all counters run from the same clock? Will all counters be (potentially) enabled at the same time? Will counters roll over when/if they reach their respective max count?

 

I'm slightly curious as to what you are doing that requires you to produce 50 separate counters .. ? In my mind there must be potential to optimise this, even at the design stage.  

----------
"That which we must learn to do, we learn by doing." - Aristotle
0 Kudos
Reply