
RISC-V Offers Simple, Modular ISA - luu
http://riscv.org/2016/04/risc-v-offers-simple-modular-isa/
======
AceJohnny2

        Simple Memory Model
        The  RISC-V  address  space  is  byte  addressed  and  little-endian.  Even  though  most  other  ISAs  such  as  x86  and ARM  have  severalpotentially  complex  addressing  modes, RISC-V  only  uses  base+offset  addressing  with  a  12-bit immediate  to  simplify  load-store  units.
    

I remember reading [1] that one reason C became so popular was because it was
easy to write a compiler for, not because it was easy to write a program in.
Thus, compilers emerged for various platforms, making it accessible. At the
opposite, stuff like Smalltalk (I may be mistaking the language) were
complicated to implement and the compilers/environments were expensive,
limiting the reach.

Looks like the RISC-V is taking a page from this strategy book.

[1] was it Gabriel's Worse Is Better essay?
[https://www.dreamsongs.com/RiseOfWorseIsBetter.html](https://www.dreamsongs.com/RiseOfWorseIsBetter.html)

~~~
FullyFunctional
That has no basis in reality. Smalltalk is to implement that one
implementation fits in the Smalltalk-80 book.

C got popular because it allowed low-level code to be implemented in something
higher-level than assembler and moderately portably too (machines back then
where as lot more dissimilar than today). It's hard to disassociate C from
Unix, the former making the latter easy to port. A symbiotic relationship.

It's important to remember C was designed for the processors of the time,
whereas processors of today (RISC-V included) are arguebly primarily machines
to run C. C has brought a lot of good but also a lot of bad that we are still
dealing with: unchecked integer overflows, buffer under- and overflow, and
more general memory corruption. No ISA since the SPARC even tries to offer
support for non-C semantics.

~~~
nickpsecurity
" C has brought a lot of good"

I've seen no evidence that C brought us anything good. Anything I can do with
C I can do with a Modula-2-like language with better safety and compiler
robustness. If a check is a problem, I can disable it but it's there by
default. Nonetheless, I'll look into any benefits you think C brought us that
alternatives wouldn't have done.

~~~
mwfunk
The alternative to C for systems programming in the '70s was not Modula-2 or
anything like it, the only realistic alternative for most production systems
was writing your kernel code in assembly. C allowed the industry to finally
stop defaulting to assembly for systems programming. That was a very good
thing, regardless of how old and inappropriate C might be for such purposes
nowadays. The comment you were responding to reads to me like someone
providing historical context, not an expression of an ideal.

~~~
nickpsecurity
"The alternative to C for systems programming in the '70s was not Modula-2 or
anything like it"

The main alternatives were ALGOL60, ALGOL68, and Pascal. They were each
designed by people who knew what they were doing in balancing many goals.
They, esp ALGOLS, achieved good chunk of most. A subset and/or modification of
one with gradual progression for improved hardware would've led to better
results than C with same amount of labor invested. On low end, Pascal ended up
being ported to systems from 8-bitters to mainframes. On high end, Burroughs
implemented their mainframe OS in an ALGOL with hardware that enforced its
safety for arrays, stacks, and function calls.

In the 80's, things like Modula-2, Concurrent Pascal, Oberon, and Ada showed
up. I'll understand if they avoided Ada given constraints at the time but the
others were safer than C and quite efficient. More importantly, their authors
could've used your argument back then as most people were doing but decided to
build on prior work with better design. They got better results out of it,
too, with many doing a lot of reliable code with very little manpower. Hansen
topped it off by implementing a barebones, Wirth-like language and system
called Edison on the same PDP that C was born on.

"The comment you were responding to reads to me like someone providing
historical context, not an expression of an ideal."

The historical context in a related comment was wrong, though. It almost
always is with C because people don't know it's true history. Revisionism took
over. The power that revision has in locking in people to C is why I always
counter it with actual evidence from the inventors of the concepts. Two quick
questions to illustrate why I do that and test if it's sensible:

1\. When hearing "the programmer is in control," did you think that philosophy
was invented by Thompson for C or it was stolen without early credit from BCPL
along with its other foundations?

2\. Did you know that those were not designed or validated as a good language
at all? And that they were grudgingly accepted just to get CPL, an ALGOL60
variant, to compile on crappy hardware whose problems no longer exist by
chopping off most important attributes?

If you knew 1 and 2, would you still think C was a "well-designed" language
for systems programming? Or a failed implementation of ALGOL60 whose designers
were too limited by hardware? If No 1, we should emulate the heck out of C. If
No 2, we should emulate ALGOL60-like language that balances readability,
efficiency, safety, and programming in the large. Btw, all the modern
languages people think are productive and safer lean more toward ALGOL more
than C albeit sometimes using C-like syntax for uptake. Might be corroboration
of what I'm saying.

~~~
FullyFunctional
I actually mostly agree with you. My point was poorly made. I didn't mean that
C was particularily great, only that it "won" and having _a_ winner meant more
portable code.

I'll back out of the PL debate; this isn't really the place and there's too
much to be said on the topic than will fit in this margin.

~~~
nickpsecurity
"only that it "won" and having a winner meant more portable code."

That's generally true so long as the winner is open. C was. Now, it runs on
everything.

------
erichocean
If you're at all interesting in getting into hardware, buy yourself a cheap
FPGA and put a RISC-V CPU on it. I'm doing it with my kids and it's been tons
of fun. :)

