Add Verilator simulation (ImGui + headless)

verilator/ runs the core on the host with the shared FM-7 / Apple-IIgs sim
framework: windowed (ImGui/SDL2) or --headless, typing on a frame schedule,
screenshots, text-screen dump, 6809 disassembly trace, floppy/SDC/cart/cassette,
and RS-232 Pak serial debugging (TXD decoder, RXD driver, pty bridge, ACIA
trace) with a minimal DriveWire server and a script to run the real FujiNet
daemon against the sim. See verilator/README.md.

- The VHDL the build uses (ROMs, RAMs, font) is converted to Verilog in
  verilator/rtl/; the VHDL CPU is not instantiated (CoCo3_CYC_ACC_6809).
- sdram2.sv is simulated with its own controller logic and an SDR chip model.
- run_tests.sh: boot, keyboard, disk, WIDTH 80 and HSCREEN tests, judged on
  the text screen and byte-for-byte against test-ref/ screenshots.

rtl/wd1793.sv: spt_addr and buff_wr are declared at module scope instead of
inside generate blocks. They are assigned outside those blocks; Quartus
accepted it, Verilator rejected spt_addr and silently split buff_wr into a
separate net. No change on the FPGA (FM-7 made the same fix).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Alan SterembergandClaude Opus 5.5 committed 2026-10-02 07:15:44 -04:00
1 parent aae1ceabf1
commit 874f4f3083
79 files changed
+81058 -2

No files matched your search

+11 -2
View File
@@ -99,6 +99,11 @@ reg [1:0] wd_size_code;
wire [7:0] buff_dout;
reg [1:0] sd_block = 0;
reg format;
// buff_wr is assigned from always blocks outside the `generate if(RWMODE)`
// block it used to be declared in (after the wd1793_dpram that reads it). Those
// assignments then resolve to a separate implicit net in Verilator, so the
// sector-buffer write strobe never reached the RAM. Declared here instead.
reg buff_wr;
generate
if(RWMODE) begin
wd1793_dpram sbuf
@@ -115,7 +120,6 @@ generate
.wren_b(wre & buff_wr & (addr == A_DATA) & ~scan_active),
.q_b(buff_dout)
);
reg buff_wr;
end else begin
assign buff_dout = 0;
assign sd_buff_din = 0;
@@ -788,13 +792,18 @@ wire[10:0] edsk_next = ((edsk_addr + 1'd1) >= edsk_size) ? 11'd0 : edsk_addr + 1
reg [7:0] spt_size = 0;
// spt_addr is assigned from the always block above, outside the
// `generate if(EDSK)` scope it used to be declared in. Quartus tolerates that,
// but Verilator rejects it ("Can't find definition of variable: 'spt_addr'"),
// so it lives at module scope, next to spt_size. No behavioural change.
reg [7:0] spt_addr;
generate
if(EDSK) begin
wire [7:0] scan_data = RWMODE ? buff_dout : input_data;
reg [53:0] edsk[1992];
reg [7:0] spt[166];
reg [7:0] spt_addr;
always @(posedge clk_sys) begin
{edsk_track,edsk_side,edsk_trackf,edsk_sidef,edsk_sector,edsk_sizecode,edsk_offset} <= edsk[edsk_addr];
edsk_spt <= spt[spt_addr];