Corey Kosak

Showing off my simple newbie project

Recommended Posts

Hi folks,

 
I'd like to show off my first Papilio Pro project. It's not much by anybody else's standards, but I was quite excited to get to this point after only a couple of days, starting from zero knowledge. Mike Field's tutorial was awesome!
 
I hope that this is an appropriate use of this forum. I realize that others on the forum seem to be much more sophisticated.
 
The project continuously increments a 16-bit counter, then renders that counter on the LED display. The project has three components: one that does the counter, one that multiplexes the counter onto the display, and one that translates 4-bit hex nibbles into 7-segment values suitable for display.
 
I'm actually quite surprised that it worked without too much pain. I had to guess here and there. Here's a video: http://www.flickr.com/photos/15819666@N00/10388671913/
 
My .vhd and .ucf files are attached. I called the top-level file "Beef" because it was displaying 0xBEEF in the earlier stages of the design.
 
I also had a couple of questions if you don't mind.
 
1 - I notice that the software spews out a huge number of files into my working directory. Is there a way to cleanly separate my source files from all these tool-generated intermediate files? An analogy in the C++ world is that I'd like to keep my .cc, .h, and Makefiles in a separate place from the .o and executable files. This makes for easy management with version control and also easy sharing (there's no point in checking in or sharing all these tool-generated intermediate files). What do other people do here?
 
2 - In a case statement (such as that in SevenSegMultiplexor.vhd) I tend to need a line like ``when others => ENABLES <= "XXXX";'' I was staring at the 9-valued logic page in Wikipedia and I couldn't decide whether I wanted "XXXX", "WWWW", "UUUU", or "----" here. I actually would have guessed "----" meaning `don't care` but XXXX seemed to work without complaint. Which is the most appropriate?
 
3 - I could have inlined HexTo7Seg inside SevenSegMultiplexor but I liked the way it looked as a separate component. Is this a reasonable thing to do?
 
Any advice would be greatly appreciated. And thanks! I've had a fun weekend!
 


This post has been promoted to an article

counter project.zip

  • Like 1

Share this post


Link to post
Share on other sites

Well done Kosak, It is my hope that this forum will have more posts from people showcasing their projects step by step as they are developed covering both successes and failures, or showing their troubleshooting techniques. Then we can all pitch in with ideas. I attempted to do this with my latest Roboton posts, though given the lack of responses, perhaps it was too hard for people to follow or they may even have found the posts annoying and just skipped them :)

 

1) What I do for all my projects is create a special directory which I usually call "build" but any name will do. This directory can only be specified when creating a new project and I haven't found a way to change it through the GUI afterwards. If you already have created the project then open the .xise project file with a text editor and search for "working directory" which will contain just an empty string in quotes like so "", change that to "build" and save it. The next time you open the project it will ask you if you want to create this directory and answer yes. From now on, all the junk during the build will end up in this directory. I think there was a while ago a post or perhaps an article on the papilio page discussing this, The recommended way to create a project directory structure was along these lines:

root /     +-build     +-doc     +-source     +-tools    

Where "build" is the directory I mentioned above, "doc" contains project documentation, datasheets, useful references, etc, "source" (or "src" or "hdl" if you prefer contain the HDL source code of your project then "tools" can contain useful scripts for building parts of your project such as binary to VHDL converters to create ROM files or any other scripts or executables needed for your project.

 

2) You're right, even if your case statemnt covers all possible cases, you still get a warning during synthesis unless you have an "others" case (durrr!). If you just need "others" as a filler that does nothing I usually use "when others => null;"

 

3) Nothing wrong with that. Usually you do this if you're going to re-use that piece of code several times, then you turn it into a separate module. You can now include that module file into other projects that need a hex to 7seg decoder.



This post has been promoted to an article
  • Like 1

Share this post


Link to post
Share on other sites

Thanks a lot for your reply.

 

Re (1) I reorg'ed my project in the indicated way. It's working much better now. Thanks!!

 

Re (2) I didn't know about "when others => null". Sounds good to me!

Share this post


Link to post
Share on other sites

I should have said in my reply to you re 2) that those 9 different values only make sense for simulation. When synthesized, the actual logic can only ever have three states, '1', '0' and 'Z'. That last high impedance state can cause you some grief if not handled correctly, for example when using an internal signal that you never assign a value to, during synthesis it will generate a warning and IIRC will be initialized to a default value. If however that comes from an FPGA pin you could truly have it in a fully undefined state if you don't assign that pin any pullups or pulldowns. I even saw a recent post in this forum where a user had experienced some weird behaviour due to a floating pin.

Share this post


Link to post
Share on other sites

Kosak,

 

Thank you for sharing your project, this is exactly what I intended for this forum. Someone is going to enjoy and learn from this post so it is well worth it. :) I'm going to post this into the discover section of the forums to make it stand out a little more.

 

Congrats on getting up and running so quickly, it really is a great feeling to get a FPGA project working. :)

 

Jack.

Share this post


Link to post
Share on other sites

I attempted to do this with my latest Roboton posts, though given the lack of responses, perhaps it was too hard for people to follow or they may even have found the posts annoying and just skipped them :)

 

 

OK, I just read the Robotron thread and ... wow... just wow. Amazing. I'll be back in 5000 years once I get to that level of expertise.  :lol:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now