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.
This commit is contained in:
bholman committed 2026-11-18 16:00:45 -07:00
1 parent 8b8cf72d1f
commit cb40fed3b9
126 files changed
+12795 -528

No files matched your search

+80
View File
@@ -0,0 +1,80 @@
`timescale 1ns/1ps
module cpu_sdram_bridge_tb;
reg clk=1,fast=1,reset=1;
always #10 clk=~clk;
always #5 fast=~fast;
reg [24:0] address=0;
reg [7:0] data=0;
reg request=0,read_cycle=1;
wire [24:0] tx_address;
wire [7:0] tx_data;
wire tx_request,tx_read,ack,controller_ack,ready;
cpu_sdram_bridge dut(clk,fast,reset,address,data,request,read_cycle,controller_ack,ack,tx_address,tx_data,tx_read,tx_request);
wire [15:0] dq,dout;
wire [12:0] row;
wire [1:0] bank;
wire ras,cas,we;
// Constant read bus, not a physical SDRAM array/timing model.
assign dq=we?16'ha55a:16'hzzzz;
sdram_32r8w memory(.init(reset),.clk(fast),.SDRAM_DQ(dq),.SDRAM_A(row),.SDRAM_BA(bank),
.SDRAM_nRAS(ras),.SDRAM_nCAS(cas),.SDRAM_nWE(we),.sdram_dout(dout),
.sdram_cpu_addr(tx_address),.sdram_cpu_din(tx_data),.sdram_cpu_req(tx_request),
.sdram_cpu_rnw(tx_read),.sdram_cpu_ack(controller_ack),.sdram_cpu_ready(ready),
.sdram_vid_addr(25'd0),.sdram_vid_req(1'b0));
reg [24:0] expected_address;
reg [7:0] expected_data;
reg expected_read,checking=0;
reg ready_seen=0;
reg [15:0] returned_data;
integer activations=0,commands=0,transactions=0;
always @(posedge fast) begin
#1;
if(checking) begin
if(ready) begin ready_seen=1;returned_data=dout;end
if({ras,cas,we}===3'b011) begin
if(row!==expected_address[22:10] || bank!==expected_address[24:23]) $fatal(1,"wrong row/bank payload");
activations=activations+1;
end
if({ras,cas,we}===3'b101 || {ras,cas,we}===3'b100) begin
if(row[8:0]!==expected_address[9:1] || row[10:9]!==2'b10) $fatal(1,"wrong column/autoprecharge");
if(row[12:11] !== (expected_read?2'b00:{~expected_address[0],expected_address[0]})) $fatal(1,"wrong byte mask");
if((we===1)!==expected_read) $fatal(1,"wrong read/write command");
if(!expected_read && dq!=={expected_data,expected_data}) $fatal(1,"wrong binary write data");
commands=commands+1;
end
end
end
task transaction(input [24:0] a,input [7:0] d,input reg r);
integer count,old_commands,old_activations;
begin
@(posedge clk);#2;
expected_address=a;expected_data=d;expected_read=r;
old_commands=commands;old_activations=activations;
address=a;data=d;read_cycle=r;checking=1;request=1;ready_seen=0;
count=0;
while(ack!==1 && count<1000) begin @(negedge fast);#1;count=count+1;end
if(ack!==1) $fatal(1,"request acknowledgement timeout");
// Once acknowledged, decode inputs may change; the transaction stays captured.
@(negedge clk);#1;request=0;address=~a;data=~d;read_cycle=~r;
count=0;
while(ready_seen!==1 && count<1000) begin @(negedge fast);#1;count=count+1;end
if(ready_seen!==1) $fatal(1,"transaction completion timeout");
if(r && returned_data!==16'ha55a) $fatal(1,"read return data missing");
repeat(5) @(negedge clk);
#2;
if(commands!=old_commands+1 || activations!=old_activations+1) $fatal(1,"lost/duplicate transaction");
if(tx_request!==0 || ack!==0) $fatal(1,"request/ack did not clear");
checking=0;transactions=transactions+1;
end
endtask
integer i;
initial begin
repeat(8) @(negedge clk);reset=0;
repeat(26000) @(negedge fast); // Complete >=200 us SDRAM initialization.
for(i=0;i<25;i=i+1) begin transaction(25'b1<<i,8'h55,0);transaction(~(25'b1<<i),8'haa,1);end
for(i=0;i<256;i=i+1) begin transaction($random,i,0);transaction($random,i,1);end
$display("PASS %0d bridge + actual SDRAM-controller transactions: all address bits/banks/byte masks, all 256 write bytes, read/ack/ready, refresh stalls, no duplicates",transactions);
$finish;
end
initial begin #10000000;$fatal(1,"SDRAM bridge regression timeout");end
endmodule