Modula-2 Reloaded

A Modern Typesafe & Literate Programming Notation

Site Menu

Project

Specification

Implementation

Recommendations

Reference

Needs Updating

Work in Progress

Wastebasket

Wiki Manual

edit SideBar

System Types

WiP.SystemTypes History

Hide minor edits - Show changes to output

2010-01-23 09:21 by benjk -
Changed lines 49-50 from:
For 8-bit byte target architectures, @@`BitsPerMachineByte@@ shall have a value of @@8@@ and type @@MACHINEBYTE@@ shall be an alias of @@OCTET@@. For non-8-bit targets, implementors shall be at liberty to implement the target by emulating an 8-bit byte architecture and if they do so, @@`BitsPerMachineByte@@ shall have a value of @@8@@ and type @@MACHINEBYTE@@ shall be an alias of @@OCTET@@.
to:
For 8-bit byte target architectures, @@`BitsPerMachineByte@@ shall have a value of @@8@@ and type @@MACHINEBYTE@@ shall be an alias for @@OCTET@@. For non-8-bit targets, implementors shall be at liberty to implement the target by emulating an 8-bit byte architecture and if they do so, @@`BitsPerMachineByte@@ shall have a value of @@8@@ and type @@MACHINEBYTE@@ shall be an alias for @@OCTET@@.
Changed line 58 from:
For 8-bit byte target architectures, @@`MachineBytesPerMachineWord@@ shall have a value identical to @@`BytesPerWord@@ and type @@MACHINEWORD@@ shall be an alias of @@WORD@@. For non-8-bit targets, implementors shall be at liberty to implement the target by emulating an 8-bit byte architecture and if they do so, @@`MachineBytesPerMachineWord@@ shall have a value identical to @@`BytesPerWord@@ and type @@MACHINEWORD@@ shall be an alias of @@WORD@@.
to:
For 8-bit byte target architectures, @@`MachineBytesPerMachineWord@@ shall have a value identical to @@`BytesPerWord@@ and type @@MACHINEWORD@@ shall be an alias for @@WORD@@. For non-8-bit targets, implementors shall be at liberty to implement the target by emulating an 8-bit byte architecture and if they do so, @@`MachineBytesPerMachineWord@@ shall have a value identical to @@`BytesPerWord@@ and type @@MACHINEWORD@@ shall be an alias for @@WORD@@.
2010-01-23 09:19 by benjk -
Changed lines 49-50 from:
For 8-bit byte target architectures, type @@MACHINEBYTE@@ shall be an alias of @@OCTET@@. For non-8-bit targets, implementors shall be at liberty to implement the target by emulating an 8-bit byte architecture and define @@MACHINEBYTE@@ as an alias for @@OCTET@@.
to:
For 8-bit byte target architectures, @@`BitsPerMachineByte@@ shall have a value of @@8@@ and type @@MACHINEBYTE@@ shall be an alias of @@OCTET@@. For non-8-bit targets, implementors shall be at liberty to implement the target by emulating an 8-bit byte architecture and if they do so, @@`BitsPerMachineByte@@ shall have a value of @@8@@ and type @@MACHINEBYTE@@ shall be an alias of @@OCTET@@.
Changed line 58 from:
For 8-bit byte target architectures, type @@MACHINEWORD@@ shall be an alias of @@WORD@@. For non-8-bit targets, implementors shall be at liberty to implement the target by emulating an 8-bit byte architecture and define @@MACHINEWORD@@ as an alias for @@WORD@@.
to:
For 8-bit byte target architectures, @@`MachineBytesPerMachineWord@@ shall have a value identical to @@`BytesPerWord@@ and type @@MACHINEWORD@@ shall be an alias of @@WORD@@. For non-8-bit targets, implementors shall be at liberty to implement the target by emulating an 8-bit byte architecture and if they do so, @@`MachineBytesPerMachineWord@@ shall have a value identical to @@`BytesPerWord@@ and type @@MACHINEWORD@@ shall be an alias of @@WORD@@.
2010-01-23 09:13 by benjk -
Changed lines 49-50 from:
For 8-bit byte target architectures, type @@MACHINEBYTE@@ shall be an alias of @@OCTET@@. For non-8-bit targets, implementors shall be at liberty to emulate an 8-bit byte architecture and define @@MACHINEBYTE@@ as an alias for @@OCTET@@.
to:
For 8-bit byte target architectures, type @@MACHINEBYTE@@ shall be an alias of @@OCTET@@. For non-8-bit targets, implementors shall be at liberty to implement the target by emulating an 8-bit byte architecture and define @@MACHINEBYTE@@ as an alias for @@OCTET@@.
Changed line 58 from:
For 8-bit byte target architectures, type @@MACHINEWORD@@ shall be an alias of @@WORD@@. For non-8-bit targets, implementors shall be at liberty to emulate an 8-bit byte architecture and define @@MACHINEWORD@@ as an alias for @@WORD@@.
to:
For 8-bit byte target architectures, type @@MACHINEWORD@@ shall be an alias of @@WORD@@. For non-8-bit targets, implementors shall be at liberty to implement the target by emulating an 8-bit byte architecture and define @@MACHINEWORD@@ as an alias for @@WORD@@.
2010-01-23 09:10 by benjk -
Changed lines 49-50 from:
Implementors may choose to implement a compilation target for a non-8-bit byte architecture emulating an 8-bit byte architecture and define @@MACHINEBYTE@@ as an alias for @@OCTET@@.
to:
For 8-bit byte target architectures, type @@MACHINEBYTE@@ shall be an alias of @@OCTET@@. For non-8-bit targets, implementors shall be at liberty to emulate an 8-bit byte architecture and define @@MACHINEBYTE@@ as an alias for @@OCTET@@.
Changed line 58 from:
Implementors may choose to implement a compilation target for a non-8-bit byte architecture emulating an 8-bit byte architecture and define @@MACHINEWORD@@ as an alias for @@WORD@@.
to:
For 8-bit byte target architectures, type @@MACHINEWORD@@ shall be an alias of @@WORD@@. For non-8-bit targets, implementors shall be at liberty to emulate an 8-bit byte architecture and define @@MACHINEWORD@@ as an alias for @@WORD@@.
2010-01-23 09:04 by benjk -
Changed lines 49-50 from:
Implementors may choose to implement a compilation target for a non-8-bit byte architecture emulating an 8-bit byte architecture and define @@MACHINEBYTE@@ as an alias of @@OCTET@@.
to:
Implementors may choose to implement a compilation target for a non-8-bit byte architecture emulating an 8-bit byte architecture and define @@MACHINEBYTE@@ as an alias for @@OCTET@@.
Changed line 58 from:
Implementors may choose to implement a compilation target for a non-8-bit byte architecture emulating an 8-bit byte architecture and define @@MACHINEWORD@@ as an alias of @@WORD@@.
to:
Implementors may choose to implement a compilation target for a non-8-bit byte architecture emulating an 8-bit byte architecture and define @@MACHINEWORD@@ as an alias for @@WORD@@.
2010-01-23 09:02 by benjk -
Changed line 56 from:
*IO formats for values of type @@MACHINEBYTE@@ shall be implementation defined
to:
*IO formats for values of type @@MACHINEWORD@@ shall be implementation defined
2010-01-23 09:01 by benjk -
Changed lines 47-48 from:
to:
*IO formats for values of type @@MACHINEBYTE@@ shall be implementation defined
Added line 56:
*IO formats for values of type @@MACHINEBYTE@@ shall be implementation defined
2010-01-23 08:44 by benjk -
Changed line 5 from:
Before any architecture will move to multiple-of-8-bit bytes, it is likely that prior to such change there would have been a shift in a number of programming languages using larger "virtual" bytes and the common use of the term "byte" itself might have changed to mean a larger unit than 8 bits. At that point there would be 8-bit machine-bytes and multiple-of-8-bit software bytes.
to:
Before architectures will move to multiple-of-8-bit bytes, it is likely that prior to such change there would have been a shift in a number of programming languages using larger "virtual" bytes and the common use of the term "byte" itself might have changed to mean a larger unit than 8 bits. At that point there would be 8-bit machine-bytes and multiple-of-8-bit software bytes.
2010-01-23 08:43 by benjk -
Changed line 33 from:
*a constant `@@OctetsPerByte@@ shall define the number of bytes per word
to:
*a constant @@`OctetsPerByte@@ shall define the number of bytes per word
Changed line 39 from:
*a constant `@@BytesPerWord@@ shall define the number of bytes per word
to:
*a constant @@`BytesPerWord@@ shall define the number of bytes per word
Changed line 45 from:
*a constant `@@BitsPerMachineByte@@ shall define the number of bits per machine byte
to:
*a constant @@`BitsPerMachineByte@@ shall define the number of bits per machine byte
Changed line 53 from:
*a constant `@@MachineBytesPerMachineWord@@ shall define the number of machine bytes per machine word
to:
*a constant @@`MachineBytesPerMachineWord@@ shall define the number of machine bytes per machine word
Changed lines 61-62 from:
*a constant `@@OctetsPerAddress@@ shall define the number of octets required to store an address
*a constant `@@MachineBytesPerAddress@@ shall define the number of machine bytes per address
to:
*a constant @@`OctetsPerAddress@@ shall define the number of octets required to store an address
*a constant @@`MachineBytesPerAddress@@ shall define the number of machine bytes per address
2010-01-23 08:38 by benjk -
Added lines 1-63:
The following scenarios are relevant to determining the definition of system types ...

