//module shift(clk,out,in,res,en,x_out);
// input clk;//时钟信号端口
// input res;//高电平复位信号端口
// input en;
// input [7:0]in;//8个比特位输入信号端口
// output reg[7:0]out;//8个比特位输出信号端口
// output wire[7:0]x_out;//循环移位输出信号端口
//
//// assign out = in;
// reg [7:0]x_temp;//用于循环移位赋值
//
// always @(posedge clk)begin
// if(res)begin//高电平复位
// out<=8'b0;
// end
// //移位和赋值
// else if(en) begin
//// out<=in;//单一赋值
//
// //右移位是把低位拿走。
//// out<={in[0],in[7:1]};//右移一位
//
// //左移位是把高位拿走。
// out<={in[6:0],in[7]};//左移一位
// x_temp<=in;
// end
// //循环移位
// else begin
//// x_temp<={x_temp[0],x_temp[7:1]};//右循环移位
// x_temp<={x_temp[6:0],x_temp[7]};//左循环移位
// end
// end
//
// assign x_out=x_temp;
//endmodule
//00000000000000000000000000000000000000000000000000000000000000
//串口,并口之间转换
//00000000000000000000000000000000000000000000000000000000000000
module Serial_parallel(clk,re,in,in_s,o_q,sp_en,o_p_q);
input clk;//时钟信号端口
input in;//串口输入信号端口
input [7:0]in_s;//并口输入信号端口
input sp_en;//高电平串口转并口,低电平并口转串口
input re;//高电平复位信号端口
output reg[7:0]o_q;//并口输出信号端口
output reg o_p_q;//串口输出信号端口
reg [7:0]x_temp;
integer i;
&nbs

本文介绍了一种串行到并行及并行到串行的数据转换模块设计,使用Verilog HDL实现。该模块能够根据控制信号进行串并转换,并通过仿真验证其正确性。
最低0.47元/天 解锁文章
5103

被折叠的 条评论
为什么被折叠?



