1
0
mirror of https://github.com/olofk/serv.git synced 2026-01-13 15:17:25 +00:00
olofk.serv/rtl/shift_reg.v
Florian Zaruba 27621a285e rtl: Make compatible to Synopsys Design Compiler
Synopysis DC has problems with forward references and initial
statements. Fixed that for better compatibility.
2019-09-26 22:57:40 +02:00

21 lines
428 B
Verilog

module shift_reg
#(parameter LEN = 0,
parameter INIT = 0)
(
input wire clk,
input wire i_rst,
input wire i_en,
input wire i_d,
output wire o_q,
output wire [LEN-2:0] o_par);
reg [LEN-1:0] data;
assign o_q = data[0];
assign o_par = data[LEN-1:1];
always @(posedge clk)
if (i_rst)
data <= INIT;
else if (i_en)
data <= {i_d, data[LEN-1:1]};
endmodule