We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for
Did you mean:
Visitor
3,679 Views
Registered: ‎01-23-2013

## modeling 74191 counter on a Coolrunner 2

Hello. First time poster here and a student in my 2nd term of Electronics Engineering Technology. I just got a Coolrunner 2 and am hoping to start building more circuits on it using VHDL rather than breadboarding (as fun as that can be). We've started learning a little VHDL in class but not much more than writing code to turning on some LEDs.

I was hoping that there was a library of code to emulate the 74xx series of ICs. I've done some Googling but haven't found anything regarding the chip I need for an upcoming lab which is a 74191 up/down counter. Any leads?

Also, can anyone recommend a good starter book for VHDL? Our Digital Systems textbook contains an HDL section in each chapter, but it's not a dedicated HDL instructional guide. Thanks in advance.

1 Solution

Accepted Solutions
Highlighted
Explorer
4,807 Views
Registered: ‎05-12-2011

## Re: modeling 74191 counter on a Coolrunner 2

You probably won't find anything specific to a 74191, or a library of 74 series logic parts either for that matter.  The logic itself is what you describe with VHDL, and the tools synthesize what you describe.  To describe a 3-input NAND gate for example, you describe something along the lines of outsignal <= not( insignal1 and insignal2 and insignal3);  That hardly requires a library. :-)

A counter is a very common construct, and essentially according to an input clock does the equivalent of count <= count + 1; (or -1 if you want a down-counter).  Of course you can get funky with the preset, reset, load, clear, enable and all that too, but it's just a bit more VHDL to describe the functionality you want.

So the counter itself is fairly trivial, the purpose of the exercise is to get you to learn enough VHDL to describe the logic you're after.  I would be very surprised if whatever VHDL book you picked up didn't have more than one example of a counter in it.  If you're impatient you could just hit up teh Googlez for "vhdl counter", just be careful you don't pick up any bad practices from random people who like to post code while you're still learning.

The best way to learn this stuff is to jump in and start doing it.  You don't even need any hardware, you can get started with a project and run it in the simulator and see all of the signals changing state.  Even the simplest of projects will give you good experience using the tools, which is half of the battle at least when you're starting out.  So find some tutorials or a book or two, and start in.  Then when you have specific questions about something you're trying to do that isn't working the way you expect it to, you can come here and give a detailed description of what you did, what you expected, and what actually happened and someone will help you out.

Let the learning begin!

Cheers,

-Doug

4 Replies
Visitor
3,677 Views
Registered: ‎01-23-2013

## Re: modeling 74191 counter on a Coolrunner 2

ok. I should have read the README first. Bob Elkind (eeteam00) has written a very helpful intro for newbies with tons of resource links including "VHDL/Verilog tutorials and book recommendations". So for book recs, I'll look into the linked threads. However, I've had less luck finding references to emulating the 74191 with VHDL code.

Highlighted
Explorer
4,808 Views
Registered: ‎05-12-2011

## Re: modeling 74191 counter on a Coolrunner 2

You probably won't find anything specific to a 74191, or a library of 74 series logic parts either for that matter.  The logic itself is what you describe with VHDL, and the tools synthesize what you describe.  To describe a 3-input NAND gate for example, you describe something along the lines of outsignal <= not( insignal1 and insignal2 and insignal3);  That hardly requires a library. :-)

A counter is a very common construct, and essentially according to an input clock does the equivalent of count <= count + 1; (or -1 if you want a down-counter).  Of course you can get funky with the preset, reset, load, clear, enable and all that too, but it's just a bit more VHDL to describe the functionality you want.

So the counter itself is fairly trivial, the purpose of the exercise is to get you to learn enough VHDL to describe the logic you're after.  I would be very surprised if whatever VHDL book you picked up didn't have more than one example of a counter in it.  If you're impatient you could just hit up teh Googlez for "vhdl counter", just be careful you don't pick up any bad practices from random people who like to post code while you're still learning.

The best way to learn this stuff is to jump in and start doing it.  You don't even need any hardware, you can get started with a project and run it in the simulator and see all of the signals changing state.  Even the simplest of projects will give you good experience using the tools, which is half of the battle at least when you're starting out.  So find some tutorials or a book or two, and start in.  Then when you have specific questions about something you're trying to do that isn't working the way you expect it to, you can come here and give a detailed description of what you did, what you expected, and what actually happened and someone will help you out.

Let the learning begin!

Cheers,

-Doug

Visitor
3,661 Views
Registered: ‎01-23-2013

## Re: modeling 74191 counter on a Coolrunner 2

Thanks a lot for your reply Doug. I suppose you're right. It's probably not as daunting as it looks and describing simple ICs in HDL does seem like a good way to learn HDL. Looking at the logic diagram on the 74191 data sheet immediately touched my ignorance and fear buttons but I'll man up and give it a go. I really appreciate the encouragement.

Explorer
3,655 Views
Registered: ‎05-12-2011