Guest User

Untitled

a guest
Jun 24th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. `timescale 1ns / 1ps
  2. module Read_8SIPO(Ser_I, Clk_I, Clk_O, SH_LD, Parl_O);
  3. input Clk_I, Ser_I;
  4. output Clk_O, SH_LD;
  5. output [7:0] Parl_O;
  6. reg [7:0] Clk_Count; // Maximum 256 Input_Clockreg [7:0] tmp;
  7. parameter nBit = 8; // Using (nBit+4) Input_Clock
  8. reg [nBit-1:0] R_Parl_O, temp_Parl_O;
  9. reg R_ShiftLoad;
  10. always @(posedge Clk_I) begin
  11. Clk_Count <= Clk_Count + 1;
  12. if( Clk_Count > (nBit+4)) begin // Over Reset Counter
  13. Clk_Count <= 0;
  14. R_ShiftLoad <= 0;
  15. end
  16. if(Clk_Count==0) R_ShiftLoad <= 0; // Load
  17. if(Clk_Count==1) R_ShiftLoad <= 1; // no Load
  18. if((Clk_Count>=2)&&(Clk_Count<=(nBit+1))) begin // Shift
  19. temp_Parl_O <= temp_Parl_O << 1;
  20. temp_Parl_O[0] <= Ser_I;
  21. end
  22. if(Clk_Count==(nBit+2)) R_Parl_O <= temp_Parl_O; // Save
  23. end
  24. assign Parl_O = R_Parl_O;
  25. assign Clk_O = Clk_I;
  26. assign SH_LD = R_ShiftLoad;
  27. endmodule
Add Comment
Please, Sign In to add comment