clarify
[libreriscv.git] / isa_conflict_resolution.mdwn
index 934269ae934b39421b35c032f0ebad567f40b6b7..cad45abe07fe4d7892030474ad391f0e92ad4055 100644 (file)
@@ -89,7 +89,7 @@ Each of these will be discussed below in their own sections.
 
 # Do nothing (no problem exists)
 
-TBD (basically not an option).
+(Summary: not an option)
 
 There were several solutions offered that fell into this category.
 A few of them are listed in the introduction; more are listed below,
@@ -138,7 +138,7 @@ field.
 
 # Do nothing (out of scope)
 
-TBD (basically, may not be RV Foundation's "scope", still results in
+(Summary: may not be RV Foundation's "scope", still results in
 problem, so not an option)
 
 This was one of the first arguments presented: The RISC-V Foundation
@@ -156,7 +156,7 @@ be hardest hit by the resultant chaos, and that will just be the more
 
 # Do nothing (Compliance too complex, therefore out of scope)
 
-TBD (basically, may not be RV Foundation's "scope", still results in
+(Summary: may not be RV Foundation's "scope", still results in
 problem, so not an option)
 
 The summary here was that Compliance testing of Custom Extensions is
@@ -183,7 +183,7 @@ solution be very, very simple.
 
 # MISA
 
-TBD, basically MISA not suitable
+(Summary: MISA not suitable, leads to better idea)
 
 MISA permits extensions to be disabled by masking out the relevant bit.
 Hypothetically it could be used to disable one extension, then enable
@@ -200,14 +200,14 @@ another that happens to use the same binary encoding.
   that wish to simultaneously interpret the same binary encoding.
 * There is nothing in the MISA specification which permits
   *future* versions (bug-fixes) of the RISC-V ISA to be "switched in".
+
 Overall, whilst the MISA concept is a step in the right direction it's
 a hundred percent unsuitable for solving the problem.
 
 # MISA-like
 
-TBD, basically same as mvend/march WARL except needs an extra CSR where
-mv/ma doesn't.
+(Summary: basically same as mvend/march WARL except needs an extra CSR where
+mv/ma doesn't. Along right lines, doesn't meet full requirements)
 
 Out of the MISA discussion came a "MISA-like" proposal, which would
 take into account the flaws pointed out by trying to use "MISA":
@@ -237,15 +237,18 @@ separate page?  review this para?**)
 
 # mvendorid/marchid WARL
 
-TBD paraphrase and clarify
+(Summary: the only idea that meets the full requirements.  Needs
+ toolchain backup, but only when the first chip is released)
 
-Coming out of the software-related proposal by Jacob, which hinged on
-the idea of a global gcc / binutils database that kept and coordinated
-architectural encodings, was to quite simply make the mvendorid and
-marchid CSRs have WARL (writeable) characteristics.  For instances
-where mvendorid and marchid are readable, that would be taken to be
-a Standards-mandatory "declaration" that the architecture has *no*
-Custom Extensions.
+Coming out of the software-related proposal by Jacob Bachmeyer, which
+hinged on the idea of a globally-maintained gcc / binutils database
+that kept and coordinated architectural encodings (curated by the Free
+Software Foundation), was to quite simply make the mvendorid and marchid
+CSRs have WARL (writeable) characteristics.  For instances where mvendorid
+and marchid are readable, that would be taken to be a Standards-mandatory
+"declaration" that the architecture has *no* Custom Extensions (and that
+it conforms precisely to one and only one specific variant of the
+RISC-V Specification).
 
 This incredibly simple non-invasive idea has some unique and distinct
 advantages over other proposals:
@@ -294,13 +297,14 @@ pressing issues to deal with that make resolving encoding conflicts trivial
 by comparison).
 
 Also pointed out was that in certain cases pipeline stalls could be introduced
-during the switching phase, if needed.
+during the switching phase, if needed, just as they may be needed for
+correct implementation of (mandatory) support for MISA.
 
 **This is the only one of the proposals that meet the full requirements**
 
 # ioctl-like
 
-TBD - [[ioctl]] for full details, summary kept here
+(Summary: good solid orthogonal idea.  See [[ioctl]] for full details)
 
 This proposal basically mirrors the concept of POSIX ioctls, providing
 (arbitrarily) 8 functions (opcodes) whose meaning may be over-ridden
@@ -308,11 +312,35 @@ in an object-orientated fashion by calling an "open handle" (and close)
 function (instruction) that switches (redirects) the 8 functions over to
 different opcodes.
 
