0% found this document useful (0 votes)
17 views9 pages

Vlsi Lab

The document is a lab report from the University of Technology, Ho Chi Minh City, detailing the design and implementation of a Ring Flasher system using RTL code. It includes specifications for the system's operation, which involves controlling 16 LEDs in a sequence based on input signals for reset and clock. The report also outlines the internal implementation and state machine used to manage the LED transitions in both clockwise and anti-clockwise directions.

Uploaded by

Ânn Nguyễn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views9 pages

Vlsi Lab

The document is a lab report from the University of Technology, Ho Chi Minh City, detailing the design and implementation of a Ring Flasher system using RTL code. It includes specifications for the system's operation, which involves controlling 16 LEDs in a sequence based on input signals for reset and clock. The report also outlines the internal implementation and state machine used to manage the LED transitions in both clockwise and anti-clockwise directions.

Uploaded by

Ânn Nguyễn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

VIETNAM NATIONAL UNIVERSITY, HO CHI MINH CITY

UNIVERSITY OF TECHNOLOGY
FACULTY OF COMPUTER SCIENCE AND ENGINEERING

LSI Logic Design Lab - CO3098 - CC01


Lab’s Report
Design and Implement Ring Flasher

Advisor: Tôn Huỳnh Long


Students: Lê Ngọc An – 2252007
Vũ Trịnh Thanh Bình – 2252085
Trương Phú Cường – 2252100
Nguyễn Ngọc Duy – 2252118
Nguyễn Thiên Phúc – 2252645

HO CHI MINH CITY, December 2024


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Contents
1 RTL Code 2
1.1 Waveform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Design Specification 3
2.1 Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Functional Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3 Internal implementation 7
3.1 Overall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 State Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Assignment for Operating System - Academic year 2023 - 2024 Page 1/8
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

1 RTL Code
1 module ring_flasher (
2 input clk ,
3 input reset ,
4 input status ,
5 output reg [0:15] led
6 );
7
8 reg [31:0] count ;
9 reg [3:0] mode ;
10 reg [3:0] clockwise ;
11 reg [3:0] anti_clockwise ;
12 reg [3:0] point ;
13 reg active ;
14
15 initial begin
16 count = 0;
17 mode = 0;
18 clockwise = 0;
19 anti_clockwise = 0;
20 point = 0;
21 led = 16 ’ b0 ;
22 active = 0;
23 end
24
25 always @ ( posedge clk or posedge reset ) begin
26 if ( reset ) begin
27 count <= 0;
28 led <= 16 ’ b0 ;
29 clockwise <= 0;
30 anti_clockwise <= 0;
31 mode <= 0;
32 point <= 0;
33 end
34 else begin
35 if ( status ) active <= 1;
36
37 if ( active == 1) begin
38 if ( mode ==1) begin
39 led [ point ] <= ~ led [ point ];
40 anti_clockwise <= anti_clockwise + 1;
41 if ( anti_clockwise == 3) begin
42 anti_clockwise <= 0;
43 count <= count +1;
44 mode <= 0;
45 if ( count == 7) begin
46 active <= 0;
47 count <=0;
48 end
49 end
50 else point <= point - 1;
51 end
52 else if ( mode ==0) begin
53 led [ point ] <= ~ led [ point ];
54 clockwise <= clockwise + 1;
55 if ( point == 15) if ( clockwise != 7) if ( count != 7) point <=
0;
56 if ( clockwise == 7) begin
57 clockwise <= 0;
58 mode <= 1;
59 end

Assignment for Operating System - Academic year 2023 - 2024 Page 2/8
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 1: Testbench waveform on Cadence tool

60 else point <= point + 1;


61 end
62
63 end
64 end
65 endmodule
Listing 1: Ring Flasher

1.1 Waveform

2 Design Specification
2.1 Interface

Figure 2: Figure of Ring Flasher

Signal Width In/Out Description


clk 1 In The clk (clock) is used to synchronize the entire
system, controlling state transitions and updat-
ing the LED state at each clock cycle.
reset 1 In The reset is used to return the system to the
initial state.
status 1 In The status is to trigger the program to start init.
led 16 Out The led is used to make a list containing 16
LEDs for the system.

Table 1: Description of signals in Ring Flasher

Assignment for Operating System - Academic year 2023 - 2024 Page 3/8
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

2.2 Functional Implementation


– Implement a Ring Flasher System with 16-bits LEDs.
– System’s Operation base on two input signal:

• Reset

• Clock

- At the initial state, all LEDs are OFF. If the active-HIGH repeat signal is ACTIVE, the flasher
will start operating:
(1) Starting from led[0], the lights will turn ON one-by-one clockwise at set intervals.

(2) After 8 counts (i.e. when led[7] lights up), the LED will start to turn OFF one-by-one in the
anti-clockwise direction.

Assignment for Operating System - Academic year 2023 - 2024 Page 4/8
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

(3) After 4 LEDs are turned OFF in sequence (i.e. when led[4] has turned down), the LED ring
will again start to turn ON one-by-one in the clockwise direction 8 times.

(4) After that, 4 LEDs will gradually turn OFF in the opposite direction, then 8 LEDs will turn
ON in the original direction, then 4 LEDs will gradually turn OFF in the opposite direction, so on
and so forth.
- After moving clockwise and anti-clockwise in the same pattern 3 times each, the next step of
moving clockwise 8 LEDs will go over LEDs that are already ON. In the case the LED is already
ON, it is instead toggled OFF.

Assignment for Operating System - Academic year 2023 - 2024 Page 5/8
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

(5) Likewise, the anticlockwise step will turn the LEDs on one by one.

(6) Eventually, all LEDs will be turned OFF at the end of an anti-clockwise step. At this point,
the flasher will return to the initial idle state unless the repeat signal is already ACTIVE.

Assignment for Operating System - Academic year 2023 - 2024 Page 6/8
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

3 Internal implementation
3.1 Overall
3.2 State Machine

Figure 3: FSM of Ring Flasher

Variables Width Datatypes Description


active 4 reg The active is to activate the program to start or
restart transit.
count 8 reg The count is used to update how many time that
the program implement the anti-clockwise tran-
sition. If the count is equal to 7, the state come
back to the initial one.
mode 4 reg The mode is to represent either the mode clock-
wise or anti-clockwise.
clockwise 4 reg The clockwise is used to update the position
of led in clockwise transition mode. If clock-
wise==7 then change to anti-clockwise mode.
anti_clockwise 4 reg The anti_clockwise is used to update the po-
sition of led in anti-clockwise transition mode.
If anti_clockwise==3 then change to anti-
clockwise mode.
point 4 reg The point is to represent the position of current
led.

Table 2: variable name of State machine

Assignment for Operating System - Academic year 2023 - 2024 Page 7/8
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

State Description
INIT The state initializes the finite state machine.
Clockwise 8 LEDs The state updates the state of each of 8 LEDs after a clock cycle in
a clockwise transition. If it reaches the final LED, it changes to the
Anti-clockwise state.
Anti-clockwise 4 LEDs The state updates the state of each of 4 LEDs after a clock cycle in an
anti-clockwise transition. If it reaches the final LED, it changes to the
Clockwise state.

Table 3: State names of the State Machine

Assignment for Operating System - Academic year 2023 - 2024 Page 8/8

You might also like