In the Digital Design and Computer Architecture RISC-V Edition page 442, a pipelined CPU is designed with separate instruction and data memories, as shown in the figure below.
However, this picture doesn’t show how modern CPUs work. Most of them use a single memory that holds both instructions and data. I’m interested in how this setup allows the CPU to fetch future instructions at the same time it reads and writes data. Also, are there different methods for embedded systems compared to general-purpose CPUs?
Feel free to reference reading material or anything I should look into.
Follow-up
Given that most discussions suggest the use of separate L1 caches for instructions and data, ultimately leading to shared memory, does this imply that the Instruction Fetch operation can take a variable number of cycles? For instance, it could take as few as two cycles in the following sequence:
- Rising clock edge
- Setting the inputs for the cache
- Next rising clock edge
- Reading data from the cache if it is present
Conversely, if a cache miss occurs and the cache needs to fetch data from main memory, could this operation take an arbitrarily larger number of cycles? Is that how things happen or is there a different approach.