Question

Timescale is set to 100 ps / 1ps and the 1-bit signal of both inputs A...

Timescale is set to 100 ps / 1ps and the 1-bit signal of both inputs A and B is (0,0) -> (0,1) -> (1,0) -> (1,1 ) To simulate the output waveform of each logic when input to the AND, OR, NAND, NOR, and XOR logic with two inputs. Please submit the following for your design logic:

(1) Verilog code (basic.v).

(2) Testbench code (tb1.v)

(3) Execute (1) in ModelSim to output the waveform


◼ Define a module with the name of basic in basic.v, input A and
B to receive input, and define output port to output out_AND, out_OR, out_NAND, out_NOR, out_XOR. (The port name is an example, and can be arbitrarily named for its meaning)
◼ testbench calls the basic module defined in basic.v, connects the input and output, and inputs the input in the given time unit and value. After that, we simulate the input and output waveforms and check whether the output of the logic such as AND, OR, etc. is correctly output.
◼ Logic and testbench are designed on different files.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

//basic.v

//verilog code for basic AND,OR,NAND.NOR,EXOR gates

module basic (

//I/o DECLARATIONS

input A,

input B,

output out_AND,

output out_OR,

output out_NAND,

output out_NOR,

output out_XOR

);

//AND logic

assign out_AND = (A && B );

//OR logic

assign out_OR = (A || B);

//NAND logic

assign out_NAND = (~(A && B));

//NOR logic

assign out_NOR = (~(A || B));

//XOR logic

assign out_XOR = (A ^ B);

endmodule

//tb1.v

//verilog testbench code for basic gates

module test_basic;

reg A;

reg B;

wire out_AND;

wire out_OR;

wire out_NAND;

wire out_NOR;

wire out_XOR;

//instantiate unit under test(UUT)

basic UUT (A,B,out_AND,out_OR,out_NAND,out_NOR,out_XOR);

initial begin

A= 0;B=0;#10;

A= 0;B=1;#10;

A= 1;B=0;#10;

A= 1;B=1;

#10 $finish;

end

endmodule

// Simulation waveforms

Add a comment
Know the answer?
Add Answer to:
Timescale is set to 100 ps / 1ps and the 1-bit signal of both inputs A...
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
  • Each FF has an asynchronous active-low clear signal. The asynchronous active-low clear signal clears the FF and uses this signal to set the initial output of the FF to zero. (Active-low clear: clear...

    Each FF has an asynchronous active-low clear signal. The asynchronous active-low clear signal clears the FF and uses this signal to set the initial output of the FF to zero. (Active-low clear: clear when clear signal is low (0)). Implement negative edge-triggered T FF using Verilog code. At this time, The interface is as follows. Module t_ff (input t, input clk, input clearb, output q); How the waveform of q changes when the value of input t changes sequentially to...

  • Problem: Design a clocked synchronous state machine with two inputs A, and B, and a single...

    Problem: Design a clocked synchronous state machine with two inputs A, and B, and a single output Z that is 1 is: .A had the same value at each of the two previous clock ticks, or B has been 1 since the last time that the first condition was true. In-Lab 1. 2. 3. 4. For the finite state machine (FSM), identify the minimum number of states required Draw the state transition diagram Complete the state transition table Derive the...

  • 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...

  • FIRST ACTIVITY: (100/100) . SIMPLE 4-BIT ARITHMETIC LOGIC UNIT (ALU): This circuit selects between arithmetic (absolute...

    FIRST ACTIVITY: (100/100) . SIMPLE 4-BIT ARITHMETIC LOGIC UNIT (ALU): This circuit selects between arithmetic (absolute value, addition) and logical (XOR, AND) operations. Only one result (hexadecimal value) can be shown on the 7-segment display This is selected by the input sel (1..0) B A-BI A+B A xnor B A nand B Input EN: If EN-1result appears on the 7 segment display. If EN=0 → all LEDs in the 7 segment display are off Arithmetic operations: The 4-bit inputs A...

  • You will use Quartus II to build an 8 bit arithmetic logic unit that performs the...

    You will use Quartus II to build an 8 bit arithmetic logic unit that performs the following functions: Control Value Function                                000 Copy In1 to theResult unchanged 001 Copy In2 to theResult unchanged 010 Add In1 to In2 011 Subtract In2 from In1 100 And In1 and In2 101 Or In1 and In2 110 Shift left In1 by 1 bit 111 Shift right In1 by 1 bit You are allowed to use either gates/logic schematic, or else Verilog. We suggest...

  • – Write and test a constrained random stimulus testcase for the testbench. Use ModelSim or a simi...

    – Write and test a constrained random stimulus testcase for the testbench. Use ModelSim or a similar simulator to test the transactor. Provide the code and evidence of its function. // ---------------------------------------------------------------------------- // File name: alu.v // Designed by: Jim Moran // ---------------------------------------------------------------------------- // // This module is the Arithmetic Logic Unit // // ---------------------------------------------------------------------------- `timescale 1ns/1ps //----------------------------------------------------------------------------- // Module Declaration //----------------------------------------------------------------------------- module alu (    // Global Signals    Clk_In, // Rising Edge Clock Input    Rst_l_In, // Active Low Reset Input   ...

  • Some questions may require well bulum 1. HDL stands for? a. Hardware Design Language b. Hardware...

    Some questions may require well bulum 1. HDL stands for? a. Hardware Design Language b. Hardware Development Language c. Hardware Description language d. Hot Dry Land 2. What is the basic building unit of a VHDL design? a. Blocks b. Cubes c . Dices d. Bricks 3. What reserved word do all VHDL entities end with? a. entity b. use c. port d. end d. IEEE 4. Which block describes a design's interface? a. entity b. architecture c. library 5....

  • This was the answer I got, teacher said it was wrong Teacher said, couldnt run the...

    This was the answer I got, teacher said it was wrong Teacher said, couldnt run the gate because there wasnt any switches 5. Design and test a simplified logic circuit to identify all numbers in the output range of function: F(x) = 2x+3 for an input domain between 0 and 6. Be sure to include your truth table. Normal 1 No Spac... Heading 1 Head Paragraph Styles t Draw Simulate View Window Help 39 ) ) 11:55 1 esu.desire2learn.com Boolean...

  • In this lab, you will design a finite state machine to control the tail lights of...

    In this lab, you will design a finite state machine to control the tail lights of an unsual car. There are three lights on each side that operate in sequence to indicate thedirection of a turn. Figure ! shows the tail lights and Figure 2 shows the flashing sequence for (a) left turns and (b) right rums. ZOTTAS Figure 28:8: BCECECece BCECECECes BCECECECB BCECECBCB 8888 Figure 2 Part 1 - FSM Design Start with designing the state transition diagram for...

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
ADVERTISEMENT