Question

In: Electrical Engineering

A testbench is provided in the following directory (~lab_work/verification/task3) without the Device Under Test (DUT).(see testbench...

  1. A testbench is provided in the following directory (~lab_work/verification/task3) without the Device Under Test (DUT).(see testbench below)

`timescale 1ns/10ps

module tb_detector ;

reg clk, rst, datain;
wire det;

detector DUT ( .clk(clk), .rst(rst), .datain(datain), .det(det) );


initial
begin
#0 clk = 0;
datain = 0;
forever #5 clk = ~clk;
end

initial
begin
#0 rst = 0;
@ (negedge clk);
@ (negedge clk);
rst = 1;
@ (negedge clk);
datain = 1;
@ (negedge clk);
datain = 0;
@ (negedge clk);
datain = 1;
@ (negedge clk);
datain = 1;

@(posedge clk)
#2 if (det == 1)
$display ("det = %b, correct output", det);
else
$display ("det = %b, incorrect output", det);

@ (negedge clk);
datain = 1;
@ (negedge clk);
datain = 1;
@ (negedge clk);
datain = 0;
@ (negedge clk);
datain = 0;
@ (negedge clk);
datain = 0;

@(posedge clk)
#2 if (det == 0)
$display ("det = %b, correct output", det);
else
$display ("det = %b, incorrect output", det);

@ (negedge clk);
datain = 1;
@ (negedge clk);
datain = 0;
@ (negedge clk);
datain = 1;
@ (negedge clk);
datain = 1;

@(posedge clk)
#2 if (det == 1)
$display ("det = %b, correct output", det);
else
$display ("det = %b, incorrect output", det);

@ (negedge clk);
datain = 1;

#100 $finish;
end



endmodule

  1. Write a verilog code for the DUT that will do the following:

i) receive clk, rst dan datain signals from the provided testbench

ii) reset the output signal to LOW synchronously with the positive (rising) edge of clk when rst is set LOW

iii) produce an output signal similar to datain when rst is HIGH and the output transition occurs at the negative (falling) edge of clk.

  1. Verify the design using the testbench.

Solutions

Expert Solution

Verylog Code for DUT:

​​​​​​module detector(clk,rst,datain,det); //initialise the module
input clk,rst,datain;//declare inputs
output reg det;//declare outputs
initial det=0 ;//give initial value for det
always@(posedge clk)//define always block
begin
if(rst==1'b0)// if rst is low then output is low
det<=1'b0;
end
always@(negedge clk) //define another always
begin
if(rst==1'b1) // if reset Is high output is datain
det<=datain;
end // end the always block
endmodule// end the module

Code:

output:

Console output:

please note that I have not uploaded the test bench since the same given test bench is used

please comment if you have any doubts...

please give me upvote if you like my answer..tq


Related Solutions

1. Given the following data, test at the 0.05 level of significance to see if the...
1. Given the following data, test at the 0.05 level of significance to see if the number of dogs treated at two different vet clients differs. Assume variances are equal. Clinic A (doges treated per 10 randomly selected day); 10, 11, 15, 4, 8, 9, 14, 5, 18, 20 Clinic B (dogs treated per 7 randomly selected day): 11, 16, 15, 18, 14, 16, 18 2. Given the following data, test to see if the company with newer technology has...
Use a = .01 and conduct a goodness of fit test to see whether the following...
Use a = .01 and conduct a goodness of fit test to see whether the following sample appears to have been selected from a normal distribution. 55, 86, 94, 58, 55, 95, 55, 52, 69, 95, 90, 65, 87, 50, 56 55, 57, 98, 58, 79, 92, 62, 59, 88, 65 a) What is the value of the test statistic? b) What is the critical value of the test statistic? c) What is the p-value (or range for the p-value...
1. Which of the following is nott one of the rights provided to taxpayers under The...
1. Which of the following is nott one of the rights provided to taxpayers under The Taxpayer Bill of Rights? A.. The right to know what they need to do to comply with the tax laws. B.. The right to receive prompt, courteous, and professional assistance in their dealings with the IRS. C.. The right to know the maximum amount of time they have to challenge the IRS's position. D.. The right to reschedule the audit as many times as...
The result of a hypothesis test is said to be "statistically significant" under all the following...
The result of a hypothesis test is said to be "statistically significant" under all the following circumstances EXCEPT: Group of answer choices There is convincing evidence supporting the alternative hypothesis. The P-value is less than alpha. The difference observed between the sample result and the parameter value stated in the null hypothesis is important in the real world. The difference observed between the sample result and the value stated in the null hypothesis is highly unlikely to be due to...
Question 3: Exact Differential Equation i. Test to see if the following equation is exact, if...
Question 3: Exact Differential Equation i. Test to see if the following equation is exact, if exact solve for the general solution (??/??) +(2? ????+?^3?^?)/(?^2cos?+3?^2?^?)=0 ii. Solve (?+????)??+(?????−2?)??=0 iii. Solve (?^2+?)??+(?^?−?)??=0 iv. (2?−3?)??+(2?−3?)??=0 I am sorry I could not send a photo. Whenever I try from the app it posts another question on the same page. I tried doing them individually and the only thing that happened was that the same question got posted 4 times. I would appreciate your...
Use the following results from a test for marijuana​ use, which is provided by a certain...
Use the following results from a test for marijuana​ use, which is provided by a certain drug testing company. Among 141 subjects with positive test​ results, there are 25 false positive results. Among 153 negative​ results, there are 3 false negative results a. How many subjects were included in the​ study? b. How many subjects did not use​ marijuana? c. What is the probability that a randomly selected subject did not use​ marijuana? Winning the jackpot in a particular lottery...
Use the following results from a test for marijuana use, which is provided by a certain...
Use the following results from a test for marijuana use, which is provided by a certain drug testing company. Among 148 subjects with positive test results there are 22 false positive results. Among 157 negative results, there are 4 false negative results. Complete parts (a) through (c) A. How many subjects were included in the study? The total number of subjects in the study was _ B. How many subjects did not use marijuana? A total of _ subjects did...
Use the following results from a test for marijuana​ use, which is provided by a certain...
Use the following results from a test for marijuana​ use, which is provided by a certain drug testing company. Among 149 subjects with positive test​ results, there are 21 false-positive​ results; among 158 negative​ results, there are 2 false-negative results. If one of the test subjects is randomly​ selected, find the probability that the subject tested negative or did not use marijuana.​ The probability that a randomly selected subject tested negative or did not use marijuana is
Use the following results from a test for marijuana​ use, which is provided by a certain...
Use the following results from a test for marijuana​ use, which is provided by a certain drug testing company. Among 140 subjects with positive test​ results, there are 30 false positive results. Among 152 negative​ results, there are 4 false negative results. Complete parts​ (a) through​ (c). (Hint: Construct a​ table.) a. How many subjects were included in the​ study? The total number of subjects in the study was .b. How many subjects did not use​ marijuana? A total of...
Under indirect inventory accounting the following records provided in Table 4 and the Inventory Footnote is...
Under indirect inventory accounting the following records provided in Table 4 and the Inventory Footnote is taken from Satin financial statements (amounts in thousands):                           Table 4 Inventory Valuation Numbers for Satin Co. in USD # Text 12/31/2010 12/31/2009 1 Inventory at LIFO 219,686 241,154 2 Cost of goods sold 754,661 675,138 3 Stockholders’ Equity 242,503 242,712 4 Net Income 31,185 64,150 5 Tax rate 37% 37% Inventory Footnote: If the first-in, first-out method of accounting for inventory had been...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT