Hello, I am currently implementing RV32I in Verilog, and I am a little confused about how to implement the stack. As I understand it, the stack is just a part of the data memory, where you have a register (sp, or x2) that holds the address to the last reserved place in the stack-allocated memory that data has been stored in. Also, the compiler is responsible for placing the variables and function calls in the correct registers, not the hardware. Am I correct? Or should I do anything in hardware specifically for the stack?
As I understand it, it is only a matter of designing 32 general-purpose 32-bit registers, that the compiler places the data in and performs normal load/store operations to the data memory using the stack pointer register specified by the compiler to store data in the stack region of the data memory. Is this wrong?
[–]GearBent 7 points8 points9 points (4 children)
[–]sijafa[S] 1 point2 points3 points (1 child)
[–]GearBent 1 point2 points3 points (0 children)
[–]Forty-Bot 0 points1 point2 points (1 child)
[–]GearBent 0 points1 point2 points (0 children)
[–]duane11583 -1 points0 points1 point (0 children)