Questions tagged [riscv]

For questions related to RISC-V assembler, compiler specifics and HDL (hardware description language) implementation and use. Note: Questions on hardware implementation will be more appropriate for the electronics engineering site: https://electronics.stackexchange.com

Summary

RISC-V (pronounced "risk-five") is an instruction set architecture (ISA) that was originally designed to support computer architecture research and education and is now a standard open architecture for industry implementations under the governance of the RISC-V Foundation. RISC-V was originally developed in the Computer Science Division of the EECS Department at the University of California, Berkeley.

Features

  • A completely open ISA that is freely available to academia and industry.

  • A real ISA suitable for direct native hardware implementation, not just simulation or binary translation.

  • An ISA that avoids "over-architecting" for a particular microarchitecture style (e.g., microcoded, in-order, decoupled, out-of-order) or implementation technology (e.g., full-custom, ASIC, and FPGA), but which allows efficient implementation in any of these.

  • An ISA separated into a small base integer ISA, usable by itself as a base for customized accelerators or for educational purposes, and optional standard extensions, to support general-purpose software development.

  • Support for the revised 2008 IEEE-754 floating-point standard.

  • An ISA supporting extensive user-level ISA extensions and specialized variants.

  • 32-bit, 64-bit, and 128-bit address space variants for applications, operating system kernels, and hardware implementations.

  • An ISA with support for highly-parallel multicore or manycore implementations, including heterogeneous multiprocessors.

  • Optional variable-length instructions to both expand available instruction encoding space and to support an optional dense instruction encoding for improved performance, static code size, and energy efficiency.

  • A fully virtualizable ISA to ease hypervisor development.

  • An ISA that simplifies experiments with new supervisor-level and hypervisor-level ISA designs.

References

1220 questions
-1
votes
1 answer

Verilator does not seem to recognize casez statement, any idea of how to solve this?

I'm trying to code a riscv decoder in system verilog, here's the code : case(opcode) 7'b0110011: assign r_type = 1'b1; 7'b0010011: assign i_type = 1'b1; 7'b0000011: assign i_type = 1'b1; 7'b0100011: assign…
-1
votes
1 answer

How to detect an overflow on assembler risc-v?

I am trying to implement a recursive factorial function in RISC-V assembly language that raises an error if there is an overflow. However, I am struggling to detect it. Is there a solution for this ? `
-1
votes
1 answer

how to load a 32-bit constant starting at memory address 0x300

I have to store the hex 0x1234ABCD into a register s0 that starts at memory address 0x300? lui s0, 0x1234B addi s0, s0, 0xFFFFFBCD ????? I expect to have stored in s0 0x1234ABCD so then I can manipulate each address as such: address 0 holds 0x12,…
Rylion
  • 5
  • 3
-1
votes
1 answer

Open source and independent ARM and RISC-V assemblers

I'm creating a project and I need INTEL, ARM and RISC-V assemblers that are independent and run on Windows and Linux. For the INTEL architecture, I found the NASM assembler, it fulfills all my requirements, however I cannot find the assemblers for…
-1
votes
1 answer

How to change the label name in Risc v

Im writing a program in RISC V assembly to ask the user for his name as per the dialogue What is your name? Lena Hello Lena! This is what I have but I keep getting this error. I don't know the exact problem I tried changing the label name but…
-1
votes
1 answer

RISC-V using stack in recursive call

Can someone explain how the a0 pointer doesn't get reverted back to the original value? The code below takes the string created using the DC instruction and reverses it. Trecrev is called recursively, and uses the stack to store values. I can…
-1
votes
1 answer

PlatformIO build error on SiFive when adding an assembly file

I have installed PlatformIO on my vscode, on Ubuntu. I have created a project with Freedom E SDK and added a simple main.c file: int main(void) { return 0; } Then, when I try to build, it works: Processing hifive1 (platform: sifive; board:…
Dan
  • 2,452
  • 20
  • 45
-1
votes
1 answer

Extracting instructions from an ELF file

For a program I'm working on, I need to extract the instructions of an ELF binary compiled for the risc-v arch. The way i'm trying to extract the instructions is the following: void dumpCode(FILE *file, Elf32_Phdr *segm, Elf32_Ehdr *header) { …
Josep
  • 162
  • 1
  • 9
-1
votes
1 answer

Why RISC-V don't have conditional branch equal with immediate value?

Following is most common conditional branch code in my RISC-V assembly project. li a0, UART1_BASE; lw t0, UART_INTR_PEND_OFFSET(a0); // Read UART interrupt pending status andi t0, t0, 1; li t1, 1; // IMM LOAD beq t0, t1, LB_process_tx; // UART Tx…
RRON
  • 1,037
  • 3
  • 12
  • 32
-1
votes
1 answer

Is the RISC V source code available to the public (Where is the source code?)

I am a student and would like to know where the source code for RISC V is hosted at so I can learn and create my own 'architecture', with credits of course. And my other question is that if the source code is inaccessible to the community, then how…
-1
votes
1 answer

What is the value of x5 at the end of the execution of this instruction?

addi x5,x0,1 addi x6,x0,5` loop: blt x6,x0,EXIT addi x6,x6,-1 slli x5,x5,1 jal x0,loop exit assuming x5=0, x6=0, i'd like to understand why after the execution x5=64.
exiturnor
  • 57
  • 1
  • 5
-1
votes
1 answer

RiscV forwarding, why don't we need it?

can someone help me understand why between line 1 and 3 we don't need forwarding (there is no green arrow as between 1 and 2) I think we need it because sub uses the value of t0 which add determines and both are doing read and write of that value…
user15086117
-1
votes
1 answer

How do you print an array of strings to console in RISC-V?

I am really confused about how to print arrays of strings to console in RISC-V. I am having trouble finding helpful examples and documentation. I know that you could use ecall with addi, a0,x0, 4, but I can only find examples of the ecall being used…
A.boj
  • 1
  • 3
-1
votes
1 answer

Eliminating J operation in assembly?

In the following question what will happen if I didn't write Exit? I assume it will continue to Else branch, is that right? or it will skip all branches until it reaches code outside a branch?
user14528398
-1
votes
1 answer

Go compiler produces strange load into x0

I am using Go 1.14 with linux/riscv64 target, and I'm compiling a hello world where I am seeing this in the assembly: 1b078: 04813183 ld gp,72(sp) 1b07c: 00018003 lb zero,0(gp) 1b080: …
gonzo
  • 442
  • 4
  • 15