Basic passthrough working

... but super unstable. It looks as if pixel data gets subtly corrupted
when output over HDMI.

To-Do:
 * Check whether broken output persists on Windows and is not linux-only
 * Check whether output is still broken if software
   rendering/window compositing is used
 * Maybe check on an apple platform?
 * Research this behavior
This commit is contained in:
jaseg 2021-06-25 19:55:58 +02:00
parent df66872fee
commit d49062bddb
6 changed files with 32853 additions and 39 deletions

View file

@ -411,6 +411,7 @@
<FileSet Name="ila_0" Type="BlockSrcs" RelSrcDir="$PSRCDIR/ila_0">
<File Path="$PSRCDIR/sources_1/ip/ila_0/ila_0.xci">
<FileInfo>
<Attr Name="AutoDisabled" Val="1"/>
<Attr Name="UsedIn" Val="synthesis"/>
<Attr Name="UsedIn" Val="implementation"/>
<Attr Name="UsedIn" Val="simulation"/>

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@
module term_renderer(
input rst, clk,
input in_vsync, in_hsync,
input in_blank, in_vsync, in_hsync,
input [19:0] glyphmem_data,
output [15:0] glyphmem_r_addr,
@ -23,12 +23,21 @@ localparam FONT_GLYPH_W = `GEN_FONT_GLYPH_W_default;
localparam FONT_GLYPH_H = `GEN_FONT_GLYPH_H_default;
localparam FONT_GLYPH_COUNT = `GEN_FONT_GLYPH_COUNT_default;
reg [FONT_GLYPH_W-1:0] glyph_table_default [0:FONT_GLYPH_COUNT*FONT_GLYPH_H-1];
/* This is the dumbest thing, but it seems vivado is just *that* stupid. */
`ifdef SYNTHESIS
initial $readmemh("../../src/gen/gen_glyphtable_default.hex", glyph_table_default);
`else
initial $readmemh("../../../../src/gen/gen_glyphtable_default.hex", glyph_table_default);
`endif
`include "gen/gen_font_params_bold.vh"
/* NOTE: Bold font must have same glyph w/h, glyph count as regular font above */
reg [FONT_GLYPH_W-1:0] glyph_table_bold [0:FONT_GLYPH_COUNT*FONT_GLYPH_H-1];
`ifdef SYNTHESIS
initial $readmemh("../../src/gen/gen_glyphtable_bold.hex", glyph_table_bold);
`else
initial $readmemh("../../../../src/gen/gen_glyphtable_bold.hex", glyph_table_bold);
`endif
/* Color palette */
function [23:0] color_palette;
@ -109,7 +118,7 @@ always @(posedge clk) begin
px_y <= 0;
end
end else if (in_hsync) begin
end else if (!in_blank) begin
if (px_x != FONT_GLYPH_W-1) begin
px_x <= px_x + 1;

View file

@ -243,7 +243,15 @@ end
/* glyph memory logic */
reg [19:0] glyphmem [0:GLYPHMEM_W*GLYPHMEM_H-1];
/* This is the dumbest thing, but it seems vivado is just *that* stupid. */
`ifdef SYNTHESIS
initial $readmemh("../../src/gen/glyph_buffer_init_file.hex", glyphmem);
`else
initial $readmemh("../../../../src/gen/glyph_buffer_init_file.hex", glyphmem);
`endif
reg [19:0] glyphmem_r_data;
wire [15:0] glyphmem_r_addr;
always @(posedge clk) begin
if (glyph_buffer_w_valid) begin
glyphmem[glyph_buffer_w_addr] <= glyph_buffer_w_data;
@ -290,9 +298,13 @@ term_renderer #(
.rst(rst),
.clk(clk),
.in_blank(win_blank),
.in_vsync(in_vsync),
.in_hsync(in_hsync),
.out_hsync(),
.out_vsync(),
.glyphmem_data(glyphmem_r_data),
.glyphmem_r_addr(glyphmem_r_addr),
@ -346,6 +358,7 @@ window_matcher window_matcher_i (
.out_blue(out_blue)
);
/*
ila_0 i_ila_0 (
.clk(clk),
@ -366,5 +379,6 @@ ila_0 i_ila_0 (
.probe14(out_hsync),
.probe15(out_vsync)
);
*/
endmodule

View file

@ -3,7 +3,7 @@
{
"cell_type": "code",
"execution_count": 121,
"id": "correct-stationery",
"id": "martial-democrat",
"metadata": {},
"outputs": [],
"source": [
@ -20,7 +20,7 @@
{
"cell_type": "code",
"execution_count": 94,
"id": "sustainable-intranet",
"id": "flexible-synthetic",
"metadata": {},
"outputs": [],
"source": [
@ -63,7 +63,7 @@
{
"cell_type": "code",
"execution_count": 185,
"id": "ignored-chart",
"id": "fifteen-swimming",
"metadata": {},
"outputs": [],
"source": [
@ -83,7 +83,7 @@
{
"cell_type": "code",
"execution_count": 111,
"id": "original-module",
"id": "excessive-permit",
"metadata": {},
"outputs": [],
"source": [
@ -94,28 +94,49 @@
},
{
"cell_type": "code",
"execution_count": 173,
"id": "interracial-gambling",
"execution_count": 192,
"id": "cathedral-information",
"metadata": {},
"outputs": [],
"source": [
"with open('test_data/test_glyphmem_data.hex', 'w') as f:\n",
" for row in range(128):\n",
" for col, c in enumerate(itertools.islice(itertools.cycle(string.printable), row, row+256)):\n",
" if col == row+30:\n",
" c = '\\n'\n",
" underline = bool(row&1)\n",
" bold = bool(row&2)\n",
" bgcolor = max(0, col%24-8) if col//24%2 == 1 else 0\n",
" fgcolor = 0 if col//24%2 == 1 and col%24 > 8 else (7 if col%24<8 else col%24-8)\n",
" code = (int(underline)<<19) | (int(bold)<<18) | (bgcolor<<12) | (fgcolor<<8) | ord(c)\n",
" print(f'{code:05x}', file=f)"
"def write_glyph_buffer_init_file(fn):\n",
" with open(fn, 'w') as f:\n",
" for row in range(128):\n",
" for col, c in enumerate(itertools.islice(itertools.cycle(string.printable), row, row+256)):\n",
" if col == row+30:\n",
" c = '\\n'\n",
" underline = bool(row&1)\n",
" bold = bool(row&2)\n",
" bgcolor = max(0, col%24-8) if col//24%2 == 1 else 0\n",
" fgcolor = 0 if col//24%2 == 1 and col%24 > 8 else (7 if col%24<8 else col%24-8)\n",
" code = (int(underline)<<19) | (int(bold)<<18) | (bgcolor<<12) | (fgcolor<<8) | ord(c)\n",
" print(f'{code:05x}', file=f)"
]
},
{
"cell_type": "code",
"execution_count": 193,
"id": "available-being",
"metadata": {},
"outputs": [],
"source": [
"write_glyph_buffer_init_file('test_data/test_glyphmem_data.hex')"
]
},
{
"cell_type": "code",
"execution_count": 198,
"id": "hollow-husband",
"metadata": {},
"outputs": [],
"source": [
"write_glyph_buffer_init_file(f'../src/gen/glyph_buffer_init_file.hex')"
]
},
{
"cell_type": "code",
"execution_count": 172,
"id": "later-listing",
"id": "selective-pepper",
"metadata": {},
"outputs": [
{
@ -137,7 +158,7 @@
{
"cell_type": "code",
"execution_count": 175,
"id": "oriental-blake",
"id": "alone-olympus",
"metadata": {},
"outputs": [
{
@ -159,7 +180,7 @@
{
"cell_type": "code",
"execution_count": 176,
"id": "tamil-fault",
"id": "certified-olive",
"metadata": {},
"outputs": [
{
@ -181,7 +202,7 @@
{
"cell_type": "code",
"execution_count": 186,
"id": "organized-ceiling",
"id": "empty-scoop",
"metadata": {},
"outputs": [
{
@ -203,7 +224,7 @@
{
"cell_type": "code",
"execution_count": 191,
"id": "violent-swaziland",
"id": "christian-intention",
"metadata": {},
"outputs": [
{