Code::
TEST BENCH ::
OUTPUT:
MONITOR OUTPUT:
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
in modelsim Q1-4-to-1 MUX (Dataflow Modeling) use Veirlog: 1-use verilog 2-Dataflow level Modeling. 3-all the testbench...
please all the stips Q1-4-to-1 MUX (Dataflow Modeling) use Veirlog: 1-use verilog HDL 2-Dataflow level Modeling 3- Test bench all line in testbench no shortcut use loop for testbench
Write a testbench for use in Quartus' ModelSim Altera in verilog for the following code of a 4x16 register: module regFile4x16 (input clk, input write, input [2:0] wrAddr, input [15:0] wrData, input [2:0] rdAddrA, output [15:0] rdDataA, input [2:0] rdAddrB, output [15:0] rdDataB); reg [15:0] reg0, reg1, reg2, reg3; assign rdDataA = rdAddrA == 0 ? reg0 : rdAddrA == 1 ? reg1 : rdAddrA == 2 ? reg2 : rdAddrA == 3...
Write structural/heirarcherical Verilog to design 8 to 1 MUX using 2 to 1 and 4 to 1 MUX use wires
Verilog code and wave. Please explain :) § If you use flipflops, you might need to handle ‘setup time’ for the flipflop. Also, you might need to initialize all input signals. Problem 3 [20 ptsl Design a testbench for 6-bit subtractor. Use at least 10 test cases. Submit your codes and test results (waveforms) with your testbench. You can use your Verilog code from Lab #1, or use the one posted on Canvas. Problem 3 [20 ptsl Design a testbench...
I need the verilog module and testbench for this Thanks Design a binary sequence detector that detects 4 consecutive 1's; overlap is allowed. You should have 5 states and thus you need 3 flip-flops. For simplicity, you can assign the states to be 000, 001, 010, 011, 100.
Write a Verilog module and testbench for a 3:1 multiplexer that implements the following function. You can use “case”, “if” or “assign” statements. Grades will be agnostic of your style of implementation (you can choose any of these three styles) and only on the correct functionality. Y = S0’S1’D0 + S0S1’D1+ S1D2 Here, S0 and S1 are the two select signals and D0, D1 and D2 are the three data signals. What does the following snippet of Verilog code do?...
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
Building and testing basic combinational circuits using Verilog HDL Description: Build and test the following circuits using gate-level modeling in Verilog HDL 1.3-input majority function 2.Conditional inverter (see the table below: x - control input, y -data input). Do NOT use XOR gates for the implementation. Output 3. Two-input multiplexer (see the table below: x.y -data inputs, z- control input) Output 4. 1-bit half adder. 5. 1-bit full adder by cascading two half adders 6.1-bit full adder directly (as in...
3) (10 points) Implement F(A, B, C) = m(0,1,4,7) using an 2-to-1 MUX (use the symbol) and any other basic logic gates necessary (AND, OR, or NOT gates). Show the truth table and minimize any combinational logic (other than the MUX) in sum-of-products form. Use the left most input(s) for the MUX select input(s) in your schematic.
– 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 ...