David Gow [Sun, 6 Jul 2014 14:31:09 +0000 (22:31 +0800)]
Maybe this is more correct. realops likes it.
David Gow [Sun, 6 Jul 2014 14:23:57 +0000 (22:23 +0800)]
digit_t is now unsigned, asm division for 1 digit
We now do the "two's complement" in SubBasic by hand. It is maybe even
correct.
David Gow [Sun, 6 Jul 2014 13:51:10 +0000 (21:51 +0800)]
Rational<Arbint> now passes realops.test
Sam Moore [Sun, 6 Jul 2014 12:30:40 +0000 (20:30 +0800)]
Arbint now does sign in division correctly
The tester still sometimes picks up a fith Rational<Arbint> /= operation though.
Sam Moore [Sun, 6 Jul 2014 12:17:09 +0000 (20:17 +0800)]
More testing particularly of negatives
Sam Moore [Sun, 6 Jul 2014 11:45:52 +0000 (19:45 +0800)]
Merge branch 'master' of git.ucc.asn.au:/ipdf/code
Dammit I forgot to `git stash; git pull; git stash apply`
Sam Moore [Sun, 6 Jul 2014 11:44:50 +0000 (19:44 +0800)]
Improved "realops" tester
And there are signs of serious problems in Arbint too!
Sam Moore [Sun, 6 Jul 2014 10:19:34 +0000 (18:19 +0800)]
Slightly less memory errors
Using more std::vector and less memcpy/memset etc.
Still seems to have issues but not segfaulting as much.
Fixed m_sign missing in = operator
David Gow [Sun, 6 Jul 2014 09:50:49 +0000 (17:50 +0800)]
Fix a warning/compile error.
Sam Moore [Sun, 6 Jul 2014 09:32:28 +0000 (17:32 +0800)]
Horribly unreliable Arbint's and Rational<Arbint>'s
Changes from before: Arbint's use a division algorithm based on bitshifting.
So, you might get a random segfault (if you scroll you will definitely get a random segfault)
and pretty much every single operation with Rational<Arbints> gives you an accuracy warning...
And yet somehow I can render a Bezier. Really slowly.
David Gow [Sun, 6 Jul 2014 08:30:39 +0000 (16:30 +0800)]
Some initial QuadTree goodness.
David Gow [Sun, 6 Jul 2014 06:17:33 +0000 (14:17 +0800)]
Render object range on the CPU
David Gow [Sun, 6 Jul 2014 05:41:16 +0000 (13:41 +0800)]
Render part of a document (incorrectly) on the GPU
In order to get QuadTrees working, we're going to need to
render small "parts" of a document individually. The way this works
is that, when calling RenderObjectsOnGPU, we now pass a range of
object IDs. The ObjectRenderer will then find (in O(N) time, sadly)
the range of indices needed for that object type and then render those.
Béziers, and other objects which rely on the ObjectID on the GPU being
correct might be broken by this (in some cases), though if so it shouldn't
be too hard to fix by passing an offset in as a uniform.
David Gow [Sun, 6 Jul 2014 01:46:52 +0000 (09:46 +0800)]
now with fewer midnight-isms
David Gow [Sat, 5 Jul 2014 16:32:16 +0000 (00:32 +0800)]
This might help: divide an arbint by a uint64
Sam Moore [Sat, 5 Jul 2014 10:05:46 +0000 (18:05 +0800)]
Add assembly sources to git
Sam Moore [Sat, 5 Jul 2014 09:33:39 +0000 (17:33 +0800)]
Division less buggy, still slow
Ok I need to put more thought into this. Or just look it up.
Sam Moore [Sat, 5 Jul 2014 07:52:38 +0000 (15:52 +0800)]
It compiles... and runs with FPS of zero
Well I suppose this shouldn't have been totally unexpected...
Sam Moore [Sat, 5 Jul 2014 07:31:02 +0000 (15:31 +0800)]
Arbint class implemented
Seems to not explode, at least, when it only has one digit...
Sam Moore [Sat, 5 Jul 2014 05:56:01 +0000 (13:56 +0800)]
Inner step of multiplication in x64 assembly
Just does the multiplication of the array by one digit, taking into account overflows.
I hope. It's kind of difficult to test.
What I need is a VM with equivelant instruction set but magically uses decimals instead of binary 64 bit, so I can test with numbers
that my feeble human brain understands directly...
Sam Moore [Sat, 5 Jul 2014 04:44:48 +0000 (12:44 +0800)]
Arbint class with += and -= operators
Using x64 assembly routines for addition and subtraction loops,
but C++ for memory management through std::vector
Dealing with the sign is a bit annoying.
(Get it?)
David Gow [Fri, 4 Jul 2014 13:47:33 +0000 (21:47 +0800)]
Use the lea instruction to reduce number of "inc"s
Sam Moore [Fri, 4 Jul 2014 13:20:33 +0000 (21:20 +0800)]
More moronic bugs
So that P/-Q simplifies to -P/Q, -P/-Q simplifies to P/Q, properly this time
Sam Moore [Fri, 4 Jul 2014 13:08:35 +0000 (21:08 +0800)]
Arbitrary integer addition in x64 assembly
Who needs portability?
Also yes I could probably just use a library but that seems like cheating.
Sam Moore [Fri, 4 Jul 2014 06:05:44 +0000 (14:05 +0800)]
Maybe don't use all of the lines. Or maybe do.
The CPU version. CPU rendering still looks slightly different to GPU.
Replicates behaviour in
54798ed9050d0742c6cdab067fad0cc364b1d6b2
Also actually use the right +/- operators for Rational.
Oh and compile as rational by default because we like things to explode right?
Sam Moore [Fri, 4 Jul 2014 05:09:47 +0000 (13:09 +0800)]
Moronic bug identified, also Backtrace is a thing now
Copy/Paste bug @rational.h:123
At least division and addition both involve maths right?
Sam Moore [Mon, 30 Jun 2014 04:29:14 +0000 (12:29 +0800)]
Rational representation
Buggy, partly due to integer overflows, partly due to moronic bugs that have yet to be determined.
David Gow [Mon, 30 Jun 2014 04:26:52 +0000 (12:26 +0800)]
Maybe don't use all of the lines. Or maybe do.
David Gow [Thu, 19 Jun 2014 06:20:15 +0000 (14:20 +0800)]
Fix the missing bit of GPU béziers.
Off by one!
David Gow [Wed, 18 Jun 2014 15:36:27 +0000 (23:36 +0800)]
Béziers on the GPU.
So this was a terrible thing in many ways.
What we're doing:
- Converting all of the coefficients to floats (+ doing a bit of
preprocessing) and uploading the the GPU.
- Uploading the data_indices array from the document to the GPU.
- Using the vertex ids in the IBO when rendering béziers to get
the object id, then looking up the data_indices array (as a texture)
to find which bézier coefficients to use, then reading the bézier
coefficients from another buffer texture and finally having the
geometry shader generate 100 lines much as the CPU one does.
We're using buffer textures to access these things because they don't
have fixed sizes (and can get big), so we can't use uniform buffers and
because shader storage buffer objects need OpenGL 4.3, which only graphics
cards manufactured in the last 45 seconds actually support.
Sam Moore [Wed, 18 Jun 2014 09:19:40 +0000 (17:19 +0800)]
The Béziers are quadratic not cubic...
I can maths
Sam Moore [Wed, 18 Jun 2014 08:41:40 +0000 (16:41 +0800)]
Béziers
It's hard to type the ́e so I will just call them Beziers from now.
New struct represents a cubic bezier, can be evaluated. The Objects struct contains a vector of beziers, and a vector of indices for each object.
If an ObjectType is BEZIER than the index can be used to look up the bezier control points. Control points are relative to the bounding rectangle;
so we can reuse the same curves (eg: For fonts).
Rendering happens on CPU only, sub divide and use Bresenham lines.
Bresenham lines are not quite optimal but I eventually gave up.
So we don't have a "line" type, but you can make one by creating a Bezier where x1,y1 == x0,y0
They look kind of wobbly.
Save/Load not tested. It might break. But it will have to be pretty heavily rewritten soon anyway.
Sam Moore [Tue, 17 Jun 2014 09:26:46 +0000 (17:26 +0800)]
Performance graphs!
Amazeballs
Sam Moore [Tue, 17 Jun 2014 09:25:47 +0000 (17:25 +0800)]
Python script for plotting data using Gnuplot
Sam Moore [Tue, 17 Jun 2014 03:45:11 +0000 (11:45 +0800)]
Bugfixes for CPU rendering
Fix segfault caused by RectOutlineRenderer not properly checking bounds on pixel array.
Fix positioning of RectOutline sides in other locations when they were off the screen.
When you zoom in too far, an integer overflow will occur and the CPU rendered objects disappear.
This occured at widths of about 1e-7 (for our test pattern). Improved for now by int -> int64_t
Later need to replace everything except the actual array access with Real's I think. Then make Real's arbitrary precision. Done.
There is a slight size difference between CPU rendered and GPU rendered objects; not sure what the source of this is. Blame rounding.
GPU sometimes leaves off the corner pixels of the rectangles by the way.
David Gow [Tue, 17 Jun 2014 02:14:44 +0000 (10:14 +0800)]
Fix RenderPixels, CPU rendering "works"
Sam Moore [Mon, 16 Jun 2014 17:01:55 +0000 (01:01 +0800)]
Implemented CPU rendering for current ObjectTypes
RECT_FILLED (easy), RECT_OUTLINE (ok I need to maths), CIRCLE_FILLED (oh my god how do I maths)
Screen::RenderPixels is FITH but can see the correct(ish) output in "cpu_rendering_last_frame.bmp"
TODO:
- Fix Screen::RenderPixels
- Fix reading a BMP from the screen (so we can do "gpu_rendering_last_frame.bmp" as well)
- Put Beziers in
- Implement infinite precision document format
- Profit
Sam Moore [Mon, 16 Jun 2014 14:19:32 +0000 (22:19 +0800)]
Refactor Rendering of Objects (prepare for CPU rendering)
New abstract class ObjectRenderer and derived classes for each type of Object.
It's a bit more complex but hopefully easier to build on now.
There are probably a heap of bugs in this, but I can see the test pattern again, so I'll commit before it gets worse.
Note: We now have to make sure Screen is initialised first or the segfaults will hit the fan.
(Now it makes sense why all those things weren't in constructors in the first place :S)
It also now segfaults if you get View and Screen the wrong way round.
David Gow [Mon, 16 Jun 2014 04:14:43 +0000 (12:14 +0800)]
The magic RenderPixels function.
Sam Moore [Mon, 16 Jun 2014 03:13:16 +0000 (11:13 +0800)]
GLSL Shaders -> Files (instead of #define)
So we can edit them without going insane.
David Gow [Thu, 5 Jun 2014 15:22:30 +0000 (23:22 +0800)]
Work around a bug in the Intel driver
Looks like we found a new bug in the intel driver!
https://bugs.freedesktop.org/show_bug.cgi?id=79685
David Gow [Thu, 5 Jun 2014 09:26:21 +0000 (17:26 +0800)]
Circles (ellipses) have been added (filled only)
David Gow [Wed, 4 Jun 2014 14:34:02 +0000 (22:34 +0800)]
Minor perf improvement on nVidia
nVidia's driver does not like you mapping a STATIC buffer, as they're
usually in parts of VRAM not directly accessible by the CPU. The driver
therefore has to migrate the buffer somewhere slower.
We initialize the object bounds buffer by mapping it and writing directly
into it. This is good where we're doing coordinate transform on the CPU:
we're changing it every frame and it can be a dynamic buffer, but we only
need to do it once if the GPU is doing coordinate transforms so we make it a
static buffer.
This change "fakes" mapping a STATIC buffer for the first time by allocating
some CPU-side memory, having the application write into that, and then initializing
the buffer with that. This removes a performance warning on nVidia when switching
to GPU-side coordinate transforms.
David Gow [Sun, 1 Jun 2014 07:58:07 +0000 (15:58 +0800)]
Fix an intel LG warning by orphaning text memory
David Gow [Sun, 1 Jun 2014 06:41:43 +0000 (14:41 +0800)]
No more pointer arithmetic in GL/use geom shaders
David Gow [Sat, 31 May 2014 13:15:20 +0000 (21:15 +0800)]
Maybe make some GL code easier to understand
David Gow [Mon, 26 May 2014 04:16:50 +0000 (12:16 +0800)]
Updated upstream stb_truetype with warning fix
David Gow [Sun, 25 May 2014 07:42:47 +0000 (15:42 +0800)]
Fix all of the warnings, re-enable -Werror, etc.
Sam Moore [Fri, 9 May 2014 12:23:50 +0000 (20:23 +0800)]
Fix the Floating Point
Pun intended
I had two bugs that cancelled each other out and made a self consistent float that was wrong except for all the ones I compared it to!
David helped fix it.
Sam Moore [Thu, 8 May 2014 09:26:43 +0000 (17:26 +0800)]
Tests: MakeBitmap -> PointsToBitmap in its own header
To use in other testers.
Sam Moore [Thu, 8 May 2014 05:30:39 +0000 (13:30 +0800)]
Tester for Beziers
After a brief* exciting time in which I thought Beziers looked strange at big enough scales, they don't.
Not much progress on the Lit Review front...
Sam Moore [Thu, 1 May 2014 16:21:11 +0000 (00:21 +0800)]
Test from one of Kahan's articles
"Why is Floating-Point Computation so Hard to Debug when it Goes Wrong?"
This is a MUCH better example than massive rounding errors as in calculatepi.test
Sam Moore [Thu, 1 May 2014 10:55:28 +0000 (18:55 +0800)]
Tester from some lecture notes by Kahan
Supposedly this is a benchmark for determining the worst accuracy of a CPU using roots to a quadratic
I think something wierd is going on; a result of infinity means there is no rounding errors but I'm not sure what results of -nan mean
and that's what I get.
The article is referenced as kahan1996ieee754 in the literature notes
Sam Moore [Wed, 30 Apr 2014 13:44:34 +0000 (21:44 +0800)]
Merge branch 'master' of git.ucc.asn.au:/ipdf/code
Forgot to run `git pull` earlier.
No conflicts.
Sam Moore [Wed, 30 Apr 2014 13:36:27 +0000 (21:36 +0800)]
Tester for loading document in XML format
Inspired by the fact that SVG and HTML are XML and I was trying to write about them in the Literature Notes.
The pugixml library for C++ seems actually usable.
Could do a number of fancy things using it, but really should get back to that Literature Review :S
Sam Moore [Wed, 30 Apr 2014 13:35:16 +0000 (21:35 +0800)]
Add pugixml-1.4 to contrib
pugixml is a "lightweight" XML parser implemented in C++
David Gow [Sun, 27 Apr 2014 13:59:06 +0000 (21:59 +0800)]
Add GPU performance queries.
David Gow [Sun, 27 Apr 2014 09:09:20 +0000 (17:09 +0800)]
OpenGL 3.1 core profile support.
If you thought the graphics code was ugly before, wait until you try this!
Sam Moore [Fri, 25 Apr 2014 16:37:43 +0000 (00:37 +0800)]
Test representations of floats working*
The boat is floating for now, we just need to make sure it doesn't sink.
BitsToReal and BitsFromReal are consistent with each other...
*Actually looking at the results, for <5,10> vs IEEE half precision... something is wrong
The plot still looks float-ish though.
Sam Moore [Wed, 23 Apr 2014 16:36:25 +0000 (00:36 +0800)]
Yeah it's broken
Sam Moore [Wed, 23 Apr 2014 16:33:13 +0000 (00:33 +0800)]
Change float representations to be more IEEE-ish
Implemented BitsToReal WRONGLY for like 6 hours.
It's probably still wrong. It works for 8 bit (2,5) floats but probably only because I got lucky.
I am a bit shit at bit shifting.
Sam Moore [Tue, 22 Apr 2014 18:00:24 +0000 (02:00 +0800)]
Tester for exploring the mapping of a float to a real
To visualise the mapping and how you get the trade off between precision and range.
Use low precision, custom, float representations.
Convert via memcpy(3) and copious bit shifting to a Real
Even though Real is actually also a float (default double) at the moment, it's good enough to treat as being an exact representation
when the custom float is 8 bits. Besides, gnuplot can only plot within double precision anyway.
I say "custom" because I have an explicit sign bit for the exponent, which itself is unsigned.
I *think* standard representations have the exponent be a signed int so the sign bit is implied.
Not sure why the mantissa is treated as being unsigned with an explicit sign bit but the exponent isn't?
HFPA says the exponent is between e_min and e_max which is a bit confusing. Is e_min != -e_max normally?
Will do some plots and experiment a bit after sleep.
Sam Moore [Tue, 22 Apr 2014 10:34:43 +0000 (18:34 +0800)]
Tester based on Handbook of Floating-Point Arithmetic 1.1
See also ipdf/documents
David Gow [Tue, 22 Apr 2014 08:35:52 +0000 (16:35 +0800)]
Hideously useless buffer perf optimization.
Sam Moore [Tue, 22 Apr 2014 07:53:33 +0000 (15:53 +0800)]
Fix Makefile
The $(BIN) target needed to include the dependencies for header files included via main.cpp
David Gow [Tue, 22 Apr 2014 07:43:45 +0000 (15:43 +0800)]
Horrible debug font bufferification. (Sorry)
David Gow [Tue, 22 Apr 2014 03:29:25 +0000 (11:29 +0800)]
Don't re-render the display if nothing has changed
We now render to an offscreen buffer, and blit that
to the screen. This probably breaks the bitmap stuff, and I'll
fix that soon.
David Gow [Tue, 22 Apr 2014 02:14:55 +0000 (10:14 +0800)]
Slightly less broken GraphicsBuffer implementation.
I copied the original out of some terrible code I'd
written ages ago. It now is less overtly broken.
I'd still like to do an optimized version with Persistant
Mapped Buffers and manual memory control, but that can wait
until post-shaderification.
Sam Moore [Mon, 21 Apr 2014 16:55:49 +0000 (00:55 +0800)]
Real that uses Fast2Sum for addition
I have a feeling this isn't going to improve things at all.
Sam Moore [Mon, 21 Apr 2014 08:47:20 +0000 (16:47 +0800)]
Ability to define Real as long double
`make DEF=-DREAL=2` to compile using long double as Real
Also changed calculatepi to include long double.
And also, only actually integrate using Real if it is something other than float, double, long double.
Sam Moore [Mon, 21 Apr 2014 06:27:00 +0000 (14:27 +0800)]
Remove DebugDumpObjects call
You almost crashed my gedit embedded terminal plugin!
David Gow [Mon, 21 Apr 2014 05:46:46 +0000 (13:46 +0800)]
Store everything in a VBO, making things faster.
Also 1024*1024 grid of boxes, for extreme slowness. Yay!
David Gow [Mon, 21 Apr 2014 04:35:36 +0000 (12:35 +0800)]
Merge branch 'master' of git.ucc.asn.au:ipdf/code
Conflicts:
src/Makefile
src/main.h
src/real.h
src/screen.cpp
src/view.h
This was one hell of a merge. I have more code coming, but
it breaks other things, so it'll take a little while.
David Gow [Sun, 20 Apr 2014 04:31:41 +0000 (12:31 +0800)]
Support doing coordinate transforms on the CPU
So because OpenGL (by default at least), does everything with
32-bit IEEE floats, even when our "Real" type is a double, we lost
precision when rendering it.
This commit adds support for running the coordinate transform on the
CPU using the Real datatype, and only truncating the results, making
things work properly with doubles. This will be slower on documents
with a large number of objects, but there's no real difference in
our unoptimized code at the moment.
Right-click to switch between CPU and GPU transforms.
David Gow [Sat, 19 Apr 2014 12:46:15 +0000 (20:46 +0800)]
Hacky debug font system, performance counter.
Sam Moore [Thu, 17 Apr 2014 12:04:35 +0000 (20:04 +0800)]
Allow setting type of Real at compilation time
Use a REAL preprocessor definition.
Pass it from the Makefile in variable DEF
Can change using `make DEF=REAL=X`
Also allowed changing bounds with arguments in main.
Probably not that useful. Might remove later.
Tried to make a tester that overlays a series of BMPs but
the RenderBMP -> ScreenShot approach only works once; subsequent attempts lead to entirely filled images.
Sam Moore [Thu, 17 Apr 2014 06:31:36 +0000 (14:31 +0800)]
Merge branch 'master' of git.ucc.asn.au:/ipdf/code
Conflicts:
src/screen.cpp
David's way is better.
Sam Moore [Thu, 17 Apr 2014 06:05:34 +0000 (14:05 +0800)]
Fix Screen::ScreenShot
Something to do with the OpenGL buffers meant that the rendered BMP wasn't in the buffer before the glReadPixels call.
I have no idea why the screenshot worked for the rectangles and not for a texture, but oh well.
David Gow [Thu, 17 Apr 2014 06:00:16 +0000 (14:00 +0800)]
Bunch-a-bugfixes!
- Screenshots work properly.
- Alpha works properly
- New screen clear function, so we don't throw away things we need.
Sam Moore [Thu, 17 Apr 2014 05:02:02 +0000 (13:02 +0800)]
Fix colour in ScreenShot
GL_RGBA -> GL_BGRA
Although... should probably have a means to detect which it is supposed to be
since it might be different on other machines?
David Gow [Thu, 17 Apr 2014 02:52:45 +0000 (10:52 +0800)]
Merge branch 'master' of git.ucc.asn.au:ipdf/code
Sam Moore [Wed, 16 Apr 2014 18:00:36 +0000 (02:00 +0800)]
Can render a BMP but things are still going wrong
If Screen::RenderBMP is called before Screen::ScreenShot, the resulting BMP is blank.
NOTE: Testing colours: If -c 1 0 0 1 is passed, rectangle is rendered RED.
However, if Screen::ScreenShot is called, the rectangle is BLUE.
Something stupid going on with colours?
Tried messing with alpha channel, but things seem to always render regardless of their alpha value.
Should give up and do something actually important.
Sam Moore [Wed, 16 Apr 2014 16:22:06 +0000 (00:22 +0800)]
Implement Pointless Broken Things
Trying to overlay the screenshot on an existing bmp to make it easier to combine the outputs of
different implementations (ie: Recompile program with a different typedef instead of using templates).
Rendering the existing bmp is proving to be a pain.
This is also using ancient opengl.
Cannot see what is wrong. I get something in the window but it does not resemble the bmp I saved at all.
And then the screenshot of *that* is just totally black.
Sam Moore [Tue, 15 Apr 2014 18:34:15 +0000 (02:34 +0800)]
Add grid lines
It seemed like a good idea at the time.
Sam Moore [Tue, 15 Apr 2014 17:50:18 +0000 (01:50 +0800)]
Screenshot using glReadPixels instead
Which SDL2 is calling underneath somewhere in that "SDL_RenderReadPixels" call.
Sam Moore [Tue, 15 Apr 2014 17:19:33 +0000 (01:19 +0800)]
Screenshot using convoluted SDL2 approach
David has just told me I should have used glReadPixels
Stay tuned for another commit.
Sam Moore [Mon, 14 Apr 2014 16:29:51 +0000 (00:29 +0800)]
Actual fix for when `uname -i` doesn't work
Just use `uname -m`
Sam Moore [Mon, 14 Apr 2014 15:28:19 +0000 (23:28 +0800)]
Reflect fixes to I/O in ipdf/vfpu
Commits in ipdf/vfpu:
354bf006d86abdfad9dbb915facec36f99af77bc
e005897cffaf46cbbed14b3cc1ef74a390c93fef
Only using 1 hex character for opcode (3 bits) and rmode (2 bits) as opposed to 1 char per bit (...)
Also no need to print extra newline; it was a bug in ipdf/vfpu
Sam Moore [Fri, 11 Apr 2014 09:31:41 +0000 (17:31 +0800)]
Remove REAL_HALF as it doesn't actually implement a half precision float
More to it than just masking bits because the sizes of the exponent differ.
Could just mask bits in the mantissa but I have horrible plans involving VFPU...
Sam Moore [Fri, 11 Apr 2014 07:12:30 +0000 (15:12 +0800)]
Allow VFPU to save output vcd file
That was amazingly simple.
Can run `gtkwave` on the output vcd file to see all the signals!
Sam Moore [Fri, 11 Apr 2014 05:36:31 +0000 (13:36 +0800)]
Modify symlinks
Using a symlink to a symlink... I don't know why. Because I can.
Sam Moore [Fri, 11 Apr 2014 05:30:53 +0000 (13:30 +0800)]
Add rounding mode to VFPU
For some reason it needs an extra newline?
It would be much better if this used binary read/write.
Will look into getting that to happen in the ipdf/vfpu repo at some point.
Sam Moore [Wed, 9 Apr 2014 17:45:06 +0000 (01:45 +0800)]
VFPU now using std::bitset instead of just float typedef
It's still 32 bits. However it might not break if I change it?
Can't test it at the moment because the virtual FPU is 32 bits still.
Sam Moore [Wed, 9 Apr 2014 15:41:58 +0000 (23:41 +0800)]
An interface for a FPU compiled from VHDL
I have tested with the FPU from https://github.com/jop-devel/jop
The way this works is really awful...
1. Make (or steal from jop) a VHDL FPU
2. Make (or steal from jop) a testbench that uses stdio to read operands and ops
- The jop one reads from a generated file, but it is trivial to change to "STD_INPUT" and remove all the assertion tests.
3. Compile testbench into an executable with ghdl
4. Call VFPU::Start which does the following:
- Create a socketpair(2)
- fork(2) and in the child dup(2) stdin/stdout to the socketpair
- Redirect stderr to /dev/null because the testbench generates 10^3 warning messages
- in the child, exec(3) the testbench FPU
5. Call VFPU::Exec passing the desired operands and opcodes
- The operands and opcodes are written as hex strings over the socketpair
- The child executing the FPU program does its thing
- The result is read back as a hex string
6. When finished, call VFPU::Halt to kill(2) the FPU
I tried to get ghdl and gcc/g++ to make a static library to call ghdl_main instead
of exec'ing things. But that didn't work. The fork and socketpair would have still been
required for that approach anyway.
TODO:
- Make the interface (not the FPU) deal with arbitrary size registers
- Wrap a Real type around it so we can #define REAL_SIMULATED_FPU
I haven't put any of the VHDL in the git repo for obvious reasons.
If I actually start messing with it, it will probably get a seperate repo.
This may end up being a complete waste of time?
Although potentially being able to run an arbitrary FPU albeit in a horrible manner does seem cool.
David Gow [Wed, 9 Apr 2014 12:17:14 +0000 (20:17 +0800)]
Merge branch 'master' of git.ucc.asn.au:ipdf/code
David Gow [Wed, 9 Apr 2014 08:22:34 +0000 (16:22 +0800)]
Fix RealToFloat test (hopefully)
Sam Moore [Wed, 9 Apr 2014 08:10:27 +0000 (16:10 +0800)]
Use x86_64 when uname is broken
Wierd...
>> sam@daedalus:~$ uname -i
>> unknown
>> sam@daedalus:~$ uname -a
>> Linux daedalus 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux
David Gow [Wed, 9 Apr 2014 08:01:54 +0000 (16:01 +0800)]
Zoom in and out with the mouse wheel.
Note that zoom-out is totally broken with half-precision,
so single-precision is the default. You can still see some artefacts
in single precision mode if you zoom in enough.
Zoom into the corner of a rectangle and then click on the corner an try to drag it.
Eventually you'll notice the reduced precision, and the rectangle will jump around.
David Gow [Wed, 9 Apr 2014 06:54:25 +0000 (14:54 +0800)]
Don't get Filled and Outline the wrong way around.
David Gow [Wed, 9 Apr 2014 06:40:43 +0000 (14:40 +0800)]
You can move around a document with Click+Drag!
Uses some scary C++11 features, so no idea if this will break the CS Lab machines
and their ancient version of gcc.
UCC git Repository :: git.ucc.asn.au