Question

List the inputs/outputs and truth-table of Following Verilog codes module switch(A,B,X,Y,S); input[0:0] A,B,S; output[0:0] X,Y; alaways...

List the inputs/outputs and truth-table of Following Verilog codes

module switch(A,B,X,Y,S);

input[0:0] A,B,S;

output[0:0] X,Y;

alaways @(A,B,S) begin

if S == 0 begin

X <= A;

Y <= B;

end

else begin

X <= B;

Y <= A;

end

end

endmodule

0 0
Add a comment Improve this question Transcribed image text
Answer #1

From the given verilog code,  

Inputs are A,B and S.

Outputs are X and Y.

Now we can see the truth table for given logic .

Add a comment
Know the answer?
Add Answer to:
List the inputs/outputs and truth-table of Following Verilog codes module switch(A,B,X,Y,S); input[0:0] A,B,S; output[0:0] X,Y; alaways...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • module Lab5(Clock, Ex, Reset, W, S, L, Q); //Inputs input Clock, Ex, Reset; input [1:0] W;...

    module Lab5(Clock, Ex, Reset, W, S, L, Q); //Inputs input Clock, Ex, Reset; input [1:0] W; input [2:0] S; input [3:0] L; //Outputs output reg [3:0] Q; // Inputs for FSM = Clock, Ex, Reset, W           Outputs = S, L FSM U0 (.Clock(Clock), .Ex(Ex), .Reset(Reset), .W(W), .S(S), .L(L)); // Inputs for BUSR = Clock, Reset, L, S                       Outputs = Q Behavioral_Universal_Shift_Register U1 (.Clock(Clock), .Reset(Reset), .L(L), .S(S), .Q(Q)); endmodule How do you use the...

  • a Read the following codes in Verilog and the corresponding testbench file. Describe what the codes...

    a Read the following codes in Verilog and the corresponding testbench file. Describe what the codes are doing by adding comments in the code. Then write down the simulation results of res1, res2, res3, and res4, respectively. Source code module vector_defn (num1, res1, res2, res3, res4); input [7:0] num1; output res1; output [3:0] res2; output [0:7] res3; output [15:0] res4; assign res1=num1[2]; assign res2=num1[7:4]; assign res3=num1; assign res4={2{num1}}; endmodule testbench: `timescale 1ns / 1ps module vector_defn_tb; reg [7:0] in1; wire...

  • A sequential circuit has one input (X), a clock input (CLK), and two outputs (S and...

    A sequential circuit has one input (X), a clock input (CLK), and two outputs (S and V). X, S and V are all one-bit signals. X represents a 4-bit binary number N, which is input least significant bit first. S represents a 4-bit binary number equal to N + 3, which is output least significant bit first. At the time the fourth input occurs, V = 1 if N + 3 is too large to be represented by 4 bits;...

  • Question 3: Realize the circuit below using Verilog. Include a signal “reset_n” for asynchronously clearing the...

    Question 3: Realize the circuit below using Verilog. Include a signal “reset_n” for asynchronously clearing the flip-flop. What type of circuit is this? Complete the following Verilog code. Write a test bench to test it. clk sel module aff (clk, reset_n, sel, q); input clk ; // Declare the inputs and outputs of the module. input reset_n; input sel; output q; reg q; wire D; ; // model the combinational logic assign D= always @( begin if ( else end...

  • Q3. Draw the circuit represented by this Verilog code Module system(A,B.C.Y) Input A,B.C: Output Y Assign...

    Q3. Draw the circuit represented by this Verilog code Module system(A,B.C.Y) Input A,B.C: Output Y Assign Y (C1)?A: B Endmodule

  • Write a test bench to thoroughly test the Verilog module dff_fe_asyn_h. below is the module ddff_fe_asyn_h.code...

    Write a test bench to thoroughly test the Verilog module dff_fe_asyn_h. below is the module ddff_fe_asyn_h.code Simulate the circuit using ISim and analyze the resulting waveform. Take full screenshots of all Verilog source codes and the resulting simulation waveform to be included in the lab report. Include explanation of the waveform and how you can conclude that the D flip flop implemented in step 9 is correct in the lab report. Verilog Code for dff_fe_asyn_h is mentioned below:- //DFF module...

  • Module halfadder(sum, cout, x, y); input x, y; output sum, cout; assign sumxy; assign cout-x&y; B...

    please fill in the wire, four gates and , calling the half adders module halfadder(sum, cout, x, y); input x, y; output sum, cout; assign sumxy; assign cout-x&y; Bo endmodule module multiplier(C, A, B); input [1:0] A, B; Cs C C1 Co output [3:0] C; //declare internal wires // four and gates // call halfadder twice Bo HA HA c, c2 Co endmodule module halfadder(sum, cout, x, y); input x, y; output sum, cout; assign sumxy; assign cout-x&y; Bo endmodule...

  • why its 4-to-1 mux behavioral? What does the logic circuit represented by the following Verilog module...

    why its 4-to-1 mux behavioral? What does the logic circuit represented by the following Verilog module do, and what Verilog description style does it use? // My Verilog module #1 module mymodl ( x, d, q) input[1:0] x;input[3:0] d;output q; reg q; wire [1:0] x; wire [3:0] d; always ( x or d) begin case ( x ) 1 : q=d[1]; 2 : g=d[2]; 3 q d[3]; endcase end endmodule

  • I need a test bench code for this module in verilog. Verilog Code module part6 (А.В.us,G,E,L);...

    I need a test bench code for this module in verilog. Verilog Code module part6 (А.В.us,G,E,L); AlL ((Al --AI --op AIL (us) I-AIL input [2:0]A,B; input us; output G,E.I; reg G,E,L wire [2:0] A,B; always@(A or B) if (us 1)//unsigned mode begin しくーAB: //А is less G-A>B; //B is less 区-A-B; //logical (A equality end --oper AlL1 A[0] & -AIL E<-Ssigned(A) Ssigned(B); //logical equality opera AIL1I -AILI -operat else //signed mode begin しく=$signed(A)<$signed(B); //Ais less G-Ssigned(A)>Ssigned(B);: //B is less end...

  • (15 pts) 1. Draw a logic diagram for the Verilog code. module Seq_Ckt ( CLK, PR,...

    (15 pts) 1. Draw a logic diagram for the Verilog code. module Seq_Ckt ( CLK, PR, sel, Q); input CLK, PR, sel; output reg [2:0] Q; reg [2:0] y; assign Q = y; always @ (posedge PR, posedge CLK) begin if (PR== 1) then y <= 3'b111; else if (sel) begin y[2] <= y[1] ^ y[0]; y[1] <= y[2]; y[1]; end else y[2] <= y[2] ; y[1] <= y[1]; y[0]; y[O] <= y[0] <= end endmodule

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT