experiment one: Forever Running lights
The scan frequency is configured at 100Hz, which means that the scanning period is 10ms. The concept of the scanning cycle should be noted here. Running lights, as the name implies, the scanning period refers to the time required to sweep the running lights. When you hear the cycle, you should think of the need to write the counter module when modeling, this counter module should be God's independent existence, independent operation. Reset every 10ms , reset and start counting again.
experiment two: shining lights and running lights
The flashing light involves the frequency of the sparkle, and the probability that the running light involves scanning frequency. Here we first distinguish the concept of the frequency of the sparkle and the frequency of scanning. The Shining frequency corresponds to the shining cycle, the shining period is the needle for a single led Light, that is, the time of the led Light and the sum of the time to extinguish is called a shining cycle.
About the Write counter module, for a longer period of time, can be used in a hierarchical manner to write, for example:100ms time, the first level we can write a 1ms count module, when this level of counter is full 1ms , you can take this moment as the next level 100ms A conditional statement of a counter that triggers the next level of count.
In the flow lamp module, the final use of bit splicing operation to control the level of rled_out each bit, to achieve The purpose of controlling LED lights. Where the statement:
Rled_out <= {rled_out[1:0],1 ' b0};// Note that there is not a single volume in this area to limit the width of a bit
Each execution of this statement, equivalent to the lowest bit assignment 0, the rled_out[1:0] assigned to rled_out[2:1], that is, the original 0 Place in the present first place, the original section 1 Place in the current section 2 bit, which is equivalent to moving the data to the left.
Summary:
Compare the experiment one with the experiment two running water lamp modeling idea:
Each led lamp as a function module for a separate modeling, through a total counter count, the counter count of the range value as the control LED Light and off the condition control statement.
Experimental one modeling block diagram
Experiment two water lights as a whole module, define the output when defined [2:0]led_out; that is, how many LEDs , the number of digits defined, By writing the State Shift control program , the LED lights are illuminated and extinguished to achieve the effect of running lights.
Experimental two-model block diagram
Verilog HDL Those things _ Modeling notes (experiment One, experiment two)