Register, the circuit principle of the shift register and the Verilog code implementation

Source: Internet
Author: User

Register: A circuit for storing binary code, a 4-bit digital register consisting of a Wirtgen block D trigger:

Logic function Analysis:

1. Asynchronous side CR 0 o'clock, output 0;

2. Synchronous parallel Position: D0~D3 is 4 input code, when the CP Rising Edge arrives, D0~d3 is simultaneously placed in parallel.

3. At the end of the 1,CP, the end is 0 o'clock and remains unchanged.

2. Shift register: A circuit that holds digital and makes the digital shift right or left is called a shift register.

Shift registers can be divided into different types according to different classification methods. If classification according to shift direction of shift register, it can be divided into left shift shift register, shift register and bidirectional shift register, etc., if classified according to the mode of operation, it can be divided into serial/serial shift register, serial in/out shift register and merge/String out shift register, etc.

The following is an asynchronous zeroing 4-bit merge sequence shift register (input as parallel data, output as serial data)

ModuleREG_BC (clk,clr,din,dout);inputCLK,CLR;//input clock End, clear 0 end (active high)input[3:0] DIN;//Data-EntryOutputDout//Data Output EndReg[1:0] CNT; Reg[3:0] Q;Regdout; always@(PosedgeClk//clock rising edge triggerbeginCNT<=cnt+1;//CNT Self-add 1if(CLR)//determine if clear 0 signal is validbeginQ<=4'b0000;//q 0EndElsebeginif(cnt>0)//determine if CNT is greater than 0beginq[3:1]<=q[2:0];//the value in Q moves 1 bits to the leftEndElse if(cnt==2'b00)//Determine if CNT is 0beginQ<=din;//Give the value of DIN to QEnddout<=q[3];//put the highest bit of Q outEndEnd

Register, the circuit principle of the shift register and the Verilog code implementation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.