转换器(附Verilog实现)"/>
数字IC笔面基础——串并转换器(附Verilog实现)
数字IC笔面基础——串并转换器(附Verilog实现)
- 写在前面的话
- 串行转并行
- LSB优先
- MSB优先
- 并行转串行
- LSB优先
- MSB优先
- 总结
写在前面的话
串并转换是完成串行传输和并行传输这两种传输方式之间转换的技术。通过移位寄存器可以实现串并转换。串转并时,将数据移位保存到寄存器中,再将寄存器中的数值同时输出;并转串时,将数据先移位,再将寄存器中最高位或最低位的数值串行输出。
关键点:
(1)串并转换的关键是在于触发器链,通过依次移位,输出最终结果。
(2)串并转换的思想是在设计中平衡面积和速度的要求,并行速度快,串行面积小。
(3)串并转换常常在接口中出现,将高速并行转为串行数据输出,或将低速的串行数据转为并行数据后高速计算。
串行转并行
LSB优先
// -----------------------------------------------------------------------------
// Copyright (c) 2014-2022 All rights reserved
// -----------------------------------------------------------------------------
// Author : HFUT904 1320343336@qq
// File : SIPO1_LSB.v
// Create : 2022-11-04 14:41:50
// Revise : 2022-11-04 14:41:50
// Editor : HFUT Integrated Circuit Design & Research Center
// Verdion: V1.0
// Description: 8bit 串行转并行 LSB优先 移位寄存器
// -----------------------------------------------------------------------------
module SIPO1_LSB (input clk , // Clockinput rst_n , // Asynchronous reset active lowinput din , // Serial inputoutput reg [7:0] dout // Parallel output
);//LSB first
always @(posedge clk or negedge rst_n) begin : proc_if(~rst_n) begindout <= 8'b0 ;end else begindout <= {dout[6:0],din};end
endendmodule
MSB优先
// -----------------------------------------------------------------------------
// Copyright (c) 2014-2022 All rights reserved
// -----------------------------------------------------------------------------
// Author : HFUT904 1320343336@qq
// File : SIPO1_MSB.v
// Create : 2022-11-04 14:51:19
// Revise : 2022-11-04 14:51:19
// Editor : HFUT Integrated Circuit Design & Research Center
// Verdion: v1.0
// Description: 8bit 串行输入 并行输出 MSB优先 移位寄存器
// -----------------------------------------------------------------------------
module SIPO1_MSB (input clk , // Clockinput rst_n , // Asynchronous reset active lowinput din , // Serial inputoutput reg [7:0] dout // Parallel output
); //MSB first
always @(posedge clk or negedge rst_n) begin if(~rst_n) begindout <= 8'b0 ;end else begindout <= {din,dout[7:1]};end
endendmodule
并行转串行
LSB优先
// -----------------------------------------------------------------------------
// Copyright (c) 2014-2022 All rights reserved
// -----------------------------------------------------------------------------
// Author : HFUT904 1320343336@qq
// File : PISO1_LSB.v
// Create : 2022-11-04 15:10:23
// Revise : 2022-11-04 15:10:23
// Editor : HFUT Integrated Circuit Design & Research Center
// Verdion: v1.0
// Description: 8bit并行输入串行输出 LSB优先 移位寄存器
// -----------------------------------------------------------------------------
module PISO1_LSB (input clk , // Clockinput rst_n , // Asynchronous reset active lowinput [7:0] din , // Parallel inputoutput wire dout // Serial output
);reg [7:0] din_t ;//LSB first
always @(posedge clk or negedge rst_n) begin if(~rst_n) begindin_t <= 8'b0;end else begindin_t <= din >> 1 ;end
endassign dout = din_t[0] ;endmodule
MSB优先
// -----------------------------------------------------------------------------
// Copyright (c) 2014-2022 All rights reserved
// -----------------------------------------------------------------------------
// Author : HFUT904 1320343336@qq
// File : PISO1_MSB.v
// Create : 2022-11-04 15:21:32
// Revise : 2022-11-04 15:21:32
// Editor : HFUT Integrated Circuit Design & Research Center
// Verdion: v1.0
// Description: 8bit并行输入串行输出 MSB优先 移位寄存器
// -----------------------------------------------------------------------------
module PISO1_MSB (input clk , // Clockinput rst_n , // Asynchronous reset active lowinput [7:0] din , // Parallel inputoutput dout // Serial output
);reg [7:0] din_t ;
//MSB firstalways @(posedge clk or negedge rst_n) beginif(~rst_n) begindin_t <= 8'b0 ;end else begindin_t <= din << 1 ;end
endassign dout = din_t[7];endmodule
总结
串并转换的Coding style 除了移位寄存器,还有一种利用计数器的结构,感兴趣的同学可以去看这篇博客链接(来自Fighting_XH
:) link
串并转换的思想在通信接口协议中有所体现,常见的就是UART,本质上串并转换的作用是在设计面积和速度之间取一个平衡点,最大程度提高系统的性能。
补充的话:
最近开始更的几篇帖子都是基础知识点,主要作用是学习笔面中常考的基础知识点,相较于这些知识点,最关键的还是自己在项目中切身学习的内容,是自己解决bug的过程。数字IC设计入门是个相对简单的工作,但随着学习的深入,自己越发体会到数字IC内容的庞大。视频处理、高速接口、计算机架构、MCU、通信协议、神经网络加速器等等,每个方向都有很多知识点,除了在基础知识点上下功夫,关键的还是找好一到两个实践项目。对于准备跨行的同学,这点尤其重要,目前我认为比较好的项目有这几类:
(1)视频图像处理,像是h264/h265编解码等;
(2)高速接口 如SATA PCIE;
(3)计算机总线 AXI AMBA相关的;
(4)简单的CPU, RISC-V或者MCU等,可以看看车载MCU相关的,最近也是比较火;
(5)神经网络加速器,NPU 如CNN、SNN等;
简历上的可以列举一大一小两个项目,有条件的就按照自己课题组相关方向来找,可以尝试参加比赛,要是材料老哥,单枪匹马的可以学习开源的项目。最关键的是自己真的肯花时间去做,去实践,数字笔试是比较好过的,关键就是在于面试环节,一定要有多少说多少,语气肯定,不知道的内容大可以直接讲不会。数字IC内容很多,作为学生,能掌握最基础的知识,再加上有实践经验,就能达到公司的招聘要求,不用把自己包装成“大牛”那种,明明不会还要东扯西扯的。
更多推荐
数字IC笔面基础——串并转换器(附Verilog实现)
发布评论