Last active
October 17, 2018 02:39
-
-
Save koyamalmsteen/b27f55f258e2a67c09d9861ac41cbfa2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SpiIf(clk,cs,shift,ncs,sck,sdi,sdo,q); | |
input clk,cs,shift,sdo; | |
output ncs,sck,sdi; | |
output [9:0] q; | |
reg [9:0] sreg; | |
assign ncs=~cs; | |
assign sdi=1'b1; | |
assign sck=cs & clk; | |
always@(posedge clk) begin | |
if((cs==1'b1) && (shift==1'b1)) | |
sreg={sreg[8:0],sdo}; | |
end | |
assign q=sreg; | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment