Question

In: Computer Science

Verilog code with explanation please // Netflix has been engaged by movie studios to advertise new...

Verilog code with explanation please

// Netflix has been engaged by movie studios to advertise new movies.

// Netflix will show visitors one of 4 ads based on the kind of movie

// they last watched.

// The following characteristics of the last watched movie are

// considered:

// - Whether the movie was animated? (A = 1 means the movie was

//     animated; otherwise A = 0)

// - Whether the starring actor was female (F = 1) or male (F = 0)?

// - The type of movie: (T = 2'b00 (action movie), 2'b01 (romance),

//     2'b10 (comedy), 2'b11 (thriller))

// The ad served is chosen by the following rules:

// - "A Good Day to Die Hard" (M = 2'b00) will be shown to viewers of

//     action movies and thrillers, unless they are animated or had a

//     female starring actor.

// - "Safe Haven" (M = 2'b01) will be selected for people who had

//     viewed romance movies or movies with a female starring actor that

//     are not comedies.

// - When the previous two movie ads aren't shown, "Escape from Planet

//     Earth" (M = 2'b10) will be shown to people viewing animated movies,

//     comedies, or action movies.

// - Otherwise, "Saving Lincoln" (M = 2'b11) will be shown.

module movies(M, A, F, T);

   output [1:0] M;

   input    A, F;

   input  [1:0] T;

   

endmodule // movies

Solutions

Expert Solution

Verilog code:

//=======================================

module movies(M, A, F, T);
   output [1:0] M;
   input    A, F;
   input [1:0] T;

reg [1:0] movie;
always @(*)    // always combo loop
begin
// Action movie or thriller movie but not animated or starred by female
if(((T==2'b00) || (T==2'b11)) && ((A!=1'b1) && (F!=1'b1)))
    begin
        movie = 2'b00;
    end
// Viwed romantic movie or female stared movie but not commedy
    else if((T==2'b01) || ( F==1'b1 && T!=2'b10 ))
    begin
        movie = 2'b01;
    end
// People viwed animated movie or commedies or action movie
    else if((A==1'b1) || (T==2'b10) || (T==2'b00))
    begin
        movie = 2'b10;
    end
// otherwise
    else
    begin
        movie = 2'b11;
    end
end

assign M = movie; // assigning movie to output
endmodule // movies

//=======================================

tested with testbench:

//=======================================

// Code your testbench here
// or browse Examples
module TB();

reg A,F;
reg [1:0] T;
wire [1:0] M;
initial
begin

// All 16 case assignment
    A=0;F=0; T=2'b00;
    #1 T=2'b01;
    #1 T=2'b10;
    #1 T=2'b11;
    #1 T=2'b00; F = 1;
    #1 T=2'b01;
    #1 T=2'b10;
    #1 T=2'b11;
    #1 T=2'b00;F=0; A=1;
    #1 T=2'b01;
    #1 T=2'b10;
    #1 T=2'b11;
    #1 T=2'b00; F = 1;
    #1 T=2'b01;
    #1 T=2'b10;
    #1 T=2'b11;

end

initial
begin
// print out input and output of module movies
$display(" Advertisment A F T M");
$monitor("               %b %b %b %b",A,F,T,M);
end


movies umovies
(
.M(M),
.A(A),
.F(F),
.T(T)
);

endmodule

//=======================================

Simulation log print:

Theoretical Truth table:

A F T M
0 0 00 00
0 0 01 01
0 0 10 10
0 0 11 00
0 1 00 01
0 1 01 01
0 1 10 10
0 1 11 01
1 0 00 10
1 0 01 01
1 0 10 10
1 0 11 10
1 1 00 01
1 1 01 01
1 1 10 10
1 1 11 01

Related Solutions

Assume Netflix operates as a monopoly in the movie streaming market. Each month Netflix has fixed...
Assume Netflix operates as a monopoly in the movie streaming market. Each month Netflix has fixed costs of $10,000 and the marginal cost of each additional subscription is $0. Suppose the market demand for Netflix subscriptions is: QD = 1000 – 5P Q denotes the quantity of subscriptions, and P denotes the monthly subscription price e. Calculate the deadweight loss associated with Netflix's monopoly power. DWL = f. Suppose the entry of Disney+ and other streaming services causes the demand...
**New code needed! Please do not reference code that has already been answered for this question...
**New code needed! Please do not reference code that has already been answered for this question as that code contains errors*** Write a C++ program to simulate a service desk. This service desk should be able to service customers that can have one of three different priorities (high, medium, and low). The duration for any customer is a random number (between 5 minutes and 8 minutes). You need to write a program that will do the following: Generate random 100...
Verilog code to make 8bit bcd to 8bit binary please with testbench
Verilog code to make 8bit bcd to 8bit binary please with testbench
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it,...
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it, please comment and explain the answer as much as possible if possible, post Pic of the waveform simulation!
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it,...
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it, please comment and explain the answer as much as possible waveform simulation answer would be nice too!
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it,...
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it, please comment and explain the answer as much as possible!
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it,...
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it, please comment and explain the answer as much as possible,(Make your own code, even it is more simple, but do not copy from others sources on the internet) if possible, post Pic of the waveform simulation!
verilog code of a 64 x64 array with 128 parameters please include test bench
verilog code of a 64 x64 array with 128 parameters please include test bench
I need this code in C++ form using visual studios please: Create a class that simulates...
I need this code in C++ form using visual studios please: Create a class that simulates an alarm clock. In this class you should: •       Store time in hours, minutes, and seconds. Note if time is AM or PM. (Hint: You should have separate private members for the alarm and the clock. Do not forget to have a character variable representing AM or PM.) •       Initialize the clock to a specified time. •       Allow the clock to increment to the...
please add the explanation 10. The government has been trying to decide whether or not to...
please add the explanation 10. The government has been trying to decide whether or not to purchase any of the new, advanced missiles it has developed. One of the arguments in favor of purchasing the missiles is that since so much money has been spent on their development it would be a waste of money not to buy them now. What is the major problem with this argument? A) It includes erosion costs in the decision-making process. B) It includes...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT