Question

Write Verilog modules: a 3x8 decoder and a 8x1 multiplexor. The multiplexor “includes” the decoder module...

Write Verilog modules: a 3x8 decoder and a 8x1 multiplexor. The multiplexor “includes” the decoder module as part of it. Use arrays as much as possible.

EXAMPLE:

module DecoderMod(s, o); // module definition
   input s;
   output [0:1] o;

   not(o[0], s);
   assign o[1] = s;
endmodule

module MuxMod(s, d, o);
   input s;
   input [0:1] d;
   output o;

   wire [0:1] s_decoded, and_out;

   DecoderMod my_decoder(s, s_decoded); // create instance

   and(and_out[0], d[0], s_decoded[0]);
   and(and_out[1], d[1], s_decoded[1]);
   or(o, and_out[0], and_out[1]);
endmodule
0 0
Add a comment Improve this question Transcribed image text
Answer #1
module Multiplexer_1(I0,I1,I2,I3,I4,I5,I6,I7,s3,s2,s1,y,en)
input I0,I1,I2,I3,s2,s1,en;
output y;
assign y=((~s3)&(~s2)&(~s1)&en&I0)| ((~s3)&(~s2)&(s1)&en&I1)|((~s3)&s2&(~s1)&en&I2)|((~s3)&(s2)&(s1)&en&I3)|((s3)&(~s2)&(~s1)&en&I4)|((s3)&(~s2)&(s1)&en&I5)|((s3)&(s2)&(~s1)&en&I6)|((s3)&(s2)&(s1)&en&I7);
end module
Multiplexer_1 Decoder(
.I0(I0),
.I1(I1),
.I2(I2),
.I3(I3),
.I4(I4),
.I5(I5),
.I6(I6),
.I7(I7)
);
        input a,b,c;
        output d0,d1,d2,d3,d4,d5,d6,d7;
        assign   I0=(~a&~b&~c),
                         I1=(~a&~b&c),
                         I2=(~a&b&~c),
                         I3=(~a&b&c),
                         I4=(a&~b&~c),
                         I5=(a&~b&c),
                         I6=(a&b&~c),
                         I7=(a&b&c);
end
Add a comment
Know the answer?
Add Answer to:
Write Verilog modules: a 3x8 decoder and a 8x1 multiplexor. The multiplexor “includes” the decoder module...
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
  • Write a VERILOG simulation code for a 3 to 8 decoder and a simulation code for...

    Write a VERILOG simulation code for a 3 to 8 decoder and a simulation code for a 4 to 16 decoder using two 3 to 8 decoders. The code used for 3 to 8 decoder: Code used for 4 to 16 decoder: Need help with simulation code. 22 module Dec3to8 ( 23 input [2:0 A input E output [7:0] D 24 25 26 27 E &A[2]& 28 assign D[0] A[1 A[0] E &A[2] &A[1] assign D[1] & A[0] 29 E...

  • Question 3 (3 marks) Identify at least 3 errors in the Verilog modules below. module simpleALU(mput...

    Question 3 (3 marks) Identify at least 3 errors in the Verilog modules below. module simpleALU(mput [31:0) A, B, input [2:0) F, output reg [31:0) Y) endmodule module alu simpleTestbenchO; wire [10:0] inA, inB wire [2:0] sel; reg [31-0] outY simpleALU dut(sel, outY, inA, inB) initial (sel, inA, inB)-: #10 sei 3.6010; (inA, inB) - 16h0000 0000 0000 0000; #10 sel 3bl 10; finA, inB)- 16h0000 0000 FFFF_FFFF: endmodule

  • Using Verilog, write a simulation code that shows the function g(w, x, y, z) = wxyz...

    Using Verilog, write a simulation code that shows the function g(w, x, y, z) = wxyz + w’x’y’z+w’x’yz’+w’xy’z’+wx’y’z’ using a 4 to 16 decoder that is built with two 3 to 8 decoders. The 3 to 8 source code I'm using is: module Dec3to8(    input[2:0] A,    input E,    output[7:0] D    );    assign D[0] = E & ~A[2] & ~A[1] & ~A[0];    assign D[1] = E & ~A[2] & ~A[1] & A[0];    assign D[2]...

  • program an 8-to-1 multiplexor using verilog output of time table from 1 - 2047 For example...

    program an 8-to-1 multiplexor using verilog output of time table from 1 - 2047 For example output should look like.... --------- [Start of table] ---------------------------- [End of table] ---------- Here is example of 4x1 Multiplexor ... Just need code for 8x1 Multiplexor module DecoderMod(s, o); input [1:0] s; output [0:3] o; wire [1:0] inv_s; not(inv_s[1], s[1]); not(inv_s[0], s[0]); and(o[0], inv_s[1], inv_s[0]); and(o[1], inv_s[1], s[0]); and(o[2], s[1], inv_s[0]); and(o[3], s[1], s[0]); endmodule module MuxMod(s, d, o); input [1:0] s; input [0:3]...

  • 7. Which of the following Verilog code segments will generate errors when compiled? A. module demo...

    7. Which of the following Verilog code segments will generate errors when compiled? A. module demo output reg F, input a): ire b; reg c assign b-c; initial begin end endmodule module demo5 output reg F, input reg a); ire b reg c assign bC; initial begin end C. module demooutput reg F, input wire a ire b reg c assign b c; initial begin F c& b; end D. O both A) and C) E. O none will generate...

  • 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

  • Please explain what he verilog code does: module lab7_2_3( input clk, input Enable, input Clear, input...

    Please explain what he verilog code does: module lab7_2_3( input clk, input Enable, input Clear, input Load, output [3:0] Q, reg [3:0] count,      wire cnt_done );             assign cnt_done = ~| count;     assign Q = count;     always @(posedge clk)          if (Clear)              count <= 0;          else if (Enable)          if (Load | cnt_done)          count <= 4'b1010; // decimal 10          else          count <= count - 1; Endmodule

  • 3. From the slides and the reference materials, we see that there are two methods for...

    3. From the slides and the reference materials, we see that there are two methods for implementing logic in Verilog HDL. The circuit can be described using "Structural Verilog or "Behavioral Verilog." In Structural Verilog the structure of the circuit is defined using Boolean algebra statements. In Behavioral Verilog the circuit is defined by its behavior. Below are examples of a 2x1 multiplexer implemented using structural and behavioral Verilog. STRUCTRAL 2x1 MULTIPLEXER CODE: // Example 5a: 2-to-1 MUX using logic...

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

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

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