Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

There are two teams: Home ( H ) , and Away ( A ) . Reset switch can be used to start the game. The

There are two teams: Home (H), and Away (A). Reset switch can be used to start the game. The current score for each team will be shown on two display segments starting with 00. Each team will be given 5 seconds in order to try scoring points. A countdown will appear on display segment 4 starting from 5 reaching to 0. The two teams cant play simultaneously. H plays first then A gets the turn then H again. When it is team H turn, LEDR1 will be on and LEDR2 will be off. On the other hand, when it is team A turn, LEDR2 will be on and LEDRR1 will be off. In each attempt, the team may score 0,1,2, or 3 points. The attempt score will be inserted by turning on one of the score switches for that team. For example, team H inserted score can be 0,1,2, or 3 by turning on sw1, sw2, sw3, or sw4, respectively. In the same way, team A points can be inserted during it attempt through switches sw5, sw6, sw8, or sw9. Each attempts scored points will be added to the teams total score. Team H score will be shown using displays 0 and 1 while team A score will be shown using displays 2 and 3. If the countdown ends before inserting a score, the turn will simply move to the other team. Please note that turning on a score switch for a team outside its attempt time wont be counted and its score will not be changed. In this project you can consider that the maximum score any team can reach is 15. During the game, LEDG1 will be 1 if team H is winning while LEDG2 will be on if team A is winning. If the result is a tie, both LEDS go off. We assume that the user may switch on one score switch only during each attempt. You may need to use the clock from experiment 8 in order to calculate the required delays. Example: The user turns on the reset switch and both teams start with 00 score with both LEDG1 and LEDG2 are off. The first attempt is given to team H and the countdown display will count from 5 to 0 while LEDR1 is on. During the countdown sw3 will be turned on and two points will be added to the team H score to be 02. Moreover, LEDG1 will be on as team H is winning. Next, the turn goes to team A and hence the countdown display starts counting again from 5 to 0 with LEDR1 goes off and LEDR2 goes on. A3 sw9 is turned on before the countdown ends. As a result, three points will be added to team A score to become 03. LEGR2 will be on and LEDG1 will be off as team A is winning. The attempt is now returns to team H. However, the countdown reaches 0 while no score switch is turned on. As a result, the score will not change and the attempt goes back to team A. Modify the code based on this explanationmodule segdriver(A,B,C,D,a,b,c,d,e,f,g);input A,B,C,D;output a,b,c,d,e,f,g;assign a=(~B&~C&D)|(B&~C&~D);assign b=(B&~C&D)|(B&C&~D);assign c=(~B&C&~D);assign d=(~B&~C&D)|(B&~C&~D)|(B&C&D);assign e=D|(B&~C);assign f=(~B&D)|(~B&C)|(C&D);assign g=~A&~B&~C;endmodulemodule counter (input clock, output reg[31:0] counter_out);always @ (posedge clock)begincounter_out <= #1 counter_out +1;endendmodule module dff1(D,Reset,clk,Q,Qnot);input D,clk,Reset;output Q,Qnot;reg Q,Qnot;always @ (posedge Reset, posedge clk)beginif (Reset)beginQ <=0;Qnot <=1; endelsebeginQ <= D;Qnot <= ~D;endendendmodulemodule dmux1to2(o0,o1,s,in);output o0,o1;input s,in;//Invgate (out,in1);Invgate (w1,s);//Andgate2(out,in1,in2);Andgate2(o0,w1,in);Andgate2(o1,s,in);endmodulemodule dumux1to5(d,s0,s1,s2,o0,o1,o2,o3,o4,o5,o6,o7);input d,s0,s1,s2;output o0,o1,o2,o3,o4,o5,o6,o7;//dmux1to2(o0,o1,s,in); dmux1to2(w0,w1,s2,d); dmux1to2(w2,w3,s1,w0); dmux1to2(w4,w5,s1,w1);dmux1to2(o0,o1,s0,w2); dmux1to2(o2,o3,s0,w3);dmux1to2(o4,o5,s0,w4);dmux1to2(o6,o7,s0,w5);endmodulemodule Andgate2(out,in1,in2);input in1,in2;output out;assign #1 out=(in1&in2);endmodulemodule Andgate3(out,in1,in2,in3);input in1,in2,in3;output out;assign #1 out=(in1&in2&in3);endmodulemodule Nandgate3(out,in1,in2,in3);input in1,in2,in3;output out;assign #1 out=~(in1&in2&in3);endmodulemodule Andgate4(out,in1,in2,in3,in4);input in1,in2,in3,in4;output out;assign #1 out=(in1&in2&in3&in4);endmodulemodule Invgate (out,in1);input in1;output out;assign #1 out=~(in1);endmodulemodule Orgate3(out,in1,in2,in3);input in1,in2,in3;output out;assign #1 out=(in1|in2|in3);endmodulemodule Orgate4(out,in1,in2,in3,in4);input in1,in2,in3,in4;output out;assign #1 out=(in1|in2|in3|in4);endmodulemodule Orgate2(out,in1,in2);input in1,in2;output out;assign #1 out=(in1|in2);endmodulemodule Nandgate (out,in1,in2);input in1,in2;output out;assign #1 out=~(in1&in2);endmodulemodule Xnorgate (out,in1,in2);input in1,in2;output out;assign #1 out=~(in1^in2);endmodulemodule Xorgate3(out,in1,in2,in3);input in1,in2,in3;output out;assign #1 out=(in1^in2^in3);endmodulemodule Norgate (out,in1,in2);input in1,in2;output out;assign #1 out=~(in1|in2);endmodulemodule Norgate3(out,in1,in2,in3);input in1,in2,in3;output out;assign #1 out=~(in1|in2|in3);endmodulemodule Xorgate (out,in1,in2);input in1,in2;output out;assign #1 out=(in1^in2);endmodulemodule mux2to1(I0, I1, S, out);input I1, I0, S;output out;//Invgate (out,in1);Invgate (w1,S);//Andgate2(out,in1,in2);Andgate2(w2,S,I1);Andgate2(w3,w1,I0);//Orgate2(out,in1,in2);Orgate2(out,w3,w2);endmodulemodule mux3to1(in0,in1,in2,S0,S1,out);input in0,in1,in2,S0,S1;output out;//mux2to1(I0, I1, S, out);mux2to1(in0, in1, S0, out0);mux2to1(out0, in2, S1, out);endmodule module mux4to1(in0,in1,in2,S0,S1,out);input in0,in1,in2,S0,S1;output out;//mux2to1(I0, I1, S, out);mux2to1(in0, in1, S0, out0);mux2to1(out0, in2, S1, out);endmodule module mux5to1(in7,in6,in5,in4,in3,in2,in1, in0, S0,S1,S2, out);input in7,in6,in5,in4,in3,in2,in1, in0, S0,S1,S2;output out;//mux2to1(I0, I1, S, out);mux2to1(in0,in1, S0, out0); mux2to1(in2, in3, S0, out1); mux2to1(in4, in5, S0, out2);mux2to1(out0, out1, S1, out3); mux2to1(out3, out2, S2, out); endmodulemodule prayertracker(Reset,clk,F,D,A,M,E,LG1,LG2,LG3,LG4,LG5,LR1,LR2,LR3,LR4,LR5,a0,b0,c0,d0,e0,f

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

Evaluate the expression. C(12, 4)

Answered: 1 week ago