ECEN 350 Prelab

ECEN 350 Prelab 6 Summer 17

Question 1:

Structural programming describes the actual hardware implemented(AND and OR gates). and(x,a,b);

Behavioral programming describes the functionality of a circuit.

assign x=a&b;

Question 2:

A B Sum Carry

0 0 0 0

0 1 1 0

1 0 1 0

1 1 0 1

module halfAdder(A,B,S,C)

input A,B;

output S,C;

wire x1,x2,x3;

nand(x1,A,B);

nand(x2,A,B);

nand(x3,x1,B);

nand(S,x2,x3); nand(C,x1,x1);

endmodule

Question 3:

`timescale 1ns / 1ps `define STRLEN 15

module HalfAddTest_v;

task passTest;

            input [1:0] actualOut, expectedOut;

           input [ `STRLEN*8:0] testType;           

            inout [7:0]                        passed;

              if(actualOut == expectedOut) begin $display ("%s passed", testType); passed = passed

+ 1 ; end          

            else $display ( "%s failed: %d should be %d", testType, actualOut, expectedOut);

  endtask         

task allPassed;

             input [7:0] passed;

            input [7:0] numTests;

            if(passed == numTests) $display ("All tests passed");          else $display("Some tests failed");

endtask

// Inputs

reg

A;

reg

B;

reg [7:0]

// Outputs

passed;

wire

Cout;

wire

Sum;

// Instantiate the Device Under Test (DUT)

  HalfAdd dut (

.Cout(Cout),

.Sum(Sum),

.A(A),

.B(B)

                            );

initial begin

             // Initialize Inputs

            A = 0;  B = 0;

            passed = 0;

             // Add stimulus here

             #90; A=0;B=0; #10; passTest({Cout, Sum}, 0, "0+0", passed);

           #90; A=0;B=1; #10; passTest({Cout, Sum},  1 , "0+1", passed);        

           #90; A=1;B=0; #10; passTest({Cout, Sum},  1 , "1+0", passed);        

            #90; A=1;B=1; #10; passTest({Cout, Sum}, 2, "1+1", passed);

                  #90;  

            allPassed(passed, 4);

end

  endmodule

Question 4:

sel i1 i0 | out

0 0 0 | 0

0 0 1 | 1

0 1 0 | 0

0 1 1 | 1

1 0 0 | 0

1 0 1 | 0

1 1 0 | 1 1 1 1 | 1 Question 5:

Question 6:

module two_one_mux (Y,A,B,Sel); // define the module name and its interface

output wire Y; //declare output          input wire A, B, Sel;         //declare inputs

wire sel_bar; //internal wires

wire w2; wire w1;

not(sel_bar,sel);//implementations of module and(w1,sel_bar,A); and(w2,Sel,B); or(Y,w1,w2);

endmodule

Question 7:

`timescale 1ns / 1ps

`define STRLEN 15

module Mux21Test_v;

task passTest; input actualOut, expectedOut;                input [`STRLEN*8:0] testType;

inout [7:0] passed;

 if(actualOut == expectedOut) begin $display ("%s passed", testType); passed =

passed + 1 ; end         else $display ("%s failed:         %d should  be %d", testType, actualOut, expectedOut);

endtask

task allPassed; input [7:0] passed;

input [7:0] numTests;

if(passed == numTests) $display ( "All  tests passed");          else $display("Some              tests    failed");

endtask

 task stim;

input [1:0] newIn; input newSel; output [1:0] setIn;

output setSel;

begin #90;

setIn = newIn;

setSel = newSel;

end

endtask

// Inputs reg [1:0] in;    reg sel;

reg [7:0] passed;

                // Outputs         

wire out;

// Instantiate the Unit Under Test (UUT) Mux21 uut (

.out(out),

.in(in),

.sel(sel)

);

 initial begin

// Initialize          Inputs in = 0;

sel = 0;

passed = 0;

stim(0, 0, in, sel); #10; passTest(out, 0, "Select First 0 ", passed);   stim(1, 0 , in, sel);       #10;    passTest(out,                   1,  "Select       First    1 ", passed);  stim(2, 0, in,           sel); #10; passTest(out, 0, "Select First 2", passed); stim(3, 0, in,   sel);     #10;      passTest(out,                 1, "Select First 3", passed); stim(0, 1 , in, sel);     #10;      passTest(out,                   0,  "Select       Second             0 ", passed);  stim(1, 1, in,           sel);     #10;     passTest(out,                 0,  "Select       Second             1 ", passed);             stim(2, 1, in,   sel);     #10;    passTest(out,                  1 , "Select       Second 2", passed); stim(3, 1, in, sel); #10; passTest(out, 1, "Select Second 3", passed);

#10;

allPassed(passed, 8);

end

endmodule

hihi

Download Sample Now

Earn back money you have spent on downloaded sample



Upload Document Document Unser Evaluion Get Money Into Your Wallet



Cite This work.

To export a reference to this article please select a referencing stye below.

Assignment Hippo (2021) . Retrive from http://assignmenthippo.com/sample-assignment/ecen-350-prelab

"." Assignment Hippo ,2021, http://assignmenthippo.com/sample-assignment/ecen-350-prelab

Assignment Hippo (2021) . Available from: http://assignmenthippo.com/sample-assignment/ecen-350-prelab

[Accessed 17/10/2021].

Assignment Hippo . ''(Assignment Hippo,2021) http://assignmenthippo.com/sample-assignment/ecen-350-prelab accessed 17/10/2021.


Want latest solution of this assignment

Want to order fresh copy of the Sample Template Answers? online or do you need the old solutions for Sample Template, contact our customer support or talk to us to get the answers of it.


Submit Your Assignment Here

AssignmentHippo Features

On Time Delivery

Our motto is deliver assignment on Time. Our Expert writers deliver quality assignments to the students.

Plagiarism Free Work

Get reliable and unique assignments by using our 100% plagiarism-free.

24 X 7 Live Help

Get connected 24*7 with our Live Chat support executives to receive instant solutions for your assignment.

Services For All Subjects

Get Help with all the subjects like: Programming, Accounting, Finance, Engineering, Law and Marketing.

Best Price Guarantee

Get premium service at a pocket-friendly rate at AssignmentHippo

FREE RESOURCES

  • Assignment Writing Guide
  • Essay Writing Guide
  • Dissertation Writing Guide
  • Research Paper Writing Guide

FREE SAMPLE FILE

  • Accounts
  • Computer Science
  • Economics
  • Engineering

Client Review

I was struggling so hard to complete my marketing assignment on brand development when I decided to finally reach to the experts of this portal. They certainly deliver perfect consistency and the desired format. The content prepared by the experts of this platform was simply amazing. I definitely owe my grades to them.

Tap to Chat
Get instant assignment help