并串转换设计源程序.doc

上传人:壹****1 文档编号:543660359 上传时间:2024-01-31 格式:DOC 页数:4 大小:406.50KB
返回 下载 相关 举报
并串转换设计源程序.doc_第1页
第1页 / 共4页
并串转换设计源程序.doc_第2页
第2页 / 共4页
并串转换设计源程序.doc_第3页
第3页 / 共4页
并串转换设计源程序.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《并串转换设计源程序.doc》由会员分享,可在线阅读,更多相关《并串转换设计源程序.doc(4页珍藏版)》请在金锄头文库上搜索。

1、1、 常用经典电路设计S2P输入串行数据流信息:/*/ 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 = 3h00 ; else count = count + 1b1 ; endreg div8_clk ;always (posedge

2、clk or negedge rst_n) begin if (rst_n) div8_clk = 1h0 ; else if (count=3h3) div8_clk = 1b1 ;else if (count=3h7) div8_clk = 1b0 ; end/ assign div8_clk = (count=3h4) | (count=3h5)| (count=3h6)| (count=3h7) ;/ assign div8_clk = (count=3h0) | (count=3h1)| (count=3h2)| (count=3h3) ;/ assign div8_clk = co

3、unt2 ;reg 7:0 shift_data ;always (posedge clk or negedge rst_n) begin if (rst_n) shift_data = 8h00 ; else shift_data = shift_data6:0 , sdata_in ; endalways (posedge clk or negedge rst_n) begin if (rst_n) pdata_out = 8h00 ; else if (count=3h0) pdata_out = shift_data ; endEndmodule2、 常用经典电路设计P2S/*/ de

4、scription / P2S/*/*/ description / P2S/*Module p2s (rst_n, clk, 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 = 3h00 ; else count = count + 1b1 ; endreg div8_clk ;always

5、(posedge clk or negedge rst_n) begin if (rst_n) div8_clk = 1h0 ; else if (count=3h3) div8_clk = 1b1 ;else if (count=3h7) div8_clk = 1b0 ; end/ assign div8_clk = (count=3h4) | (count=3h5)| (count=3h6)| (count=3h7) ;/ assign div8_clk = (count=3h0) | (count=3h1)| (count=3h2)| (count=3h3) ;/ assign div8_clk = count2 ;reg 7:0 shift_data ;always (posedge clk or negedge rst_n) begin if (rst_n) pdata_out = 8h00 ; else if (count=3h0) pdata_out = pdata_in ;else pdata_out = pdata_out 6:0, 1b0 ; endassign sdata_out = shift_data7 ; Endmodule

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号