-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix input values due to the change for signed values #105
Conversation
Pull Request Test Coverage Report for Build 930
💛 - Coveralls |
Interesting, is this because without the mask, C is promoting the byte (char) to a 32 bit type (used by verilator?) which results in sign extension? Then adding the mask results in the promotion to 32 bits without extension because the mask numeric literal is treated as a 32 bit value? |
I believe so. |
Confirmed via testing! // promotion.c
#include "printf.h"
int main() {
char byte = 0xEE;
printf("%%hhx byte = %hhx\n", byte);
printf("%%x byte = %x\n", byte);
printf("%%x (int) byte = %x\n", (int) byte);
printf("%%x byte & 0xFF = %x\n", byte & 0xFF);
} and
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C char promotion strikes again!
Another thing we could try is using |
I need to confirm this with @jeffsetter and other people who do the application development. For DNN the inputs may be signed depends on how they process it. |
I was templating my testbench to support different types, including the signed and unsigned variants. Images support unsigned and signed types. |
Whenever the high bit for the input is high, i.e. when the value is larger than
0x80
, the current fault will pad 1's to make an negative number. This patch use masks to mask them off.That's the cause that why
verilator
failed inGarnetFlow
butncsim
works: https://github.com/StanfordAHA/GarnetFlow/commits/masterEDIT:
Travis version is working with this fix: https://travis-ci.com/StanfordAHA/GarnetFlow/builds/112535673