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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.