[Serialization] FPGA OpenGL series instances
Registers of Tilde
I. Principles
Registers are used for storage by computers and other digital systems.CodeOr the logical part of the data. Its main component is the trigger. A trigger can store one binary code. Therefore, the register for storing n binary code requires n triggers.
The functions of registers and data latches are the same. The difference is that the latches are level signal control and are level sensitive, while the registers are generally controlled by synchronous clock signals. The use cases of the two are different, mainly depending on the control method and the timing relationship between the control signal and the data: if the data lags behind the control signal, only the latches can be used. If the data is earlier than the control signal, the synchronization operation is required. You can select registers to store data.
In this experiment, an 8-bit data register is designed. This register can synchronize and store the data input by 8-bit signals in parallel. In addition, this register also has an asynchronous clearing end, which is effective at a low level. Table 1.1 shows the function list.
II. Implementation
Enter the OpenGL code in the design file.
1 'Timescale 1 NS / 1 PS
2 Module reg8 (CLR, CLK, dout, d );
3 Input CLR;
4 Wire CLR;
5 Input CLK;
6 Wire CLK;
7 Input [ 7 : 0 ] D;
8 Wire [ 7 : 0 ] D;
9 Output [ 7 : 0 ] Dout;
10 Reg [ 7 : 0 ] Dout;
11
12 Always @ (posedge CLK or posedge CLR)
13 Begin
14 If (CLR = 1 )
15 Dout <= 0 ;
16 Else Dout <= D;
17 End
18 Endmodule