1280x1024 display: 80x32 big font or 132x64 (DECCOLM)
The display runs at 1280x1024 60 Hz from a second MMCM (108 MHz pixel clock), one pixel per clock through a four-stage pipeline. 80 columns show 80x32 cells of 16x32 pixels (the 8x16 font doubled); CSI ?3 h switches to 132x64 cells of 8x16 pixels, centred, and CSI ?3 l back, both clearing the screen and margins as a VT100 does. The 320x240 graphics layer is drawn 4x4 in the top 960 lines, so 80-column row r still meets graphics line 8(r-1). The terminal engine has 6-bit rows and 8-bit columns, a 132-cell row stride in both layouts (so the copy engine is unchanged), 132 tab stops and 3-digit cursor reports. The character RAM holds two 132x64 pages (normal and alternate) and is read on the pixel clock. BASIC's LOCATE takes rows up to 64 and columns up to 132. terminfo has basys3 (80x32) and basys3-w (132x64). The testbench reads the 132-cell layout, checks 1280x1024 sync timing, captures 1280x1024 frames and tests DECCOLM both ways. Timing met (0.044 ns at 90 MHz CPU, 108 MHz pixel); 46 of 50 BRAMs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
634e314010
commit
88b5942da5
12 files changed
+354
-220
No files matched your search
+47
-15
@@ -237,7 +237,7 @@ module basys3_terminal #(
|
||||
// Start-up banner, fed in like received text. Bytes are read from the
|
||||
// high end of the string; the unused high bytes are zero and skipped.
|
||||
localparam [8*200-1:0] BANNER = {
|
||||
"\033[1mBasys 3 VT220 Terminal\033[0m 80x30 ",
|
||||
"\033[1mBasys 3 VT220 Terminal\033[0m 80x32 ",
|
||||
"\033[31mc\033[33mo\033[32ml\033[36mo\033[34mu\033[35mr\033[0m ",
|
||||
"\033[4munderline\033[0m\015\012",
|
||||
"UART RX -> screen, keyboard -> UART TX TERM=basys3 or vt220\015\012\012"};
|
||||
@@ -264,6 +264,27 @@ module basys3_terminal #(
|
||||
BUFG cpu_bufg (.I(cpu_clk_mmcm), .O(cpu_clk));
|
||||
`endif
|
||||
|
||||
// ------------------------------------------------- pixel clock, 108 MHz
|
||||
// 1280x1024 at 60 Hz: 100 MHz x 10.125 / 9.375
|
||||
wire pix_clk;
|
||||
`ifdef SIMULATION
|
||||
assign pix_clk = clk;
|
||||
`else
|
||||
wire pix_fb, pix_clk_mmcm;
|
||||
MMCME2_BASE #(
|
||||
.CLKIN1_PERIOD(10.0), .DIVCLK_DIVIDE(1),
|
||||
.CLKFBOUT_MULT_F(10.125), .CLKOUT0_DIVIDE_F(9.375)
|
||||
) pix_mmcm (
|
||||
.CLKIN1(clk), .CLKFBIN(pix_fb), .CLKFBOUT(pix_fb), .CLKFBOUTB(),
|
||||
.CLKOUT0(pix_clk_mmcm), .CLKOUT0B(), .CLKOUT1(), .CLKOUT1B(), .CLKOUT2(),
|
||||
.CLKOUT2B(), .CLKOUT3(), .CLKOUT3B(), .CLKOUT4(), .CLKOUT5(), .CLKOUT6(),
|
||||
.LOCKED(), .PWRDWN(1'b0), .RST(1'b0)
|
||||
);
|
||||
BUFG pix_bufg (.I(pix_clk_mmcm), .O(pix_clk));
|
||||
`endif
|
||||
(* ASYNC_REG = "TRUE" *) reg [1:0] pix_rst_s;
|
||||
always @(posedge pix_clk) pix_rst_s <= {pix_rst_s[0], rst};
|
||||
|
||||
(* ASYNC_REG = "TRUE" *) reg [2:0] cpu_rst_s;
|
||||
always @(posedge cpu_clk) cpu_rst_s <= {cpu_rst_s[1:0], rst | zrst_sync[1] | (cad_t != 0) | !locked};
|
||||
|
||||
@@ -311,7 +332,7 @@ module basys3_terminal #(
|
||||
.rx_req(zrx_req), .rx_data(zrx_data), .rx_ack(zrx_ack),
|
||||
.tx_req(ztx_req), .tx_data(ztx_data), .tx_ack(ztx_ack),
|
||||
.seg_val(z80_seg), .halted(), .brk_key(brk_s[2] ^ brk_s[1]),
|
||||
.vclk(clk), .gfx_vaddr(gfx_addr), .gfx_vpix(gfx_pix),
|
||||
.vclk(pix_clk), .gfx_vaddr(gfx_addr), .gfx_vpix(gfx_pix),
|
||||
.fl_cs_n(QspiCSn), .fl_sck(fl_sck), .fl_mosi(QspiDB[0]), .fl_miso(QspiDB[1])
|
||||
);
|
||||
|
||||
@@ -379,16 +400,24 @@ module basys3_terminal #(
|
||||
);
|
||||
|
||||
// ------------------------------------------------------------- terminal
|
||||
wire [11:0] t_addr;
|
||||
wire alt_scr;
|
||||
wire [13:0] t_addr;
|
||||
wire alt_scr, wide;
|
||||
wire t_we;
|
||||
wire [17:0] t_wdata, t_rdata;
|
||||
wire [4:0] cur_row, stop, sbot, sm_off;
|
||||
wire [6:0] cur_col;
|
||||
wire [5:0] cur_row, stop, sbot;
|
||||
wire [4:0] sm_off;
|
||||
wire [7:0] cur_col;
|
||||
wire cur_vis, sm_on, sm_dir;
|
||||
wire [3:0] dec_leds;
|
||||
wire bell;
|
||||
wire frame_tick;
|
||||
wire frame_tick, pix_frame;
|
||||
|
||||
// start of vertical blanking, from the pixel clock to this one
|
||||
reg frame_t = 1'b0;
|
||||
always @(posedge pix_clk) if (pix_frame) frame_t <= ~frame_t;
|
||||
(* ASYNC_REG = "TRUE" *) reg [2:0] frame_s = 3'd0;
|
||||
always @(posedge clk) frame_s <= {frame_s[1:0], frame_t};
|
||||
assign frame_tick = frame_s[2] ^ frame_s[1];
|
||||
|
||||
term_ctrl term (
|
||||
.clk(clk), .rst(rst), .in_byte(tq), .in_empty(tq_empty), .in_rd(tq_rd),
|
||||
@@ -399,25 +428,28 @@ module basys3_terminal #(
|
||||
.stop(stop), .sbot(sbot), .sm_on(sm_on), .sm_dir(sm_dir), .sm_off(sm_off),
|
||||
.resp_byte(resp_byte), .resp_wr(resp_wr), .resp_full(rq_full),
|
||||
.cursor_app(cursor_app), .keypad_app(keypad_app), .lnm(lnm),
|
||||
.dec_leds(dec_leds), .bell(bell), .alt_scr(alt_scr)
|
||||
.dec_leds(dec_leds), .bell(bell), .alt_scr(alt_scr), .wide(wide)
|
||||
);
|
||||
|
||||
wire [11:0] v_addr;
|
||||
wire [13:0] v_addr;
|
||||
wire [17:0] v_data;
|
||||
|
||||
// the alternate screen (the Z-80 monitor uses it) has no graphics layer
|
||||
// The display reads the terminal's cursor and modes across clocks: they
|
||||
// change rarely and a stale value lasts one pixel.
|
||||
// The alternate screen (the Z-80 monitor uses it) has no graphics layer.
|
||||
char_ram screen (
|
||||
.clk(clk),
|
||||
.a_addr({alt_scr, t_addr}), .a_we(t_we), .a_wdata(t_wdata), .a_rdata(t_rdata),
|
||||
.b_addr({alt_scr, v_addr}), .b_rdata(v_data)
|
||||
.clk(clk), .a_alt(alt_scr),
|
||||
.a_addr(t_addr), .a_we(t_we), .a_wdata(t_wdata), .a_rdata(t_rdata),
|
||||
.vclk(pix_clk), .b_alt(alt_scr), .b_addr(v_addr), .b_rdata(v_data)
|
||||
);
|
||||
|
||||
text_display #(.FONT_FILE(FONT_FILE)) video (
|
||||
.clk(clk), .rst(rst), .cur_row(cur_row), .cur_col(cur_col), .cur_vis(cur_vis),
|
||||
.clk(pix_clk), .rst(pix_rst_s[1]), .wide(wide),
|
||||
.cur_row(cur_row), .cur_col(cur_col), .cur_vis(cur_vis),
|
||||
.stop(stop), .sbot(sbot), .sm_on(sm_on), .sm_dir(sm_dir), .sm_off(sm_off),
|
||||
.ram_addr(v_addr), .ram_data(v_data), .gfx_addr(gfx_addr), .gfx_pix(alt_scr ? 4'd0 : gfx_pix),
|
||||
.red(vgaRed), .green(vgaGreen), .blue(vgaBlue), .hsync(Hsync), .vsync(Vsync),
|
||||
.frame_tick(frame_tick)
|
||||
.frame_tick(pix_frame)
|
||||
);
|
||||
|
||||
// ----------------------------------------------------- status displays
|
||||
|
||||
Reference in new issue
Block a user