From cbd0b2f7f560b472ebcabcf5f9e3ca4d5f424178 Mon Sep 17 00:00:00 2001 From: Jonathan Woodruff Date: Tue, 31 Mar 2020 15:41:19 +0100 Subject: [PATCH] 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. --- CHERICC_Fat.bsv | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHERICC_Fat.bsv b/CHERICC_Fat.bsv index d150ab4..055b309 100644 --- a/CHERICC_Fat.bsv +++ b/CHERICC_Fat.bsv @@ -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