projects
/
shakti-peripherals.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
typo
[shakti-peripherals.git]
/
src
/
peripherals
/
spi
/
spi.bsv
diff --git
a/src/peripherals/spi/spi.bsv
b/src/peripherals/spi/spi.bsv
index 6c3c13f9a0417d29f9eb2c32fdd8c66e3a9b73d6..56a0965a520d7aef98b182ec2cbee56e7e24846a 100644
(file)
--- a/
src/peripherals/spi/spi.bsv
+++ b/
src/peripherals/spi/spi.bsv
@@
-31,6
+31,9
@@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package spi;
package spi;
+ import AXI4_Lite_Types :: *;
+ import AXI4_Lite_Fabric :: *;
+ import GetPut::*;
import qspi::*;
`include "instance_defines.bsv"
import qspi::*;
`include "instance_defines.bsv"
@@
-38,10
+41,10
@@
package spi;
(*always_ready, always_enabled*)
interface SPI_out;
interface Get#(Bit#(1)) clk_o;
(*always_ready, always_enabled*)
interface SPI_out;
interface Get#(Bit#(1)) clk_o;
- interface Get#(Bit#(1)) io_out;
method Bit#(9) io0_sdio_ctrl;
method Bit#(9) io1_sdio_ctrl;
// index 0 is MOSI, index 1 is MISO.
method Bit#(9) io0_sdio_ctrl;
method Bit#(9) io1_sdio_ctrl;
// index 0 is MOSI, index 1 is MISO.
+ interface Get#(Bit#(2)) io_out;
interface Get#(Bit#(2)) io_out_en;
interface Put#(Bit#(2)) io_in;
interface Get#(Bit#(1)) ncs_o;
interface Get#(Bit#(2)) io_out_en;
interface Put#(Bit#(2)) io_in;
interface Get#(Bit#(1)) ncs_o;
@@
-60,7
+63,7
@@
package spi;
Ifc_qspi qspi <- mkqspi();
Ifc_qspi qspi <- mkqspi();
- interface
SPI_out out;
+ interface
out = interface SPI_out
method Bit#(9) io0_sdio_ctrl;
return qspi.out.io0_sdio_ctrl;
endmethod
method Bit#(9) io0_sdio_ctrl;
return qspi.out.io0_sdio_ctrl;
endmethod
@@
-69,32
+72,42
@@
package spi;
endmethod
interface io_out = interface Get
method ActionValue#(Bit#(2)) get;
endmethod
interface io_out = interface Get
method ActionValue#(Bit#(2)) get;
- return qspi.out.io_out[1:0];
+ let temp2 <- qspi.out.io_out.get;
+ Bit#(2) temp;
+ temp[0] = temp2[0];
+ temp[1] = temp2[1];
+ return temp;
endmethod
endinterface;
interface io_out_en = interface Get
method ActionValue#(Bit#(2)) get;
endmethod
endinterface;
interface io_out_en = interface Get
method ActionValue#(Bit#(2)) get;
- return qspi.out.io_out_en[1:0];
+ let temp2 <- qspi.out.io_out_en.get;
+ Bit#(2) temp;
+ temp[0] = temp2[0];
+ temp[1] = temp2[1];
+ return temp;
endmethod
endinterface;
interface io_in = interface Put
method Action put(Bit#(2) in);
endmethod
endinterface;
interface io_in = interface Put
method Action put(Bit#(2) in);
- Bit(#4) temp = { 0, 0, in[1], in[0] };
- qspi.out.io_in(temp);
+ Bit#(4) temp;
+ temp[3] = 0;
+ temp[2] = 0;
+ temp[1] = in[1];
+ temp[0] = in[0];
+ qspi.out.io_in.put(temp);
endmethod
endinterface;
interface clk_o = qspi.out.clk_o;
endmethod
endinterface;
interface clk_o = qspi.out.clk_o;
- interface io_out = qspi.out.io_out;
- interface io_out_en = qspi.out.io_out_en;
- interface io_in = qspi.out.io_in;
- interface ncs_o = qspi.ncs_o;
- endinterface
+ interface ncs_o = qspi.out.ncs_o;
+ endinterface;
interface slave = qspi.slave;
// 0=TOF, 1=SMF, 2=Threshold, 3=TCF, 4=TEF 5=request_ready
method Bit#(6) interrupts;
interface slave = qspi.slave;
// 0=TOF, 1=SMF, 2=Threshold, 3=TCF, 4=TEF 5=request_ready
method Bit#(6) interrupts;
- return qspi.interr
i
pts;
+ return qspi.interr
u
pts;
endmethod
endmethod
+ endmodule
endpackage
endpackage