--Converting DE1-SoC_Computer_15_1 to 640x480
The directions written by Shiva Rajagopal for Qsys 640x480 converstion worked for this system. (system ZIP) The span of the addresses in the virtual-to-real memory map had to be doubled. and, of course, the addressing and colors of pixels had to be modified in the main program.
The size of the character buffer was not changed. The color encoding is
now 8-bit with top 3 bits red, next 3 green, lower 2 bits blue.
VGA_line(0, 0, 320, 240, 0xe0) ; // red 3-bits
VGA_line(639, 0, 320, 240, 0x1c) ; // green 3-bits
VGA_line(639, 479, 320, 240, 0x03) ; // blue
2-bits
The design was very slow to generate (Qsys) and compile (Quartus). It
took around an hour (on my 5 year old machine). Next step is to speed it
up. Chopping out the Nios CPUs and some of the support, but leaving the
video in/out and audio reduces the generate time to 5 minutes and the
compile time to about 22 minutes. (archive).
Stripping out the rest of the LED and switch i/o and removing the
video-input funciton reduces the compile time to 18 minutes.
A better chopped down system keeps the LEDs, switches, 640x480 video out, and audio. The design is partitioned so that the DE1-SoC computer is in its own partition. Two other partitions are top and the hex display modules. On my new computer (4 core, 32 GB memory, SSD, July 2016), this takes 12 minutes for a full compile. A small change to the hex display partition takes about 8.5 minutes to recompile. A small C code tests the hex display partition. (C code, address header, project ZIP).
-- Graphics primitives on VGA/HPS
A
few more 2D drawing primitives were added to draw points, lines, fast
vertical lines, fast horizontal lines, discs, circles, text, filled
rectangles and rectangle edges. As above, color is 8-bit, resolution is
640x480. Also, there is a routine to clear text from the frame buffer.
Clearing the image plane is done by writing a large, black, filled
rectangle. Use the sof file from the "better chopped down system" above.
Code
I wrote a color chooser
that lays out a grid of all the possible 8-bit colors in hexidecimal
order , then prompts you for the location and index of up to four
different colors for comparison in a larger patch. You get the index by
adding the column and row numbers for a given color. Ordering is [red
7:5, green 4:2, blue 1:0] . You set the location of the larger patch as
an integer 0-3. Code.
Reordering the color patches to make four 64-patch red-green planes, with increading blue content makes a nicer display. The hex equivalent is displayed on each patch. Code.