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:
1 parent
8b8cf72d1f
commit
cb40fed3b9
126 files changed
+12795
-528
No files matched your search
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Check the real platform serializer's timing slots; reject a same-edge defect."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def main():
|
||||
p = argparse.ArgumentParser(description=__doc__)
|
||||
p.add_argument('project', type=Path)
|
||||
p.add_argument('output', type=Path)
|
||||
p.add_argument('--suite', type=Path, required=True)
|
||||
a = p.parse_args()
|
||||
out = a.output.resolve()
|
||||
if not out.is_relative_to(ROOT / 'build') or out.exists():
|
||||
p.error('Use a fresh build/ directory')
|
||||
out.mkdir(parents=True)
|
||||
source = a.project / 'sys/audio_out.v'
|
||||
i2s = a.project / 'sys/i2s.v'
|
||||
text = source.read_text()
|
||||
ce = text[text.index('localparam AUDIO_RATE'):text.index('\ni2s i2s')]
|
||||
ce = ce.replace('always @(posedge clk) begin', 'always @(posedge clk) begin : ce_phase', 1)
|
||||
at = ce.index('reg i2s_ce;')
|
||||
ce = ce[:at] + ce[at:].replace('always @(posedge clk) begin', 'always @(posedge clk) begin : divider_phase', 1)
|
||||
wrapper = ('module audio_pin_contract(input clk,reset,sample_rate,output bclk,lrclk,data);\n'
|
||||
'localparam CLK_RATE=24576000;\n' + ce + '\n'
|
||||
'i2s i2s(.reset(reset),.clk(clk),.ce(i2s_ce),.sclk(bclk),.lrclk(lrclk),.sdata(data),'
|
||||
'.left_chan(16\'ha55a),.right_chan(16\'h5aa5));\nendmodule\n')
|
||||
(out / 'wrapper.sv').write_text(wrapper)
|
||||
(out / 'i2s.v').write_bytes(i2s.read_bytes())
|
||||
env = os.environ.copy()
|
||||
env['PATH'] = os.pathsep.join([str(a.suite / 'bin'), str(a.suite / 'lib'), env['PATH']])
|
||||
ext = '.exe' if os.name == 'nt' else ''
|
||||
cmd = [str(a.suite / 'bin' / ('iverilog' + ext)), '-g2012', '-s', 'external_audio_tb', '-o', str(out / 'run.vvp'),
|
||||
str(ROOT / 'tests/external_audio_tb.sv'), str(out / 'wrapper.sv'), str(out / 'i2s.v')]
|
||||
for negative in (False, True):
|
||||
tag = 'negative' if negative else 'positive'
|
||||
if negative:
|
||||
# Deliberately invert the forwarded sampling edge.
|
||||
mutant = i2s.read_text().replace('sclk <= msclk;', 'sclk <= ~msclk;')
|
||||
assert mutant != i2s.read_text()
|
||||
(out / 'i2s.v').write_text(mutant)
|
||||
with (out / f'{tag}-compile.log').open('w') as log:
|
||||
subprocess.run(cmd, env=env, stdout=log, stderr=subprocess.STDOUT, check=True)
|
||||
with (out / f'{tag}.log').open('w') as log:
|
||||
result = subprocess.run([str(a.suite / 'bin' / ('vvp' + ext)), str(out / 'run.vvp')],
|
||||
env=env, stdout=log, stderr=subprocess.STDOUT, timeout=60)
|
||||
log_text = (out / f'{tag}.log').read_text()
|
||||
print(log_text, end='')
|
||||
if (not negative and (result.returncode or 'PASS audio pin slots' not in log_text)) or (
|
||||
negative and (not result.returncode or 'I2S receiver setup slot lost' not in log_text)):
|
||||
raise RuntimeError(f'Unexpected {tag} result')
|
||||
(out / 'i2s.v').write_bytes(i2s.read_bytes())
|
||||
(out / 'result.json').write_text(json.dumps({'passed': True, 'wrong_edge_mutant_rejected': True,
|
||||
'setup_min_fabric_cycles': 5, 'hold_min_fabric_cycles': 3, 'modes_hz': [48000, 96000],
|
||||
'scope': 'real CE and I2S RTL; no analog edge/pull-up or external receiver model',
|
||||
'source_sha256': {str(path.relative_to(a.project)): hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
for path in (source, i2s)}}, indent=2) + '\n')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in new issue
Block a user