1 // date :2013/6/11 2 //designer :pengxiaoen 3 //function :parallel to serial 4 5 module parallel_to_serial ( 6 clk_ps,reset_ps, 7 parallel_in, 8 status_ps, // 1: read 0:out 9 serial_out); 10 input clk_ps,reset_ps; 11 input [7:0] parallel_in; 12 input status_ps; 13 output serial_out; 14 15 reg [7:0] parallel_reg; 16 17 always @ (posedge clk_ps or negedge reset_ps) 18 if(!reset_ps) 19 parallel_reg <= 8'd0; 20 else if (status_ps) 21 parallel_reg <= parallel_in; 22 else parallel_reg <= {parallel_reg,1'b0}; 23 24 assign serial_out = parallel_reg[7]; 25 26 endmodule