--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/0b7c0d18-a5e4-0696-fe0b-e3a25c07f8c7%40cesarb.eti.br.
notation by example:
4rsd = registers x0-x15 used as rd and rs1
4rs2* = registers x1-x15 used as rs2
3rs1 = registers x8-x15 used as rs1 encoded as in the C extension
5imm = 5bit immediate.
7imm* = 7bit nonzero immediate
# = comment
#instruction = instruction that does not currently exist in RVIMA but might become one in B or small integer extension
lx = lh for rv16 lw for rv32, ld for rv64 lq for rv 128 (or maps to a hypothetical lx instruction with an immediate in units of XLEN/8 byte). Also x is used to indicate shift over log2(XLEN/8)
@auipc zero imm: break 5imm = sneak in the break instruction by reusing the li opcode with rsd = zero
li 4rd* 5imm addi rd zero sext(imm)
li_7 4rd* 5imm addi rd zero sext(imm<<7)
lui 4rd* 5imm lui rd sext(imm) #aka li_12
auipc 4rd* 5imm auipc rd sext(imm) #aka ai_12pc
addi 4rsd* 7imm* addi rsd rsd sext(imm, XLEN)
ai_xsp 4rd* 7imm* add rd sp sext(imm<<7) #for stack adjustment and pointers into stack. Assume stack is 2*XLEN/8 aligned. Alternatively define addi16sp imm add sp sp imm<<4 (aka addi_4sp) for rd = sp
addwi 4rsd* 5imm addwi rsd rsd sext(imm<<7) #replace with addhi for 16/32 portability
addi_7 4rsd* 5imm* addi rsd rsd sext(5imm << 7)
addi_x 4rsd* 5imm* addi rsd rsd sext(5imm << log2(XLEN/8)
addi_5x 4rsd* 5imm* addi rsd rsd sext(5imm << (log2(XLEN/8)+5))
beqz 4rs1* 7imm* beq rs1 zero imm
bnez 4rs1* 7imm* bne rs1 zero imm
jalri 4rsd 7imm jalr rsd rsd sext(imm) #mainly useful for milicode: use li_7 t0 MILICODE_BASE jalr t0 imm to call imm for a milicode call en li_7 t1 MILICODE_BASE jalr t1 imm for a tailcall
lxsp 4rd* 7imm l[h/w] rd sext(imm<<log2(XLEN/8))(sp)
lx 3rd 3rs1 5imm l[h/w] rd zext(imm<<log2(XLEN/8))(rs1)
lw 3rd 3rs1 5imm lh rd zext(imm<<1)(rs1) #replace with lh 3rd 3rs1 5imm for 16/32 portability
lbu 3rd 3rs1 3imm lbu rd zext(imm)(rs1) # replace all with lbu, 3rd 3rs1 5imm for 16/32 portability
lh 3rd 3rs1 3imm lh rd zext(imm<<1)(rs1) # replace with ld for 64/128 portability
flw 3rd 3rs1 3imm flw rd zext(imm<<2)(rs1)
fld 3rd 3rs1 3imm fld rd zext(imm<<3)(rs1)
sxsp 4rs1* 7imm s[h/w] rs1 sext(imm <<log2(XLEN/8))(sp)
sx 3rd 3rs1 5imm s[h/w] rs1zext(imm<<log2(XLEN/8))(sp)
sw 3rd 3s1 5imm sh rs1 zext(imm<<1)(sp) #replace with sh 3rs1 3rs2 5imm for 16/32 portability
sb 3rs1 3rs2 3imm lbu rd zext(imm)(rs1) # replace with sb, 3rd 3rs1 5imm for 16/32 portability
lh 3rs1 3rs1 3imm lh rd zext(imm<<1)(rs1)
fsw 3rs1 3rs2 3imm flw rd zext(imm<<2)(rs1)
fsd 3rd 3rs1 3imm fld rd zext(imm<<3)(rs1)
auipc_ra 11imm auipc ra sext(imm) for 32/64
jalr_rara 11imm jalr ra ra imm<<1 #use in combination with auipc_ra. Fusable to effectively jal ra 22imm
j 11imm* jal zero sext(imm)
jal 11imm* jal ra sext(imm)
andi 4rsd* 5imm andi rsd rsd sext(imm) #imm == 0 and imm == -1 are both useless.
slli 4rsd* 5imm slli rsd rsd sext(imm) #imm ==0 encodes 32 for 32/64
srli 4rsd* 5imm srli rsd rsd sext(imm) #likewise
srai 4rsd* 5imm srai rsd rsd sext(imm) #likewise
add 4rsd* 4rs2* add rsd rsd rs2
sub 4rsd* 4rs2* sub rsd rsd rs2
addw 4rsd* 4rs2* addw rsd rsd rs2 #replace with addh for 16/32, to follow the letter of the RV spec simply map to add instead of addw in RV32
subw 4rsd* 4rs2* subw rsd rsd rs2 #replace with addh for 16/32, to follow the letter of the RV spec simply map to add instead of addw in RV32
slt 4rsd* 4rs2 slt rsd rsd rs2
sltu 4rsd* 4rs2 sltu rsd rsd rs2
mv 4rd* 4rs1* add rd rs1 zero
jalr 4rd 4rs1* jalr rd rs1 0
and 3rsd 3rs2 and rsd rsd rs2
or 3rsd 3rs2 or rsd rsd rs2
xor 3rsd 3rs2 xor rsd rsd rs2
#addh 3rsd 3rs2 #superfluous for 16/32
sll 3rsd 3rs2 sll rsd rsd rs2
srl 3rsd 3rs2 srl rsd rsd rs2
sra 3rsd 3rs2 sra rsd rsd rsd
#rll 3rsd 3rs2 #rs2 is taken mod log2(XLEN), therefore negative values rotate right.
mul 3rsd 3rs2 mul rsd rsd rs2
mulh 3rsd 3rs2 mulh rsd rsd rs2
mulhsu 3rsd 3rs2 mulhsu rsd rsd rs2
mulhu 3rsd 3rs2 mulhu rsd rsd rs2
div 3rsd 3rs2 div rsd rsd rs2
divu 3rsd 3rs2 div rsd rsd rs2
rem 3rsd 3rs2 rem rsd rsd rs2
remu 3rsd 3rs2 rem rsd rsd rs2
not 3rd 3s1 xori rd rs1 -1
sllx 3rd 3rs1 slli rd rs1 x
#sextb 3rd 3rs1
#sexth 3rd 3rs1
#sextw 3rd 3rs1
#zextb 3rd 3rs1
#zexth 3rd 3rs1
#zextw 3rd 3rs1
#popc 3rd 3rs1
#clz 3rd 3rs1
#bswap 3rd 3rs1
lr rd rs1 lr rd rs1
sc rsd rs1 sc rsd rs1 rsd
lrw rd rs1 lrw rsd rs1 rsd #for 16/32 portability just drop
scw rsd rs2 scw rsd rs1 rsd #for 16/32 portability just drop
amoadd 3rsd 3rs1 amoadd.aqrl rsd rs1 rsd
amoaddw 3rsd 3rs1 amoaddw.aqrl rsd rs1 rsd #for 16/32 portability just drop
amoswap 3rsd 3rs1 amoswap.aqrl rsd rs1 rsd
amoand 3rsd 3rs1 amoand.aqrl rsd rs1 rsd
amoor 3rsd 3rs1 amoor.aqrl rsd rs1 rsd
amoxor 3rsd 3rs1 amoxor.aqrl rsd rs1 rsd
memadd 3rsd 3rs1 amoadd. rsd rs1 rsd #no ordering, but indivisible
memaddw 3rsd 3rs1 amoaddw. rsd rs1 rsd #no ordering, but indivisible; for 16/32 portability just drop
memswap 3rsd 3rs1 amoswap. rsd rs1 rsd #no ordering, but indivisible
memand 3rsd 3rs1 amoand. rsd rs1 rsd #no ordering, but indivisible
memor 3rsd 3rs1 amoor. rsd rs1 rsd #no ordering, but indivisible
memxor 3rsd 3rs1 amoxor. rsd rs1 rsd #no ordering, but indivisible
csrrw 3rsd imm7 csrrw rsd rsd map(imm7) #mapping TBD
csrrs 3rsd imm7 csrrs rsd rsd map(imm7)
csrrc 3rsd imm7 csrrc rsd rsd map(imm7)
csrr 3rd imm7 csrrc rd zero map(imm7)
@li zero 0 : designated illegal
@li zero 1 : ecall
@li zero 1imm[3:0] : break 4imm #different breaks are useful for hosted environments
@li_7 zero 0imm[3:0] : mfence 4imm fence.imm0000
@ll_7 zero 1imm[3:0] : iofence 4imm fence 0000imm
@lui zero 0 : ifence
(CC'ing Liviu Ionescu and Jacob Bachmeyer as something like this might be useful for the microcontroller spec,
John Hauser because he proposed modifications for RV32E and RV32EC to better use halfword and bytesize data,
Kelly Dean because he proposed ideas on binary portability between RV32 and RV64,
Michael Clark because of RV8 JIT,
and Xan Phung in recognition of his ideas on Xcondensed).
(A) rather than add RV16 (and even RV8!) to the existing instruction
set, registers are "tagged" into a CSR with a size (exactly as is
proposed in V-Extension, right now). by setting the Vector length
equal to one, you have the means to use the "implicit-sized"
operations.
(B) you *still* add RV16 (and possibly even RV8) *not* so much because
someone might want to implement stand-alone 16-bit or 8-bit processors
(they might) but because those instructions would become *part of
RV32/64/128*.
so in the case that you describe, rogier, of condensed instructions in
the proposed RV16, they might not actually matter as much. to make
that clear: the counter-arguments against RV16 *did not take into
account* the fact that RV16 (or RV8) operations would be accessible to
RV32/64/128, and as such could reduce the burden of implementing a B
extension proposal, and also a simplified V extension proposal.
if Bit-wise operations are *forced* to be carried out on the full
(default) bit-width, how on earth do you do 16-bit rotate when it's
needed? or 8-bit rotate? it has to be *explicitly* coded into the
actual Bit-wise instruction, doesn't it?
and in some cases you *really cannot* do full (default, 32/64/128
bit-wise operations). for example here:
https://groups.google.com/a/groups.riscv.org/d/msg/isa-dev/zi_7B15kj6s/w9y_KHM0AwAJ
clifford points out that the proposed BGS (bit gatherer and shuffler)
instruction is limited deliberately to only 16 bits, because the
amount of control/bit-manipulation information required to arbitrarily
swap greater than 16 bits is simply too large.
.... but if there was an instruction which explicitly allowed the
operand size to be reduced to 16 or 8 bits, that problem is solved, is
it not?
anyway apologies to you, rogier, i'm not ignoring what you described :)
l.
On 4 April 2018 at 17:27:44, Rogier Brussee (rogier....@gmail.com) wrote:
> CC'ing Liviu Ionescu ... as something like
> this might be useful for the microcontroller spec
...
> an alternative for the C extension using 16bit wide instructions
> with a comparable code compression characteristics as the standard
> C extension
Thank you, Rogier.
As far as the microcontroller proposal is targetted, I already
mentioned that it does not focus on changes to the instruction set,
but to making the architecture more C/C++ friendly.
So, any instruction sets and encodings that will be agreed for the
privileged profile will probably be ok for the microcontroller profile
too, except the ABI, which needs a redesign to reduce the number of
registers saved by the caller and possibly be consistent with the
RV32E reduced number of registers.
In my oppinion, in a well designed architecture, the actual user
should have nothing to do with the instruction set at all, the
toolchain must deal with these details, not the end user.
This does not mean that the instruction set is not important, it
obviously it, but it is not the corner stone of the microcontroller
profile.
In addition, although I agree that there may be use cases that I did
not think about, I would not go below 32-bits registers and memory
space.
Regards,
Liviu
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/e3113485-a024-40e7-b931-cd4f316e366e%40groups.riscv.org.
oof, whoops rogier, the cc list was borked! :) also i tracked down some cross-references to the various discussions you mention, for the benefit of people who may not have seen them (or wish to re-read and refresh their memories).
On Wednesday, April 4, 2018 at 3:27:43 PM UTC+1, Rogier Brussee wrote:(CC'ing Liviu Ionescu and Jacob Bachmeyer as something like this might be useful for the microcontroller spec,John Hauser because he proposed modifications for RV32E and RV32EC to better use halfword and bytesize data,
Kelly Dean because he proposed ideas on binary portability between RV32 and RV64,i *think* it's this link (kelly, rogier, can you confirm?)
ok whoops that's important to note that it's "rv8 as in like google v8" *NOT* repeat *NOT* "RV8" as in "RV8, RV16, RV32, RV64, RV128...."
and Xan Phung in recognition of his ideas on Xcondensed).i believe you may be referring to this, rogier?
The user-mode I set is frozen, (and honestly, quite well-designed) so it's too late for a size field to be added to the ISA.
But, 32 registers are too many for most register allocators to use well, so I have always thought
this wasted some bits, and was a real opportunity for improvement.
If R-format instructions were recast for 16 registers, 3 bits are freed for an orthogonal size field.
Other formats could extend the immediate fields.
Five of the sizes are obvious: 8, 16, 32, 64, 128. The three unused sizes could handle the misty future.
Regards,
Liviu
My opinion is that you should fix the compiler rather than adding half word or byte signed and unsigned add instructions to the ISA. There are very few occasions where there they will be useful - even on code written for 8 or 16 bit cores.
We do have an option to support unaligned accesses on all our cores. On our smallest cores, customers very rarely use this option - even when their code is coming from an 8 or 16 bit processor.
I think unaligned accesses should be prohibited and dropped from the specification. At the moment the spec says that an unaligned access could be very slow. In which code will avoid ever using it. And then there is no point in having it in the spec at all.
A bit field insert instruction is often useful for deeply embedded code. I.e. an instruction which can take the n least significant bits from a register and insert them at an arbitrary position in another register without upsetting the other bits. This can be used for coding rotates as well.
16 registers is plenty for most applications we see. For RV32E I would still allow the possibility to have single precision floating point, but would not encode them into 16 bit instructions. I would also not have a separate floating point register file but use the same registers as for integer instructions.
http://people.eecs.berkeley.edu/~krste/)
The V-extensions are not stalled.
Hwacha is an implementation of a vector processor, but it is not compatible with the proposed V-extensions.
See Esperanto Technology’s presentations.
Richard
whaaat's gooing ooon?
l.
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/CAPweEDzc8Mg9R9W7Unt-09%3De4RD6RjKjk%3DKsZvbD2_Y9B3Jabw%40mail.gmail.com.
microcontrollers.
There’s nothing from stopping us from writing a microcontroller spec which does not comply to the privilege spec, but still comply to the user spec and the other extensions.
Richard
regards,
Liviu
On 17 March 2018 at 02:16:23, kr...@berkeley.edu (kr...@berkeley.edu) wrote:
... The
new task group is looking at extending interrupt behavior, but
with a
view to maintaining backwards compatibility and to support
dual-use
cores that run either real-time or virtual-memory code.
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/CAG7hfcLUJt9DXDLJvA8-4Apyu7Zk-pQS7Uonng9RfrjEh6sjkA%40mail.gmail.com.