Files
CoCo3_Plus_MiSTer/tests/completion_phase_tb.sv
bholman cb40fed3b9 Introduce Coco 3 Plus for MiSTer
Add original-firmware Sound & Speech, four configurable Multi-Pak sockets,
bounded per-slot ROM allocation and a nine-page menu organized around devices
and media. Repair inherited clock/reset/CPU-memory/video paths and add explicit
conditional external-I/O timing contracts. Preserve native Main startup-file
ordering, saved layouts, stock-core separation and the coco3plus media profile.

Provide native Windows tool downloads, pinned ToolShed ROM assembly, fresh
Quartus builds, functional and fitted timing checks, reviewed release packaging
and passwordless SSH installation with backups. Retain original component
notices, document contribution copyright and keep SSC ROM inputs outside Git.

Validation: Quartus17.0.2 Build602 seed5, zero errors; 15 functional jobs,
368 both-corner timing scopes and eight tooling-integrity checks pass.
The renamed build reaches Disk BASIC, PRINT1+1 returns2 and SSC loads ready.
Physical cold power cycling and conditional board-delay assumptions remain
separate. Full original upstream histories are preserved before this single
consolidated implementation commit.
2026-11-18 16:00:45 -07:00

33 lines
1.2 KiB
Systemverilog

`timescale 1ns/1ps
module completion_phase_tb;
reg sys=1,fast=1,clear=1,ready=0;
reg [15:0] data=0;
always #10 sys=~sys;
always #5 fast=~fast;
wire phase_ready;
wire [15:0] phase_data;
actual_completion dut(fast,clear,ready,data,phase_ready,phase_data);
integer comparisons=0,i;
reg observing=0;
// Compare the values the original and repaired CPU-side consuming edge sees,
// before the coincident positive-fast producer's NBA updates.
always @(negedge sys) if(observing && !clear) begin
if(phase_ready!==dut.data_ready) $fatal(1,"completion phase changed CPU-visible readiness");
if(phase_ready && phase_data!==dut.hold_data) $fatal(1,"completion flag/data became incoherent");
comparisons=comparisons+1;
end
initial begin
repeat(4) @(negedge sys);#1;clear=0;observing=1;
for(i=0;i<20000;i=i+1) begin
@(negedge fast);#1;data=$random;ready=$random;
if(i%19==0) clear=1;
if(i%19==3) clear=0;
end
clear=1;#1;
if(phase_ready!==0 || dut.data_ready!==0) $fatal(1,"completion clear missing");
$display("PASS %0d original/repaired completion flag/data observations at actual CPU phase; no extra CPU sampling cycle, random producer traffic and clears",comparisons);
$finish;
end
initial begin #1000000;$fatal(1,"completion phase timeout");end
endmodule