~~~
blackguardx
I recommend the DE0-Nano:
[https://www.adafruit.com/product/451](https://www.adafruit.com/product/451)

Altera's tools are much nicer for the beginner to use than ones offered by
Xilinx. This board also has a lot of peripherals you can interface with (ADC,
accelerometer, etc.) to grow your skills.

~~~
drakenot
What would be a use case for using one of these FPGAs rather than something
like a Raspberry Pi with a traditional microcontroller?

I'm genuinely interested. I've been really curious about FPGAs but I don't
know what a good use case there is for them for a hobbyist.

~~~
Ericson2314
To see the board running your program, there's a rare beautiful moment where
YOU, one hobbiest, designed the whole stack :).

~~~
copperx
I don't know if this is a stupid question, but could one design a very basic
LISP machine on a FPGA? how about a diminutive JVM?

~~~
Redoubts
Why not? It was done on real hardware in the 80s, right? hell, here's one:

[http://www.aviduratas.de/lisp/lispmfpga/](http://www.aviduratas.de/lisp/lispmfpga/)

------
vmorgulis
I've just found their online simulator (caller ANGEL). It boots linux and
busybox:

[http://riscv.org/angel-simulator/](http://riscv.org/angel-simulator/)

~~~
_kst_

        / # uname -n
        ucbvax
        / # cat /proc/cpuinfo
        CPU info: PUNT!
        / #
    

Amusing.

------
ashitlerferad
No RISC-V post would be complete without a link to lowRISC:

[http://www.lowrisc.org/](http://www.lowrisc.org/)

~~~
maaku
There are many other, equally if not more interesting implementations...

~~~
ashitlerferad
lowRISC is the only project that aims to distribute ASICs AFAIK. Are there
others?

~~~
reportingsjr
The pulp platform has taped out a RISC-V based microcontroller, but I don't
think they have plans to sell/really distribute any asics unfortunately.

~~~
ashitlerferad
Yeah, that is the problem with niche CPU arches; if mass quantities aren't
available to buy (either lone chips or in consumer products), people aren't
going to use it much. Not everyone can afford to have their own fab :)

------
reportingsjr
A microcontroller based on RISC-V was announced recently called the pulpino
[1].

They actually produced some silicon recently, but unfortunately they don't
have plans to sell any. It would be so much fun to play around with a fully
open micro!

[1][http://www.pulp-platform.org/](http://www.pulp-platform.org/)

~~~
razer6
You can start playing on FPGAs. There are prebuilt Xilinx images for PULPino
:)

------
YesThatTom2
Where's the inscrutable register names? Where's the complex instruction
decode? Where's the legacy modes that date back to 1960??

THIS WILL NOT STAND! WHO WOULD WANT TO USE THIS???

~~~
nickpsecurity
Seriously, they need to read Worse is Better before they get into a bad
situation trying to build The Right Thing. Maybe start cranking out x86 clones
to sell off to Intel later on. That's a technology that's paid off several
times. Even Intel couldn't market a superior processor [1] [2]. Sets the bar
high for the little guys. ;)

Note: The manual in Wikipedia link describes full ISA and features. It was
actually a bad-ass CPU design. I'd really like to know what process node the
remaining one's run at. Couldn't find it, though.

[1]
[https://en.wikipedia.org/wiki/Intel_i960](https://en.wikipedia.org/wiki/Intel_i960)

[2] [http://www.intel.com/design/i960/](http://www.intel.com/design/i960/)

------
ashitlerferad
Direct link to the PDF:

[http://riscv.org/wp-content/uploads/2016/04/RISC-V-Offers-
Si...](http://riscv.org/wp-content/uploads/2016/04/RISC-V-Offers-Simple-
Modular-ISA.pdf)

------
Animats
This is a paper CPU, right? You can't actually buy an IC. Even though there's
a Linux port for it and four annual conferences so far.

There seem to be too many CPU options. Multiply and divide as an option
belongs down at the 50 cent 8-bit CPU that runs a microwave oven, not on
something that runs Linux. Optional floating point is maybe OK, although you
should be able to trap if it's not implemented and do it in software. You
don't want to have zillions of builds with different option combinations. That
drove MIPS users nuts.

The protection levels are still undefined; "User" mode is designed, but what
happens at Supervisor, Hypervisor, and Machine mode?

If this were well-defined and cheap tablets were coming out of Shentzen using
it, it would be important.

~~~
_chris_
> This is a paper CPU, right?

What? No, it's an Instruction Set Architecture. It's the language the CPU
speaks.

> Multiply and divide as an option belongs down at the 50 cent 8-bit CPU that
> runs a microwave oven, not on something that runs Linux

Irrelevant, nobody has to know your CPU doesn't implement multiply/divide, not
even the OS!; you trap to machine mode and life goes on. And not every RISC-V
core needs to run Linux.

> but what happens at Supervisor, Hypervisor, and Machine mode?

You read the manual that exists, implement the privileged spec, and it'll run
Linux. Just because it's not frozen doesn't mean that many RISC-V cores can't
already boot a number of different operating systems.

> If this were well-defined and cheap tablets were coming out of Shentzen
> using it, it would be important.

There are already shipping products with RISC-V cpus (like in cameras). Just
because you're not the customer doesn't mean this work isn't very important to
other people.

------
bogomipz
This is all interesting. I have question about the "Free and Open" part. Does
this mean I could go and manufacture a an FPGA that implements this ISA and
sell a product that uses it?

~~~
_chris_
Yes. You can do whatever you want, even extending or changing the ISA as you
want (though if you break I-subset compatibility, the only thing you can't do
is still call it a RISC-V processor).

------
bogomipz
How do these compare to the Power8 chips? I know Power8 is targeting
supercomputers, government research and some large banks.

~~~
PeCaN
It doesn't.

How does Apple's A9X compare to a Xeon E7?

RISC-V is excellent for hobbyist boards, mobile CPUs, high-efficiency low-
performance servers, as a base for DSPs, high-efficiency network equipment,
etc. Everything from the DSP in your phone to a Rasperry Pi to a Macbook Air.

POWER8 is excellent for high-performance computing, supercomputers, and
workstations (Talos[1] when?! :( ). Things like CAPI, Nvlink, etc—stuff that's
well outside the scope of RISC-V (though I suppose you could make an ISA
targeting HPC based on the RISC-V base integer ISA, but it would only
tangentially resemble RISC-V by the time you're done).

Personally I'm looking forward to using both of them in the future!

1\.
[https://raptorengineeringinc.com/TALOS/prerelease.php](https://raptorengineeringinc.com/TALOS/prerelease.php)

~~~
bogomipz
The Talos stuff looks interesting but $3,700 is a bit of sticker shock.
Hopefully demand and economies of scale will drive down those price points.

~~~
nickpsecurity
POWER has been overpriced for too long. From my past looks at catalogs, paying
$3,700 today would be a steal to get a high-performance, POWER workstation.
Not necessarily competitive price/performance with Intel but certainly with
older RISC workstations.

