Skip to content

Commit

Permalink
squishy: big-renovation-wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lethalbit committed Nov 9, 2024
1 parent 269ee52 commit 918903d
Show file tree
Hide file tree
Showing 141 changed files with 4,416 additions and 5,336 deletions.
90 changes: 20 additions & 70 deletions contrib/scsidump
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@

import sys

from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, Namespace
from pathlib import Path
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from pathlib import Path

try:
from squishy import __version__
except ImportError:
sys.path.insert(0, '/pool/abyss/Projects/squishy/squishy')

from squishy import __version__
from squishy import __version__

from squishy.gateware import AVAILABLE_PLATFORMS
from squishy.device import SquishyDevice

def _setup_extcap_parser(parser: ArgumentParser):
parser.add_argument(
Expand Down Expand Up @@ -67,70 +70,16 @@ def _setup_extcap_parser(parser: ArgumentParser):


APPLET_OPTIONS = {
'platform': {
'type': str,
'required': True,
'default': 'rev2',
'help': 'Squishy Hardware Platform',
'extcap_type': 'selector',
'extcap_name': 'Hardware Platform',
'values': ('rev1', 'rev2'),
'group': 'Hardware Options',
},
'scsi-did': {
'type': int,
'required': True,
'default': 7,
'range': (0, 7),
'help': 'SCSI ID',
'extcap_type': 'integer',
'extcap_name': 'SCSI ID',
'group': 'SCSI Options'
},
'scsi-arbitrating': {
'type': bool,
'help': 'Enable SCSI Bus arbitration',
'extcap_type': 'boolean',
'extcap_name': 'Bus Arbitration',
'group': 'SCSI Options'
},

'skip-cache': {
'type': bool,
'help': 'Skip cache lookup for built gateware',
'extcap_type': 'boolean',
'extcap_name': 'Skip Cache',
'group': 'Gateware Options'
},
'use-router2': {
'type': bool,
'help': 'Use nextpnr\'s router2',
'extcap_type': 'boolean',
'extcap_name': 'Use router2',
'group': 'Gateware Options'
},
'tmg-ripup': {
'type': bool,
'help': 'Use the timing-driven ripup router',
'extcap_type': 'boolean',
'extcap_name': 'Use the timing-driven ripup router',
'group': 'Gateware Options'
},
'pnr-seed': {
'type': int,
'help': 'nextpnr seed',
'defualt': 0,
'extcap_type': 'integer',
'extcap_name': 'PNR seed',
'group': 'Gateware Options'
},
'no-abc9': {
'type': bool,
'help': 'Disable ABC9',
'extcap_type': 'boolean',
'extcap_name': 'Disable ABC9',
'group': 'Gateware Options'
}
# 'platform': {
# 'type': str,
# 'required': True,
# 'default': list(AVAILABLE_PLATFORMS.keys())[-1],
# 'help': 'Squishy Hardware Platform',
# 'extcap_type': 'selector',
# 'extcap_name': 'Hardware Platform',
# 'values': (rev for rev in list(AVAILABLE_PLATFORMS.keys())),
# 'group': 'Hardware Options',
# }
}


Expand All @@ -150,7 +99,9 @@ def _setup_parser(parser: ArgumentParser):

def extcap_list_interfaces():
print(f'extcap {{version={__version__}}}{{help=https://docs.scsi.moe/extra.html#scsidump}}')
print('interface {value=scsidump}{display=Squishy SCSI Bus capture}')

for (sn, rev, _) in SquishyDevice.enumerate():
print(f'interface {{value={sn}}}{{display=Squishy rev{rev[0]}: SCSI Bus capture}}')

def extcap_list_dlts():
print('dlt {number=147}{name=squishy}{display=SCSI}')
Expand Down Expand Up @@ -181,7 +132,7 @@ def extcap_list_config():
extcap_arg_value += '{default=true}'
print(extcap_arg_value)

# print('arg {number=0}{call=--meow}{display=Meow}{type=boolean}{tooltip=Meow Meow Meow}')


def main() -> int:
parser = ArgumentParser(
Expand Down Expand Up @@ -209,7 +160,6 @@ def main() -> int:
extcap_list_config()



return 0


Expand Down
138 changes: 27 additions & 111 deletions contrib/squishy-completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
_squishy_command() {
local -a commands=(
'applet[Squishy applet subsystem]'
'cache[Squishy applet cache managment]'
'provision[Squishy hardware provisioning]'
)
_values 'squishy commands' : $commands
Expand All @@ -15,7 +14,6 @@ _squishy_command() {
_squishy_applet_command() {
local -a commands=(
'analyzer[Squishy SCSI analyzer]'
'taperipper[UEFI Boot from 9-track tape]'
)
_values 'squishy applets' : $commands
}
Expand All @@ -31,17 +29,6 @@ _squishy_applet_analyzer() {
_arguments -s : $arguments
}

_squishy_applet_taperipper() {
local arguments

arguments=(
'(-h --help)'{-h,--help}'[Show help message and exit]'

)

_arguments -s : $arguments
}

_squishy_applet() {
local arguments
local platforms=`python -m squishy applet -h | tail -n +4 | grep -m1 -e '\-\-platform\s{' | sed 's/,\s-p\s.*$//' | sed 's/--platform\s{\([^}]*\)}/\1/'`
Expand All @@ -50,31 +37,22 @@ _squishy_applet() {
'(-h --help)'{-h,--help}'[Show help message and exit]'
'(-p --platforms)'{-p=,--platforms=}"[Target hardware platform]:platform:(${(s/,/)platforms})"

'--skip-cache[Skip bitstream cache lookup]'
'(-b --build-dir)'{-b,--build-dir}"[Output directory for build products]:dir:_directories"
'--loud[Enables output from PnR and synthesis]'
'--build-only[Only build the applet]'

'--use-router2[Use nextpnrs router2 rather than router1]'
'--tmp-ripup[Use timing driven ripup]'
'--detailed-timing-report[Output a detailed timing report]'
'--routed-svg[Save an svg of the routed output]:svg:_files -g "*.svg"'
'--routed-json[Save routed json netlist]:json:_files -g "*.json"'
'--pnr-seed[Specify PNR seed]:seed:_numbers -l 0 "PNR_SEED"'

'(-Y --noconfirm)'{-Y,--noconfirm}'[Do not ask for confirmation if the target applet is in preview]'
'(-F --flash)'{-f,--flash}'[Flash the applet into persistent storage raather then doing an ephemeral load if supported]'

'--no-abc9[Disable ABC9 durring synthesis]'
'(-B --build-only)'{-B,--build-only}'[Only build and pack the applet, skip device programming]'
'(-b --build-dir)'{-b,--build-dir}"[Output directory for build products]:dir:_directories"
'(-C --skip-cache)'{-C,--skip-cache}'[Skip artifact cache lookup and squesequent insertion when build is completed]'
'--build-verbose[Enable verbose tool output during build]'

'--enable-webusb[Enable the experimental WebUSB support]'
'--webusb-url=[WebUSB URL to encode]:url:_urls'
'--no-abc9[Disable use of abc9, will likely result in worse applet performance]'
'--no-aggressive-mapping[Disable multiple abc9 passes, speeds up build time in exchange for worse performance]'

'(-U --enable-uart)'{-U,--enable-uart}'[Enable debug UART]'
'(-B --baud)'{-B,--baud}'=[Baud rate to run the debug UART at]:baud:_numbers -d 9600'
'(-D --data-bits)'{-D,--data-bits}'=[Data bits to use for the debug UART]:data:_numbers -d 8'
'(-c --parity)'{-c,--parity}'=[Parity mode to use for the debug UART]:parity:(none mark spaceeven odd)'
'--detailed-report[Output a detailed timing report]'
'--routed-netlist[Save routed json netlist]:json:_files -g "*.json"'
'--pnr-seed[Specify PNR seed]:seed:_numbers -l 0 "PNR_SEED"'

'--scsi-did=[The SCSI ID to use]:scsi_id:_numbers -l 0 -m 7 "SCSI ID"'
'--scsi-arbitrating[Enable SCSI bus arbitration]'
'--dont-compress[Disable bitstream compression if supported on the platform]'

'(-): :->applet'
'(-)*:: :->applet_args'
Expand All @@ -92,9 +70,6 @@ _squishy_applet() {
(analyzer)
_squishy_applet_analyzer && ret=0
;;
(taperipper)
_squishy_applet_taperipper && ret=0
;;
esac
;;
esac
Expand All @@ -109,22 +84,24 @@ _squishy_provision() {
'(-h --help)'{-h,--help}'[Show help message and exit]'
'(-p --platforms)'{-p=,--platforms=}"[Target hardware platform]:platform:(${(s/,/)platforms})"

'--skip-cache[Skip bitstream cache lookup]'
'(-Y --noconfirm)'{-Y,--noconfirm}'[Do not ask for confirmation if the target applet is in preview]'
'(-F --flash)'{-f,--flash}'[Flash the applet into persistent storage raather then doing an ephemeral load if supported]'

'(-B --build-only)'{-B,--build-only}'[Only build and pack the applet, skip device programming]'
'(-b --build-dir)'{-b,--build-dir}"[Output directory for build products]:dir:_directories"
'--loud[Enables output from PnR and synthesis]'
'--build-only[Only build the applet]'

'--use-router2[Use nextpnrs router2 rather than router1]'
'--tmp-ripup[Use timing driven ripup]'
'--detailed-timing-report[Output a detailed timing report]'
'--routed-svg[Save an svg of the routed output]:svg:_files -g "*.svg"'
'--routed-json[Save routed json netlist]:json:_files -g "*.json"'
'--build-verbose[Enable verbose tool output during build]'

'--no-abc9[Disable use of abc9, will likely result in worse applet performance]'
'--no-aggressive-mapping[Disable multiple abc9 passes, speeds up build time in exchange for worse performance]'

'--detailed-report[Output a detailed timing report]'
'--routed-netlist[Save routed json netlist]:json:_files -g "*.json"'
'--pnr-seed[Specify PNR seed]:seed:_numbers -l 0 "PNR_SEED"'

'--no-abc9[Disable ABC9 durring synthesis]'
'--dont-compress[Disable bitstream compression if supported on the platform]'

'(-S --serial-number)'{-S,--serial-number}'[Specify Serial Number to use]'
'(-W --whole-device)'{-W,--whole-device}'=[Generate a whole device provisioning image for factory progrssming]'
'(-S --serial-number)'{-S,--serial-number}'[Specify serial number to use]'
'(-W --whole-device)'{-W,--whole-device}'=[Generate a whole device provisioning image for factory programming]'
)

_arguments -s : $arguments && return
Expand All @@ -133,65 +110,6 @@ _squishy_provision() {
return 0
}

_squishy_cache_command() {
local -a commands=(
'list[Show cache status]'
'clear[Clear cache]'
)
_values 'squishy cache' : $commands
}

_squishy_cache_list() {
local arguments
arguments=(
'(-h --help)'{-h,--help}'[Show help message and exit]'
'--list-cache-items[List each item in the cache (WARNING: CAN BE LARGE)]'
)

_arguments -s : $arguments
}

_squishy_cache_clear() {
local arguments
arguments=(
'(-h --help)'{-h,--help}'[Show help message and exit]'

)

_arguments -s : $arguments
}

_squishy_cache() {
local arguments
integer ret=1

arguments=(
'(-h --help)'{-h,--help}'[Show help and exit]'

'(-): :->action'
'(-)*:: :->action_args'
)

_arguments -s : $arguments && return

case $state in
(action)
_squishy_cache_command && ret=0
;;
(action_args)
curcontext=${curcontext%:*:*}:squishy-$words[1]:
case $words[1] in
(list)
_squishy_cache_list && ret=0
;;
(clear)
_squishy_cache_clear && ret=0
;;
esac
;;
esac
return $ret
}

_squishy() {
local arguments context curcontext=$curcontext state state_descr line
Expand All @@ -201,6 +119,7 @@ _squishy() {
'(-h --help)'{-h,--help}'[show version and help then exit]'
'(-d --device)'{-d,--device}'=[specify device serial number]'
'(-v --verbose)'{-v,--verbose}'[verbose logging]'
'(-V --version)'{-V,--version}'[show version and exit]'
'(-): :->command'
'(-)*:: :->arguments'
)
Expand All @@ -217,9 +136,6 @@ _squishy() {
(applet)
_squishy_applet && ret=0
;;
(cache)
_squishy_cache && ret=0
;;
(provision)
_squishy_provision && ret=0
esac
Expand Down
8 changes: 8 additions & 0 deletions docs/_static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ code.literal {
border-radius: 5px;
}

div.sidebar-container {
width: 25em;
}

div.toc-drawer {
width: 20em;
}

svg.WaveDrom {
padding: 10px;
border-radius: 5px;
Expand Down
8 changes: 0 additions & 8 deletions docs/applets/api/cli.md

This file was deleted.

16 changes: 0 additions & 16 deletions docs/applets/api/device.md

This file was deleted.

Loading

0 comments on commit 918903d

Please sign in to comment.