Why PC in RISC V architecture connect with PC+4 instead of PC+2 or PC+1. I think it depend on the width of memory cell of the Instruction Memory (IMEM). If the width is 16 bits, then we need to load two adjacent addresses to fill 32 bits instruction or if the width is 32 bits, we only need to load one address to take the full instruction.
Why Program Counter in RISC V should be added by 4 instead of adding 0 or 2
6.6k views Asked by Khoa Trần At
1
There are 1 answers
Related Questions in MEMORY
- 9 Digit Addresses in Hexadecimal System in MacOS
- Memory location changing from 0 to 1 consistently on Mac
- Would event listeners prevent garbage collecting objects referenced in outer function scopes?
- tensorrt inference problem: CPU memory leak
- How to estimate the memory size of a binary voxelized geometry?
- Java Memory UTF-16 Vs UTF-8
- Spring Boot application container memory footprint (Java 21)
- Low memory Windows CE
- How to throw an error when a program acesses a block of memory created by you that has been deallocated by a call of free?
- Golang bufio.Scanner: token too long
- Get the address and size of a loaded shared object on memory from C
- In Redis Databases how do we need to calculate the table size
- ClickHouse Materialized View consuming a lot of Memory and CPU
- How to reduce memory usage for large matrix calculations?
- How to use memray with Gunicorn or flask dev server?
Related Questions in PROGRAM-COUNTER
- Why in this case the offset relative to "pc" is 0x14, not 0x1C or 0x18?
- RISC-V architecture, why do one add 4 bytes with no branch but shift with one when branch?
- Program Counter value shifted/corrupted. Cortex M4 (STM32)
- Booting the CPU through JTAG debugger. How to exit from debug state and start from newly added PC address
- How to find range of addresses using MIPS instructions
- What value does the Program Counter have at the end of a program?
- What does RISC-V do on PC overflow?
- React Typescript how to add a counter for each item instantiated?
- Difference between rip and eip registers in x86 Assembly
- How many bits do instruction sets have in ARM?
- Move the PC into another register with xtensa (lx6) cores
- Does the fetch phase in the x86 CPU increment eip(PC) to the next instruction?
- Break at address "0xXXXXXXX" with no debug information available, or outside of program code
- PIC 16F84 PCLATH Bit3+4 unnecessary for CALL/GOTO?
- y86 instructions set create confusion
Related Questions in RISCV32
- Initializing array in RISC-V. How much space does it need?
- How can compile a .c file with riscv-none-embed-gcc compiler and generate intruction code at every consecutive address?
- OpenOCD failed to read memory
- How can I get clang compiler / lld linker for riscv32 to not use an lui for every memory address in the same range?
- how can my program tell if code is in a interrupt handler?(riscv32)
- How I can retrieve the sp on an risc-v32 without having UB?
- CMake find_path return NOT FOUND
- RISC-V paging: what decides the way the Dirty and Accessed bits are managed?
- Concatenate values to float64 in RISC V
- Pipelining stalls and data-forwarding
- Creating Cache Conflict in assembly
- "Properly" dereferencing pointer to address zero in RISC-V
- Calling Macro in extended assembly
- C code with vector instrinsics for Riscv Vector
- What determines how a 64-bit function argument is split between registers on RISC-V 32?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
RISC-V deals with everything in byte addresses (from page 19 of the ISA manual: "RV32I provides a 32-bit user address space that is byte-addressed and little-endian"). So when using byte addresses, it makes sense to think of the PC as incrementing by 4, as each of the RV32 instructions are 4 bytes.
When we say RISC-V increments the PC by 4, what that means is that for any given byte address
Xof a 32-bit RISC-V instruction, the next instruction will begin in memory at addressX+4. (Note that when using compressed instructions, which are 16 bits / 2 bytes, the PC is incremented by 2).An IMEM read width of 16 bits means 2 reads from IMEM are necessary to get a full instruction, and an IMEM read width of 32 bits means only 1 read from IMEM is necessary to get a full instruction. But these are implementation considerations, not an ISA considerations -- you could hypothetically implement an ISA-compliant RISC-V processor with either type of IMEM.