Question

Q1-4-to-1 MUX (Dataflow Modeling) use Veirlog: 1-use verilog 2-Dataflow level Modeling. 3-all the testbench no shortcut, allo



in modelsim

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

select[1] select[0] d[0] d[2] d[3]

Code::

ve mux_four_one.v X ve mux_four.* X Untitled 5* x C:/Users/G.D. TARUN/project_1/project_1.srcs/sources_1/new/mux_four_one.v

TEST BENCH ::

ve mux_four_one. v x ve mux_four.v x Untitled 5* x C:/Users/G.D.TARUN/project_1/project_1.srcs/sim_2/new/mux_four.v timescale

OUTPUT:

nuo Cuori - Crinul Cul o II Viiu Urm o - UUUUUUUULUM IULUI ve mux_four_one.v X ve mux_four.v X Untitled 5* X OLX 0 190.600 ns

MONITOR OUTPUT:


Id Console i = 0000, i = 0000, i = 0000, i = 0001, i = 0001, i = 0001, i = 0001, i = 0010, i = 0010, i = 0010, i = 0010, i =

ED Td Console i = 1000, select = 01 I y = 0 i = 1000, select = 10 l y = 0 i = 1001, select = 11 I y = 1 i = 1001, select = 00

CODE ::

`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////

module mux_four_one( s, i , y );

input [1:0] s;     //declaring input and output ports
input [3:0] i;
output y;

wire [3:0] k;
assign k[0] = (~s[1])&(~s[0])&i[0];     //from mux output expression
assign k[1] = (~s[1])&s[0]& i[1];
assign k[2] = s[1] & (~s[0])& i[2];
assign k[3] = s[1] & s[0]& i[3];

assign y = k[0]+k[1]+k[2]+k[3];         //final output

endmodule


TEST BENCH CODE::

`timescale 1ns / 1ps
module mux_four();

reg [1:0] s;
reg [3:0] i;
wire y;

integer f;

mux_four_one n(s,i,y);          //instantiation
initial
begin
    #2 $monitor("i = %b, | select = %b | y = %b ",i,s,y);         //displaying output with monitor
end
initial
begin
    for(f=0; f<16; f =f+1)         //giving inputs from for lopp
    begin
        i = f;
          #5 s = 0 ;        //changing s values
          #5 s =1;
          #5 s = 2;
          #5 s = 3;
    end
end
endmodule

Add a comment
Know the answer?
Add Answer to:
in modelsim Q1-4-to-1 MUX (Dataflow Modeling) use Veirlog: 1-use verilog 2-Dataflow level Modeling. 3-all the testbench...
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
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