Current location - Education and Training Encyclopedia - Graduation thesis - Circulating colored paper
Circulating colored paper
Module? Ledwater (clock, led, s)

Input? clk

Enter [1:0] s;

Output [7: 0] LED;

Reggie? [7:0]? led = 0;

Reggie? [ 1:0]? olds = 0;

Always @ (pose? clk)? olds & lt= s;

Always @ (pose? Clock)

What if? (olds^s)

Case? (s)

2 ' b00:led & lt; = 1; ? //*a

2 ' b 0 1:led & lt; = 1;

2 ' b 10:led & lt; = 8 ' b 10 10 _ 10 10;

2 ' b 1 1:led & lt; = 8 ' b 0000 _ 0 1 1 1;

Close the case

other

Case? (s)

2'b00:? led & lt={led[6:0],led[7]}; //*b

2'b0 1:? led & lt={led[0],? led[7: 1]};

2'b 10:? led & lt= ~ led?

2'b 1 1:? led & lt={led[6:0],led[7]};

Close the case

Terminal module

//The first type: a light is on, moving one by one from right to left, and so on.

//The second type: a light is on, moving from left to right, and so on.

//The third type: each room is lit with a light, which circulates alternately.

//Fourth: Three Lamps District is on, moving one by one from right to left, and so on.

//Of course, there can be more patterns:

//For example, the light lights up gradually from right to left.

//*a is changed to:? led & lt= 1;

//*b Replace with:? led & lt=? (& ampled) 1:? {led[6:0], 1 ' b 1 };