Files
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

44 lines
1.9 KiB
Systemverilog

// Original Coco 3 Plus contributions: Copyright (c) 2026 Brian K. Holman.
// Original component notices/terms retained; see COPYRIGHT.md and LICENSING.md.
// SPDX-License-Identifier: BSD-3-Clause
// Instruction-boundary scheduler. icount_tick is PIC input clock /2.
// Start-to-start intervals equal reported architectural cycles. An engine or
// peripheral response that misses its deadline sets overrun and stops launches.
// run may fall during a transaction; quiescent follows its completed budget.
module ssc_tms7000_pacer(input wire clk,reset,run,icount_tick,
input wire engine_done,input wire [6:0] engine_cycles,
output reg step,output wire quiescent,output reg overrun);
localparam [1:0] IDLE=0,EXECUTE=1,RELEASE=2,BUDGET=3;
reg [1:0] state;
reg [7:0] elapsed;
reg [6:0] budget;
wire [8:0] next_elapsed={1'b0,elapsed}+{8'd0,icount_tick};
assign quiescent=state==IDLE && !step;
always @(posedge clk)begin
if(reset)begin state<=IDLE;step<=0;overrun<=0;elapsed<=0;budget<=0;end
else begin
if(state!=IDLE && icount_tick && elapsed!=255)elapsed<=elapsed+8'd1;
// A nonresponding bus must be observable even if engine_done never arrives.
// Original instructions take at most49 icount ticks. Do not abort a captured
// bus operation; latch the fault and require reset if it cannot complete.
if(state==EXECUTE && next_elapsed>=9'd127)overrun<=1;
case(state)
IDLE:if(run && icount_tick && !overrun)begin step<=1;elapsed<=0;state<=EXECUTE;end
EXECUTE:if(engine_done)begin
step<=0;budget<=engine_cycles;state<=RELEASE;
if(next_elapsed>={2'd0,engine_cycles})overrun<=1;
end
RELEASE:if(!engine_done)begin
state<=BUDGET;
if(next_elapsed>={2'd0,budget})overrun<=1;
end
BUDGET:if(icount_tick && next_elapsed>={2'd0,budget})begin
if(run && !overrun)begin step<=1;elapsed<=0;state<=EXECUTE;end
else state<=IDLE;
end
default:state<=IDLE;
endcase
end
end
endmodule