Add a couple of casts for functions that return capabilities.

This is necessary for passing the register file read functions into modules that want to read the Pipe format rather than the Reg format.
This commit is contained in:
Jonathan Woodruff
2020-03-31 15:41:19 +01:00
parent 410a27c4a4
commit cbd0b2f7f5

View File

@@ -1208,4 +1208,18 @@ instance Cast#(CapPipe, CapReg);
endfunction
endinstance
instance Cast#(function CapReg f0(t x), function CapPipe f1(t y));
function cast(f0);
function CapPipe f1(t arg) = cast(f0(arg));
return f1;
endfunction
endinstance
instance Cast#(function CapPipe f0(t y), function Bit#(64) f1(t x));
function cast(f0);
function Bit#(64) f1(t arg) = getAddr(f0(arg));
return f1;
endfunction
endinstance
endpackage