Corey Kosak

Newbie project #2 - 16-element register file

Recommended Posts

Hi folks,

 

I thought I'd share my second project with you all. I just bought this book and got some more ideas from it. I ended up making a little 16-element register file and wrapping a "user interface" around it. I filmed a little video, and I've also attached the source files.

 

As I was doing this I noticed that the switches on the Papilio were not laid out in the order I expected. switch(0) is the leftmost when I expected it to be the rightmost. This is not a big deal--I could have RTFM'ed--but then I started thinking about how I wanted to deal with that. I might have edited my constraints file but I wanted to leave it alone. Instead I went looking for a way to reverse a logic vector in my design.

 

I expected something like this to work:

user_addr <= megawing_switches(0 to 3);user_data <= megawing_switches(4 to 7);

But that gave me the error "Line 30: Slice direction does not match type range direction."

 

So I ended up doing this, but I felt a little dirty.

rewire: for i in 0 to 3 generate  user_addr(i) <= megawing_switches(3-i);  user_data(i) <= megawing_switches(7-i);end generate rewire;

Is that really the simplest way to reverse a vector?

 

I had another fun weekend here. Thanks again for listening!

 

source.zip

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