参数化长度的 Verilog 移位寄存器
Verilog shift register of parameterized length
我是 Verilog 代码的新手。我必须用移位寄存器在 verilog 代码中做一个问题。我在问之前搜索过,但没有找到类似的东西。有人可以帮我提供一些有关在 Verilog 中为此寄存器创建代码的提示吗?
谢谢!祝你有美好的一天!
也许这会让你继续:
module DW03_shft_reg #(
// the parameterisable length of the shift register needs to be a parameter
parameter LENGTH = 1
)(
input [LENGTH-1:0] p_in,
input s_in, load_n, shift_n, clk,
// this needs to be a 'reg' so that it can be assigned to by the 'always' block
output reg [LENGTH-1:0] p_out
);
// the template for sequential code with no asynchronous reset
always @(posedge clk)
begin
// implement the behaviour from the truth table here
// the { , } (concatenation) operator is useful for shift registers
end
endmodule
我是 Verilog 代码的新手。我必须用移位寄存器在 verilog 代码中做一个问题。我在问之前搜索过,但没有找到类似的东西。有人可以帮我提供一些有关在 Verilog 中为此寄存器创建代码的提示吗?
谢谢!祝你有美好的一天!
也许这会让你继续:
module DW03_shft_reg #(
// the parameterisable length of the shift register needs to be a parameter
parameter LENGTH = 1
)(
input [LENGTH-1:0] p_in,
input s_in, load_n, shift_n, clk,
// this needs to be a 'reg' so that it can be assigned to by the 'always' block
output reg [LENGTH-1:0] p_out
);
// the template for sequential code with no asynchronous reset
always @(posedge clk)
begin
// implement the behaviour from the truth table here
// the { , } (concatenation) operator is useful for shift registers
end
endmodule