Commit 0f19e191 authored by Davide Pala's avatar Davide Pala
Browse files

Add const qualifier to read only pipeline registers

parent f319cc93
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "core.h" #include "core.h"
void fetch(ac_int<32, false> pc, struct FtoDC& ftoDC, ac_int<32, false> instruction) void fetch(const ac_int<32, false> pc, struct FtoDC& ftoDC, const ac_int<32, false> instruction)
{ {
ftoDC.instruction = instruction; ftoDC.instruction = instruction;
ftoDC.pc = pc; ftoDC.pc = pc;
...@@ -26,7 +26,7 @@ void fetch(ac_int<32, false> pc, struct FtoDC& ftoDC, ac_int<32, false> instruct ...@@ -26,7 +26,7 @@ void fetch(ac_int<32, false> pc, struct FtoDC& ftoDC, ac_int<32, false> instruct
ftoDC.we = 1; ftoDC.we = 1;
} }
void decode(struct FtoDC ftoDC, struct DCtoEx& dctoEx, ac_int<32, true> registerFile[32]) void decode(const struct FtoDC ftoDC, struct DCtoEx& dctoEx, const ac_int<32, true> registerFile[32])
{ {
ac_int<32, false> pc = ftoDC.pc; ac_int<32, false> pc = ftoDC.pc;
ac_int<32, false> instruction = ftoDC.instruction; ac_int<32, false> instruction = ftoDC.instruction;
...@@ -202,7 +202,7 @@ void decode(struct FtoDC ftoDC, struct DCtoEx& dctoEx, ac_int<32, true> register ...@@ -202,7 +202,7 @@ void decode(struct FtoDC ftoDC, struct DCtoEx& dctoEx, ac_int<32, true> register
} }
} }
void execute(struct DCtoEx dctoEx, struct ExtoMem& extoMem) void execute(const struct DCtoEx dctoEx, struct ExtoMem& extoMem)
{ {
extoMem.pc = dctoEx.pc; extoMem.pc = dctoEx.pc;
extoMem.opCode = dctoEx.opCode; extoMem.opCode = dctoEx.opCode;
...@@ -400,7 +400,7 @@ void execute(struct DCtoEx dctoEx, struct ExtoMem& extoMem) ...@@ -400,7 +400,7 @@ void execute(struct DCtoEx dctoEx, struct ExtoMem& extoMem)
} }
} }
void memory(struct ExtoMem extoMem, struct MemtoWB& memtoWB) void memory(const struct ExtoMem extoMem, struct MemtoWB& memtoWB)
{ {
memtoWB.we = extoMem.we; memtoWB.we = extoMem.we;
memtoWB.useRd = extoMem.useRd; memtoWB.useRd = extoMem.useRd;
...@@ -430,7 +430,7 @@ void memory(struct ExtoMem extoMem, struct MemtoWB& memtoWB) ...@@ -430,7 +430,7 @@ void memory(struct ExtoMem extoMem, struct MemtoWB& memtoWB)
} }
} }
void writeback(struct MemtoWB memtoWB, struct WBOut& wbOut) void writeback(const struct MemtoWB memtoWB, struct WBOut& wbOut)
{ {
wbOut.we = memtoWB.we; wbOut.we = memtoWB.we;
if ((memtoWB.rd != 0) && (memtoWB.we) && memtoWB.useRd) { if ((memtoWB.rd != 0) && (memtoWB.we) && memtoWB.useRd) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment