SLSSD.sleela
lib/operating-system/ssd/SLSSD.sleela · 137 line(s) · sleela
<< lib/operating-system/ssd/SLSSD.sleela
SLeeLa Standard Library Definition.
Definition: Defines SLSSD — a named solid-state drive. It extends
SLHardwareComponent and models the finite catalogue of SSD variants by the
dimensions that actually distinguish them: host interface (SATA III,
NVMe/PCIe 3.0/4.0/5.0), form factor (2.5", M.2 2280, U.2, add-in card),
NAND type (SLC/MLC/TLC/QLC), capacity, and representative sequential
read/write throughput. A machine description requests an SSD by
manufacturer + model (or a preset) and composes it as a boot/storage
device.
It is a storage device: capacity-in-blocks maps onto the VM's block store the
same way SLHardDisk and lib/cpu/SLHardDrive do, so a named SSD can be the
emulated machine's boot disk.
Family: operating-system. Extends SLHardwareComponent. >>
#sleela 2.5
material;
class SLSSD extends SLHardwareComponent {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 10937;
String metaAuthor = "Kiro Agent";
String metaDate = "2026-10-16";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-10";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 9;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
< Interface ordinals. >
< 6 Gb/s >
static final int IF_SATA3 = 0;
static final int IF_NVME_PCIE3 = 1;
static final int IF_NVME_PCIE4 = 2;
static final int IF_NVME_PCIE5 = 3;
< NAND cell types. >
static final int NAND_SLC = 1;
static final int NAND_MLC = 2;
static final int NAND_TLC = 3;
static final int NAND_QLC = 4;
< IF_* >
int iface;
< "2.5\"", "M.2 2280", "U.2", "AIC" >
String formFactor;
< NAND_* >
int nand;
int capacityGb;
< representative sequential read >
int seqReadMBps;
< representative sequential write >
int seqWriteMBps;
< logical block size (typically 512 or 4096) >
int blockBytes;
< Configure from manufacturer, model, interface, and capacity. The interface >
< preset fills representative throughput and form factor; refine afterward. >
void configure(String manufacturer, String partName, int interfaceKind, int capacityGigabytes) {
configureComponent(manufacturer, partName, CLASS_SSD);
iface = interfaceKind; capacityGb = capacityGigabytes;
nand = NAND_TLC; blockBytes = 4096; formFactor = "M.2 2280";
if (iface == IF_SATA3) { seqReadMBps = 560; seqWriteMBps = 530; formFactor = "2.5\""; }
if (iface == IF_NVME_PCIE3) { seqReadMBps = 3500; seqWriteMBps = 3000; }
if (iface == IF_NVME_PCIE4) { seqReadMBps = 7000; seqWriteMBps = 5500; }
if (iface == IF_NVME_PCIE5) { seqReadMBps = 14000; seqWriteMBps = 12000; }
}
< Configure by interface name ("SATA", "PCIe3", "PCIe4", "PCIe5"). >
void configureByName(String manufacturer, String partName, String ifName, int capacityGb) {
if (ifName == "PCIe5") { configure(manufacturer, partName, IF_NVME_PCIE5, capacityGb); return; }
if (ifName == "PCIe4") { configure(manufacturer, partName, IF_NVME_PCIE4, capacityGb); return; }
if (ifName == "PCIe3") { configure(manufacturer, partName, IF_NVME_PCIE3, capacityGb); return; }
configure(manufacturer, partName, IF_SATA3, capacityGb);
}
void setNand(int cellType) { nand = cellType; }
void setFormFactor(String ff) { formFactor = ff; }
void setThroughput(int readMBps, int writeMBps) { seqReadMBps = readMBps; seqWriteMBps = writeMBps; }
boolean isNvme() { return iface != IF_SATA3; }
String interfaceName() {
if (iface == IF_NVME_PCIE5) { return "NVMe PCIe 5.0"; }
if (iface == IF_NVME_PCIE4) { return "NVMe PCIe 4.0"; }
if (iface == IF_NVME_PCIE3) { return "NVMe PCIe 3.0"; }
return "SATA III";
}
String nandName() {
if (nand == NAND_SLC) { return "SLC"; }
if (nand == NAND_MLC) { return "MLC"; }
if (nand == NAND_QLC) { return "QLC"; }
return "TLC";
}
String form() { return formFactor; }
int capacityGigabytes() { return capacityGb; }
int readMBps() { return seqReadMBps; }
int writeMBps() { return seqWriteMBps; }
int blockSize() { return blockBytes; }
< Capacity as VM block count for the given block size — what SLMachineModel >
< hands the block store when this SSD is the boot disk. >
int capacityBlocks() {
int bytes = capacityGb * 1073741824;
return bytes / blockBytes;
}
}