修改了前辈写的很好的代码
`timescale 1ns/1ns
module width_24to128(
input clk ,
input rst_n ,
input valid_in ,
input [23:0] data_in ,
output reg valid_out ,
output reg [127:0] data_out
);
reg [3:0] cnt;
reg [127:0] data_lock;
always@(posedge clk or negedge rst_n) begin
if(~rst_n)
cnt <= 0;
else
if(cnt<15)begin
cnt <= ~valid_in? cnt:cnt+1;
end
else begin
cnt <= 0;
end
//cnt <= ~valid_in? cnt:cnt+1;
end
always@(posedge clk or negedge rst_n) begin
if(~rst_n)
valid_out <= 0;
else
valid_out <= (cnt==5 || cnt==10 || cnt==15)&&valid_in;
end
always@(posedge clk or negedge rst_n) begin
if(~rst_n)
data_lock <= 0;
else
data_lock <= valid_in? {data_lock[103:0], data_in}: data_lock;
end
always@(posedge clk or negedge rst

最低0.47元/天 解锁文章
895

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



