并串转换设计源程序.docxVIP

  • 3
  • 0
  • 约2.67千字
  • 约 5页
  • 2021-03-01 发布于天津
  • 举报
输入串行数据流信息: 提取的时钟信息 串行通信数据流 (stream) 获取的数据值 4 t i 4 I* ■ I: a n u 4 I i IE ■I I ■ i| t: ■i ■■ ■ i v \o Current Document v f v * r 0101011011001101 LSB MSB 输入时钟elk 输岀8分频时钟 S2P 串行数据流(stream) 平行数据流( div8_clk stream) 输输输输 输输输输输输 输stream输 1 1 i 1 ? t ? I 1 1 1 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 1 X Valid Valid= XX H / X d7 d7 / z d7 d6 d6 / d7 d6 d5 d5 / d7 d6 d5 d4 d4 / d7 d6 d5 d4 d3 d3 / r d7 d6 d5 d4 d3 d2 d2 / d7 d6 d5 d4 d3 d2 d1 d1 d7 d6 d5 d4 d3 d2 d1 d0 d0 // description // S2P //************************ //* *********************** Module s2p (rst_n, clk, sdata_in, pdata_out ) ; Input rst_n, clk ; Input sdata_in ; Output reg [7:0] pdata_out ; reg [2:0] count ; always @(posedge clk or negedge rst_n) begin if (~rst_n) count = 3 h00 ; else count = count + 1 b1 ; end reg div8_clk ; always @(posedge clk or negedge rst_n) begin if (~rst_n) div8 clk = 1 h0 else if (count==3 h3) div8_ clk = 1 b1 else if (count==3 h7) div8_ clk = 1 b0 end // assign// assign // assign // assign // assign div8_clk div8_clk div8_clk = (count==3 h4) | (count==3 h5)| (count==3 h6)| (count==3 h7) ; = ~(count==3 h0) | (count==3 h1)| (count==3 h2)| (count==3 h3) ; = count[2] ; always @(posedge clk begin if (~rst_n) else end always @(posedge clk begin if (~rst_n) else end reg [7:0] shift_data ; or negedge rst_n) shift_data = 8 h00 ; shift_data = { shift_data[6:0] , sdata_in } ; always @(posedge clk or negedge rst_n) begin if (~rst_n) pdata_out = 8 h00 ; else if (count==3 h0) pdata_out = shift_data ; end Endmodule 〃************************ // description // P2S II************************输输8 II* *********************** 输输8输输输输 I R 输入时钟 jiMiwmnnhnnmwi I I II************************ II description II P2S Module Module p2s (rst_ n, elk, div8_clk. pdata_ in, sdata_out ); Input rst_n, clk, div8_clk ; Input [7:0] pdata_in ; Output sdata_out ; reg [2:0] count ; always @(posedge clk or negedge rst_n) begin if (~rst_n) count = 3 h00 ; else count = count + 1 b1 ; end reg div8_clk ; always @(posedge clk or ne

文档评论(0)

1亿VIP精品文档

相关文档