Shift Register Verilog Code
27.08.2019 admin
I am learning and practicing Verilog HDL. I wanted to design a 16 bit parallel in series out shift register.
I wrote this code and tried to simulate it.
For a VHDL shift register, see our corresponding shift register article with example code and VHDL specific tips. Shift Register Concepts A shift register is a series of connected registers (flip-flops) that are sequentially connected together so that a value at the input is passed from one register to the next on each clock cycle. Aug 12, 2012 Variable shift register in verilog. Ask Question 1. Tanx dwikle, I like the first code. I have at least 9 inputs, and 9 Ns. It means a crowded code. But seems there is no other choice – Alex Aug 13 '12 at 17:53. Add a comment 4. Verilog has a right shift operator so you can simply write.
simulation_resultI could not understand the reason why data output (dout) signal is always LOW
Adhamzhon Shukurov
Adhamzhon ShukurovAdhamzhon Shukurov
1 Answer
It works for me.
BUT!
That code can no be turned into gates.You must use 'posedge clk' or 'negedge clk'. Also your load is a-synchronous which is very unusual and cangive race conditions against the clock edge.
Verilog Shift Operator
Furthermore it is usual to have a reset condition. As long as there is no 'load' signal the dout will produce X-es. This can very much upset the rest of your circuit. Also you have an extra clock delay in dout. You could, if you want, save a clock cycle there. Here its is with an a-synchronous active low reset:
Universal Shift Register Verilog Code Pdf
OldfartOldfart3,6542 gold badges8 silver badges12 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.