hardware objects - LeFreq/Singularity GitHub Wiki
Hardware "objects" allow all of the other objects in the data ecosystem to be hardware independent.
XXX This is a misnomer. These are not objects. They are termination points that ground the object model to the hardware.
Consider a DEVICE identifier in the OS. The identifier could abstract the actual hardware addressing used by the hardware system (a 16-slot bus for example would use 4 binary bits to select and address the hardware in the slot itself.). So GPU as a symbol and hardware ID in the OS would map to slot #4: \b0100. Writing "myObject >> GPU" would send the next dataword from myObject over the hardware bus to the GPU, automatically raising the pins to select slot #4 (\b0100). (or consider SLOT0100 as the identifier and GPU as a alias.)
Hardware objects will probably have a special language syntax to attach to other (standard) objects. API follows? standard objects:
Consdier these hardware outputs:
- STDOUT
- PRINTER
- USB_SSD
- INTERNET (sends pre-structured data to TCP/IP network)
They should not have standard object API, but a universal hardware API that all hardware conforms to:
- get/setstate of the device, returning a word (?HARDWARE for getting state, or SET_HARDWARE(setstate_hexcode))
- read/write a word to/from the device HARDWARE >> HardwareObject; myObject >> HARDWARE.
- Get ID from device for plug-and-play functionality (HARDWARE(GETID))
Bits could be sacrificed to do all of this within the machine word or separate control lines to select data that belongs to 1 of 2 states (a meta-like get/receive hardware info OR get/recv datalines) and one of the 1 of 2 data flows.
2 Control lines (in addition to bus address selection and the DATA BUS):
- 1: ON means the next word is for hardware control SETSTATE, receive to peripheral (network card, GPU card, etc.) data bus
- 1: OFF means the next word is for hardware control GETSTATE, receive on CPU data bus.
- 2: ON means the next word is for data WRITE (to peripheral)
- 2: OFF means the next word is for data READ (from peripheral).