Question

In: Computer Science

`timescale 1 ns / 1 ns module cir(a, b, f); input a, b; output f; assignf=...

`timescale 1 ns / 1 ns
module cir(a, b, f); input a, b;
output f;
assignf= ~(a&b);
endmodule
(1). Write a general verilog testbench for the above circuit without using any task. You must include all four testing cases for a and b. module cir_tb;

Solutions

Expert Solution

code:

output :

raw_code :

`timescale 1ns / 1ns

module cir_tb();
reg a,b;
wire f; //declaring output as reg

cir c(a,b,f); //instantiation

initial
$monitor("a = %b, b = %b , f= %b",a,b,f); //displaying in td console

initial
begin
//testing for all four cases
a = 1'b0;b = 1'b0; #20;
a = 1'b0;b = 1'b1; #20;
a = 1'b1;b = 1'b0; #20;
a = 1'b1;b = 1'b1;
end
endmodule

**do comment for queries and rate me up*****


Related Solutions

1)Find the equation for output F as a sum of minterms: Inputs A, B, C Output...
1)Find the equation for output F as a sum of minterms: Inputs A, B, C Output F 000 1 001 0 010 0 011 0 100 1 101 1 110 0 111 1 2)Find the equation for output F in sum of product form: 3)Find the equation for output F as a product of sums: 4
​​​​1. f(x) = 1/2x-3 or y = 1/2x -3 The input is x and the output...
​​​​1. f(x) = 1/2x-3 or y = 1/2x -3 The input is x and the output is f(x) or y. What is the slope of the function? What is the y-intercept of the function? What is the x-intercept of the function? Graph the function. What is the slope of a horizontal line? Determine whether each function is increasing or decreasing? f(x) = 4x + 3 a(x) = 5 -2x k(x) = -4x +1 p(x) = 1/4x-3 q(x) = 4 4....
I/O Lab Java Purpose To practice the input and output concepts discussed in this module. Specifically,...
I/O Lab Java Purpose To practice the input and output concepts discussed in this module. Specifically, reading from and writing to local files, and formatting output. Instructions Read in file input.csv and generate a cleanly formatted table in output.txt. See the samples below. input.csv name,ID,salary,years experience foo,1,13890,12 bar,2,2342,3 baz,3,99999,24 output.txt Name | ID | Salary | Years experience -----+----+--------+----------------- Foo | 1 | 13890 | 12 Bar | 2 | 2342 | 3 Baz | 3 | 99999 | 24
module traffic(clk, reset, P1, P2, P3, P4, PL); input clk; input reset; output[4:0] P1; output[4:0] P2;...
module traffic(clk, reset, P1, P2, P3, P4, PL); input clk; input reset; output[4:0] P1; output[4:0] P2; output[4:0] P3; // four roads output [4:0] P4; output[3:0] PL; //Pl is pedestrian reg [4:0] P1; reg [4:0] P2; reg [4:0] P3; reg [4:0] P4; reg [3:0] PL; reg [4:0] sig; always @(posedge clk or negedge reset) begin    if(reset == 1'b0)begin        P1 <= 5'b00100;        P2 <= 5'b00100;        P3 <= 5'b00100;        P4 <= 5'b00100;       ...
Module/Week 2 ASSIGNMENT (INPUT/OUTPUT) The number of permutations of a set of n items taken r...
Module/Week 2 ASSIGNMENT (INPUT/OUTPUT) The number of permutations of a set of n items taken r at a time is given by the following formulan!/r !(n- r )!: where n! is the factorial of n, r! is the factorial of r, and (n-r)! is the factorial of the result of n-r. The factorial of a number n can be solved using the following formula: n!=e-n nn √ 2πn. If there are 18 people in your class and you want to...
module traffic(a, b,clk, reset, P1, P2, PL1, PL2, ind); input a,b; input clk; //g=100 y=010 r=001...
module traffic(a, b,clk, reset, P1, P2, PL1, PL2, ind); input a,b; input clk; //g=100 y=010 r=001 input reset; //g for pedes = 000 red = 111 input ind; output[2:0] P1; output[2:0] P2; // two roads output[1:0] PL1; //Pl is pedestrian output[1:0] PL2; reg [2:0] P1; reg [2:0] P2; reg [1:0] PL1; reg [1:0] PL2; reg [2:0] sig; always @(posedge clk, posedge reset) if(reset) begin P1 <= 3'b100; P2 <= 3'b001; PL1 <= 3'b111; PL2 <= 3'b000; end else begin //...
Write a Verilog HDL module that has three inputs, A, B, C, and one output, Y,...
Write a Verilog HDL module that has three inputs, A, B, C, and one output, Y, to implement a function that Y output is true if at least two of the inputs are false Also, write a testbench for the function.
An input & output record must be documented for the family A) true B) False rehabilitation...
An input & output record must be documented for the family A) true B) False rehabilitation involves the whole person A) true B) False A prosthesis is an assistive device which can be attached by a splint: A) True B) False
can i ask FSM verilog? ---------------------- module FSM(clk, rst, choice, out); input clk, rst, choice; output...
can i ask FSM verilog? ---------------------- module FSM(clk, rst, choice, out); input clk, rst, choice; output reg [1:0] out; reg [1:0] state, nextstate; parameter [1:0] S0 = 2’b00, S1 = 2’b01, S2 = 2’b10, S3 = 2’b11; always@(posedge clk) begin if (rst == 1’b0) begin state <= S0; end else end state <= nextstate; always@(state, rst, choice) begin case (state) S0 : begin out = 2’b00; if (rst == 1’b1) nextstate <= S1; end S1 : begin out = 2’b01;...
create a test bench for the following code: module signed_mult (out, clk, a, b); output [15:0]...
create a test bench for the following code: module signed_mult (out, clk, a, b); output [15:0] out; input clk; input signed [7:0] a; input signed [7:0] b; reg signed [7:0] a_reg; reg signed [7:0] b_reg; reg signed [15:0] out; wire signed [15:0] mult_out; assign mult_out = a_reg * b_reg; always@(posedge clk) begin a_reg <= a; b_reg <= b; out <=mult_out; end endmodule
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT