riscv

Chisel3. Functional Module Mux4

纵饮孤独 提交于 2019-12-11 00:23:14
问题 I'm learning Chisel following the documentation on Github Thus far, everything worked flawlessly. But i'm stuck at chapter 13, "Functional Module Creation" I can't get the code to work . I created all my .scala classes in a copy of the chisel-template-project. Here is what i wrote / copied to create a Mux4 with variable bit width : /chisel-template/src/main/scala/ Mux4.scala import Chisel._ class Mux4(w: Int) extends Module { val io = IO(new Bundle { val sel = UInt(INPUT, 2) val in0 = UInt

How to simulate the RISCV Rocket chip

时间秒杀一切 提交于 2019-12-09 02:07:33
问题 According to the riscv-gcc compiler we are generated the binary file. This binary file data are feeding to rocket chip through this signals. io_host_in_valid, input [15:0] io_host_in_bits Here io_host_in_bits is 16-bit, so we are driving the 2-times for each instruction data in little-Endian mode. We are not getting any response from Rocket core (HTIF). How to simulate the Rocket core and if it is possible to simulate in Xilinx Vivado 2014 as well as debug the design. Can any one help me

Zero/sign-extend are no-op, why then instructions for each size type?

好久不见. 提交于 2019-12-06 06:51:29
For x86 and x64 compilers generate similar zero/sign extend MOVSX and MOVZX. The expansion itself is not free, but allows processors to perform out-of-order magic speed up. But on RISC-V: Consequently, conversion between unsigned and signed 32-bit integers is a no-op, as is conversion from a signed 32-bit integer to a signed 64-bit integer. A few new instructions (ADD[I]W/SUBW/SxxW) are required for addition and shifts to ensure reasonable performance for 32-bit values. (C) RISC-V Spec But at the same time, the new modern RISC-V 64-bit processors contains instructions for 32-bit signed

RISC-V disassembler doesn't match with spike running results?

百般思念 提交于 2019-12-06 04:57:55
I've set up a hello world program just for testing my riscv32-unknown-elf toolchain, spike , pk etc. Though I managed to get the hello world printed using spike --isa=RV32 pk hello.elf , I found out that if I added the -d flag for debugging, I was given following instructions (a section of the whole): core 0: 0x0000000000001000 (0x7ffff297) auipc t0, 0x7ffff : core 0: 0x0000000000001004 (0x00028067) jr t0 : core 0: 0xffffffff80000000 (0x1b00006f) j pc + 0x1b0 : core 0: 0xffffffff800001b0 (0x00000093) li ra, 0 : core 0: 0xffffffff800001b4 (0x00000113) li sp, 0 : core 0: 0xffffffff800001b8

How to simulate the RISCV Rocket chip

余生长醉 提交于 2019-12-04 22:43:25
According to the riscv-gcc compiler we are generated the binary file. This binary file data are feeding to rocket chip through this signals. io_host_in_valid, input [15:0] io_host_in_bits Here io_host_in_bits is 16-bit, so we are driving the 2-times for each instruction data in little-Endian mode. We are not getting any response from Rocket core (HTIF). How to simulate the Rocket core and if it is possible to simulate in Xilinx Vivado 2014 as well as debug the design. Can any one help me about this Regards, Santhosh Kumar. For more information on the Rocket Chip infrastructure, I recommend

What is meant by the FENCE instruction in the RISC-V instruction set?

血红的双手。 提交于 2019-12-03 12:41:58
问题 While going through the RISC-V ISA, I have seen an instruction in the memory model section (FENCE instruction). What does it mean exactly? 回答1: I've found one case when using FENCE instruction is just necessary. Example: Some module in a SoC generates interrupt by writting value into CSR 0x783 (MIPI) via HostIO bus. Firmware jumps to the interrupt handler. Handler tries to reset 'pending' bit in a user implemented device by writting 1 into register. Such operation was compiled as a 'store'

How do I write rotation Operation for the Risc-V(Assembly Language) Do we have any command for it like we have have in 8086?

雨燕双飞 提交于 2019-12-02 18:01:38
问题 I have worked with assembly language of 8086 previously, rotation operation in 8086 was just a command. But I can't find a specific keyword for rotation operation in Risc-V assembly language. 回答1: It looks like extension "B" should define such an instruction eventually. Until then you have to compose it using left and right shifts. Here's an equivalent of the MIPS32R2 rotrv instruction (rotate right by variable count): rotrv: subu neg_count, zero, count srlv tmp1, src, count sllv tmp2, src,

How to debug cross-compiled QEMU program with GDB?

风格不统一 提交于 2019-12-02 06:54:27
I'm having trouble debugging a simple program running in QEMU with GDB. GDB seems unable to find where I am in the program (in that it always displays ?? as my current location), and it never hits any breakpoint I set. In one terminal, I run QEMU: $ cat add.c int main() { int x = 9; int v = 1; while (1) { int q = x + v; } return 0; } $ riscv64-unknown-elf-gcc add.c -g $ qemu-system-riscv64 -gdb tcp::1234 -drive file=a.out,format=raw And in another terminal, I run GDB: $ riscv64-unknown-elf-gdb a.out GNU gdb (GDB) 8.2.90.20190228-git Copyright (C) 2019 Free Software Foundation, Inc. License

How can I compile C code to get a bare-metal skeleton of a minimal RISC-V assembly program?

柔情痞子 提交于 2019-11-30 05:04:29
I have the following simple C code: void main(){ int A = 333; int B=244; int sum; sum = A + B; } When I compile this with $riscv64-unknown-elf-gcc code.c -o code.o If I want to see the assembly code I use $riscv64-unknown-elf-objdump -d code.o But when I explore the assembly code I see that this generates a lot of code which I assume is for Proxy Kernel support (I am a newbie to riscv). However, I do not want that this code has support for Proxy kernel, because the idea is to implement only this simple C code within an FPGA. I read that riscv provides three types of compilation: Bare-metal

Rocket Chip on Non-Zynq FPGAs

帅比萌擦擦* 提交于 2019-11-29 07:35:30
I want to port the rocket chip to a non-Zynq FPGA (an altera Stratix V), a board which doesn't contain an ARM core used to run the riscv-fesvr. How can I go about starting the port? Also, has anyone attempted to run the rocket chip on such a board? Can I pointed to some resources for that? This is mainly an issue of interfacing, as Rocket Chip does not use anything Zynq specific internally. If this interfacing is done properly, you should not need to change pk/linux or Rocket Chip itself. You will need to both wrap Rocket Chip for the target FPGA and interface to it with a Frontend Server