- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello all,
I have some trouble getting this next piece of code to work. I don't know if this is valid code because the simulation result is always 'U', unless I enter a fixed number. This doesn't work:for x in 0 to (someConstant MOD 2) generate
This does: for x in 0 to 3 generate
If this is not valid code, what is the correct way to do this?
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
its a little tricky to understand what you are doing without the proper code, but (someconstant mod 2) can only return 1 or 0, depending on the constant. so it's not the same as the loop below it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Doesn't REM 2 only return 0 or 1?
I use it to generate a number of multiplexors.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if both inputs are positive, then mod and rem do the same thing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, I think I was a bit too quick asking this question. Should have read a bit further on these operators than I did.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page