diff options
author | Eric Anholt <eric@anholt.net> | 2007-10-18 11:17:38 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-10-18 11:29:24 -0700 |
commit | 1f8bf110394cc1df66aae9acf5c818145ae19b52 (patch) | |
tree | 39f44dfec7bf05a91023089a939be4e5b73384c8 /src/scripts/fix.5c | |
parent | 79636b8c776ae024518103c9fa137c8498c21d48 (diff) |
Add some nickle scripts for looking at PLL issues.
While here, move similar nickle scripts under src/scripts/
Diffstat (limited to 'src/scripts/fix.5c')
-rw-r--r-- | src/scripts/fix.5c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/scripts/fix.5c b/src/scripts/fix.5c new file mode 100644 index 00000000..b758a433 --- /dev/null +++ b/src/scripts/fix.5c @@ -0,0 +1,14 @@ +/* + * Convert CSC fix point values to floats + */ + +real fixval (int fix) +{ + int exp = fix >> 9; + int mant = fix & ((1 << 9) - 1); + real ret; + if (exp == 0x7) + return 1.0; + ret = (2 ** -exp) * mant / (1 << 9); + return ret; +} |