+The "open handle" opcode takes a GUID (globally-unique identifier)
+and an ioctl number, and stores the UUID in a table indexed by the
+ioctl number:
+
+    handle_global_state[8] # stores UUID or index of same 
+
+    def open_handle(uuid, ioctl_num): 
+          handle_global_state[ioctl_num] = uuid 
+
+    def close_handle(ioctl_num): 
+          handle_global_state[ioctl_num] = -1 # clear table entry
+
+"Ioctls" (arbitrarily 8 separate R-type opcodes) then perform a redirect
+based on what the global state for that numbered "ioctl" has been set to:
+
+    def ioctl_fn0(*rargs): # star means "take all arguments as a tuple"
+        if handle_global_state[0] == CUSTOMEXT1UUID: 
+           CUSTOMEXT1_FN0(*rargs) # apply all arguments to function 
+        elif handle_global_state[0] == CUSTOMEXT2UUID: 
+           CUSTOMEXT2_FN0(*rargs) # apply all arguments to function 
+        else:
+            raise Exception("undefined opcode")
+
 The proposal is functionally near-identical to that of the mvendor/march-id
 except extended down to individual opcodes.  As such it could hypothetically
 be proposed as an independent Standard Extension in its own right that extends
 the Custom Opcode space *or* fits into the brownfield spaces within the
-existing ISA opcode space.
+existing ISA opcode space *or* is used as the basis of an independent
+Custom Extension in its own right.
 
 One of the reasons for seeking an extension of the Custom opcode space is
 that the Custom opcode space is severely limited: only 2 opcodes are free
@@ -324,16 +352,19 @@ being worthwhile in its own right, and standing on its own merits and
 thus definitely worthwhile pursuing, it is non-trivial and much more
 invasive than the mvendor/march-id WARL concept.
 
-# Discussion and analysis
+# Comments, Discussion and analysis
 
-TBD
+TBD: placeholder as of 26apr2018
 
-# Conclusion
+# Summary and Conclusion
 
 In the early sections (those in the category "no action") it was established
 in each case that the problem is not solved.  Avoidance of responsibility,
 or conflation of "not our problem" with "no problem" does not make "problem"
-go away.
+go away.  Even "making it the Fabless Semiconductor's design problem" resulted
+in a chip being *more costly to engineer as hardware **and** more costly
+from a software-support perspective to maintain*... without actually
+fixing the problem.
 
 The first idea considered which could fix the problem was to just use
 the pre-existing MISA CSR, however this was determined not to have
@@ -351,7 +382,11 @@ does not meet the full requirements to be "non-invasive" and "backwards
 compatible" with pre-existing (pre-Standards-finalised) implementations.
 It does however stand on its own merit as a way to extend the extremely
 small Custom Extension opcode space, even if it itself implemented *as*
-a Custom Extension.
+a Custom Extension into which *other* Custom Extensions are subsequently
+shoe-horned.  This approach has the advantage that it requires no "approval"
+from the RISC-V Foundation... but without the RISC-V Standard "approval"
+guaranteeing no binary-encoding conflicts, still does not actually solve the
+problem (if deployed as a Custom Extension for extending Custom Extensions).
 
 Overall the mvendor/march-id WARL idea meets the three requirements,
 and is the only idea that meets the three requirements:
@@ -399,7 +434,7 @@ The following conversation exerpts are taken from the ISA-dev discussion
 
 > Yes. Well, it should be blocked via legal means. Incompatibility is
 > a disaster for an architecture.
-> 
+>
 > The viability of PowerPC was badly damaged when SPE was
 > introduced. This was a vector instruction set that was incompatible
 > with the AltiVec instruction set. Software vendors had to choose,
@@ -412,7 +447,7 @@ The following conversation exerpts are taken from the ISA-dev discussion
 > Both MMX and SSE remain today, in all shipping processors. With very
 > few exceptions, Intel does not ship chips with missing functionality.
 > There is a unified software ecosystem.
-> 
+>
 > This goes beyond the instruction set. MMU functionality also matters.
 > You can add stuff, but then it must be implemented in every future CPU.
 > You can not take stuff away without harming the architecture.
@@ -437,3 +472,8 @@ The following conversation exerpts are taken from the ISA-dev discussion
 > it is implementing. It will test nothing in the custom extension space,
 > and doesn't monitor or care what is in that space.
 
+# References
+
+* <https://groups.google.com/a/groups.riscv.org/forum/#!topic/isa-dev/7bbwSIW5aqM>
+* <https://groups.google.com/a/groups.riscv.org/forum/#!topic/isa-dev/InzQ1wr_3Ak%5B1-25%5D>
+