!!!8-bit byte hardware and multiple-of-8-bit byte software:

Before any architecture will move to multiple-of-8-bit bytes, it is likely that prior to such change there would have been a shift in a number of programming languages using larger "virtual" bytes and the common use of the term "byte" itself might have changed to mean a larger unit than 8 bits. At that point there would be 8-bit machine-bytes and multiple-of-8-bit software bytes.

!!!Multiple-of-8-bit byte hardware bytes and 8-bit byte software

If and when architectures will move to multiple-of-8-bit bytes, it is likely that even after such change there would still remain architectures and languages using 8-bit bytes. At that point there would be a need for a backwards compatible 8-bit byte in languages that mandate a de-facto 8-bit byte and languages that have a large code base that depends on de-facto 8-bit bytes, e.g. C and C++.

!!!Wider than 8-bit but not multiples of 8-bit byte hardware

Legacy computer systems with 18 and 36-bit words are still in use, although their significance and numbers are in decline and they will eventually disappear. When compilers for languages that mandate 8-bit bytes or de-facto 8-bit bytes are targeted at architectures that use bytes wider than eight bits but not multiple's of eight bits, a common technique is to ignore the extra bits and use mappings whereby the number of wasted bits is minimal. This approach does not usually incur any significant performance penalty.

!!!Smaller than 8-bit byte hardware

