14
Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Embed Size (px)

Citation preview

Page 1: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Project 4 A Simple Taximeter Design

Yuqi Wang & Suhuai Song

Page 2: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Introduction• This taximeter should be able to calculate the

“Fare” and “EXTRA” and then sum them to find out the total cost at the end.

• There are three modes:• Sleep mode• Mile charge mode• Time charge mode

Page 3: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Requirements• INPUTS:

• CLK: makes the code start working• VACANT: when this button on, the meter is off and all the

display will be off.• HIRED: when this button on, the meter is working.• TIME: when time is on, the time charge will be start.• SET_RATE+: set the rate higher manually.• SET_RATE-: set the rate lower manually.• TOTAL: when the button is on, allows the meter to

calculate the total fees the customer has to pay. Then assign the total fees value into “FARE” and at the same time “EXTRA” return to zero.

Page 4: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Requirements• OUTPUTS (7 Segment Display Number):

• RATE(7 bits): the fee of per miles. The default value is $3.

• FARE_2, FARE_1, FARE_0, FARE_d, FARE_dd (7 bits): the value of total miles fee. When the “TOTAL” button is on, the “FARE” should be showing total fee the customer should pay.

• EXTRA_2, EXTRA_d, EXTRA_dd: the value of total times charge. The default value is $1 per minutes.

Page 5: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Code Structure• Module Taximeter(input, output);• Input;• Output;• Always (posedge CLK) begin

• If (HIRED && ~VACANT) begin• If (miles <= 20 && SET_RATE+ == 0 && SET_RATE- == 0) begin // Condition 1• ….• End• If (miles > 20 && SET_RATE+ == 0 && SET_RATE- == 0) begin // Condition 2• ….• End• If (SET_RATE+ == 1 && SET_RATE- == 0) begin // Condition 3• ….• End• If (SET_RATE+ == 0 && SET_RATE- == 1) begin // Condition 4• ….• End• End

• If (~HIRED && VACANT) begin• …• End

• End

Page 6: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Code Structure• In each condition:

• If (TOTAL == 0) begin• // calculate the fare of total miles fee• End• If (TIME == 1) begin• // calculate the extra of total times fee• End • If (TOTAL == 1) begin• // calculate the fare of sum of the miles fee and times

fee and reset the all the extra value to 0.• End

Page 7: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Code Stucture• 7 Segment Decoder

• case(RATE)   4'b0000: rate = 7'b1111110;     4'b0001: rate = 7'b0110000;    4'b0010: rate = 7'b1101101;   4'b0011: rate = 7'b1111001;   4'b0100: rate = 7'b0110011;   4'b0101: rate = 7'b1011011;   4'b0110: rate = 7'b1011111;   4'b0111: rate = 7'b1110000;   4'b1000: rate = 7'b1111111;    4'b1001: rate = 7'b1111011; endcase

Page 8: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Simulation Results• HIRE = 0, VACANT = 1

Page 9: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Simulation Results• HIRED = 1, VACANT = 0, TIME = 1, SET_RATE+ =

0, SET_RATE- = 0, TOTAL = 0, miles = 15, times = 8

Page 10: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Simulation Results • HIRED = 1, VACANT = 0, TIME = 1, SET_RATE+ =

0, SET_RATE- = 0, TOTAL = 1, miles = 50, times = 8

Page 11: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Simulation Results• HIRED = 1, VACANT = 0, TIME = 1, SET_RATE+ =

1, SET_RATE- = 0, TOTAL = 1, miles = 50, times = 8

Page 12: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Simulation Result• HIRED = 1, VACANT = 0, TIME = 1, SET_RATE+ =

0, SET_RATE- = 1, TOTAL = 0, miles = 30, times = 5

Page 13: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Layout

Page 14: Project 4 A Simple Taximeter Design Yuqi Wang & Suhuai Song

Questions?