leekeith / vtr-verilog-to-routing

Automatically exported from code.google.com/p/vtr-verilog-to-routing
0 stars 0 forks source link

Odin concatenation parsing #108

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the attached .v and .xml through VTR.
There are two verilog files that only differ in the syntax,
but otherwise describe the exact same operation.

What is the expected output? What do you see instead?

I'd expect the two produced .abc.blif to be the same,
but they are different.
For one of them it's correct, for the other one it isn't.
(in particular, notice the 8 MSBs are set to 0).

What version of the product are you using? On what operating system?

VTR 7.0 Ubuntu 14.04.1 LTS 64b

Please provide any additional information below.

This might be an issue with using multiple "?:" operators in one concatenation?

PS: I also just submitted a comment to issue 103 (also Odin-related), not sure 
if the right people get notified right away when it's not a new issue...
Anyway, issue 103 is actually more limiting for me at this point, since this 
one has an easier workaround.

Thanks!

Original issue reported on code.google.com by edin.kad...@gmail.com on 31 May 2015 at 6:03

Attachments:

GoogleCodeExporter commented 9 years ago
After much debugging I think I've found the issue.
Writing 4'hA in verilog means:
a number with 4 *binary* digits, and whose hexadecimal value is A

Instead, Odin assumes that there will be 4 *hexadecimal* digits, so it 
interprets the value as 0000000000001010 instead of 1010.

So in the given example:
assign c_s = { (a == 8'hAA) ? 8'hAB : a,
           (b == 16'hAAAA) ?
         16'hAAAB :
         b } ;

Odin concatenates a 96b value, but then only keeps the 24 LSBs since c_s only 
has 24 bits.
The 16 LSBs are correct, but the 8 MSBs are 0.

Original comment by edin.kad...@gmail.com on 2 Jun 2015 at 5:13