Embedded micro-controllers with 4-bit wide bytes continue to be developed, manufactured and used in large numbers. When compilers for languages that mandate 8-bit bytes or de-facto 8-bit bytes are targeted at architectures that use bytes with significantly less than eight bits, there are two possible approaches. One approach is to simulate an 8-bit architecture by combining multiple smaller-than-8-bit bytes into a single 8-bit byte. This approach is extremely inefficient and generally unsuitable for embedded micro-controller development. The other approach is to add an additional non-standard machine byte that matches the size of the actual architecture. This approach is efficient but it renders the source code non-standard.

!!!Covering all four scenarios

!!!!Type OCTET
A new type @@OCTET@@ shall be introduced
*it shall have a fixed size of eight bits
*it shall replace types @@BYTE@@ and @@LOC@@ in all occurrences of the standard library

It remains to be determined whether @@OCTET@@ should be
*a pervasive type, or
*provided by module @@SYSTEM@@

!!!!Type BYTE
Type @@BYTE@@ shall remain
*it shall have an implementation defined size of one or more octets
*a constant `@@OctetsPerByte@@ shall define the number of bytes per word
*both constant and type shall be provided by module @@SYSTEM@@

!!!!Type WORD
Type @@WORD@@ shall remain
*it shall have an implementation defined size of one or more bytes
*a constant `@@BytesPerWord@@ shall define the number of bytes per word
*both constant and type shall be provided by module @@SYSTEM@@

!!!!Type MACHINEBYTE
A new type @@MACHINEBYTE@@ shall be introduced
*it shall be identical to the machine byte of the target architecture
*a constant `@@BitsPerMachineByte@@ shall define the number of bits per machine byte
*both constant and type shall be provided by module @@SYSTEM@@

Implementors may choose to implement a compilation target for a non-8-bit byte architecture emulating an 8-bit byte architecture and define @@MACHINEBYTE@@ as an alias of @@OCTET@@.

!!!!Type MACHINEWORD
A new type @@MACHINEWORD@@ shall be introduced
*it shall be identical to the machine word of the target architecture
*a constant `@@MachineBytesPerMachineWord@@ shall define the number of machine bytes per machine word
*both constant and type shall be provided by module @@SYSTEM@@

Implementors may choose to implement a compilation target for a non-8-bit byte architecture emulating an 8-bit byte architecture and define @@MACHINEWORD@@ as an alias of @@WORD@@.

!!!!Type ADDRESS
Type @@ADDRESS@@ shall remain
*it shall be identical to the machine address of the target architecture
*a constant `@@OctetsPerAddress@@ shall define the number of octets required to store an address
*a constant `@@MachineBytesPerAddress@@ shall define the number of machine bytes per address
*both constants and the type shall be provided by module @@SYSTEM@@