Question

In: Computer Science

(Write/Design) both the RTL and Testbench using the Verilog HDL language of the five input majority...

(Write/Design) both the RTL and Testbench using the Verilog HDL language of the five input majority using the structure modeling approach.

NOTE: Design means RTL code and Testbench covering all possible corner cases

Solutions

Expert Solution


VHDL INTRODUCTION

The basics of the VHDL language for logic design. It describes the use of VHDL as a design entry method for logic design in FPGAs and ASICs. To provide context, it shows where VHDL is used in the FPGA design flow. Then a simple example, a 4-bit comparator, is used as a first phrase in the language. VHDL rules and syntax are explained, along with statements, identifiers and keywords. Finally, use of simulation as a means of testing VHDL circuit designs is demonstrated using ModelSim, a simulator software tool. Programming assignments are used to develop skills and reinforce the concepts presented.

VHDL Logic Design Techniques

In this module use of the VHDL language to perform logic design is explored further. Many examples of combinatorial and synchronous logic circuits are presented and explained, including flip-flops, counters, registers, memories, tri-state buffers and finite state machines. Methods of hierarchical design and modular design techniques are explained and demonstrated. How to create test benches is described as a means for design verification. Students are giving ample opportunity to practice and refined their design technique using the programming assignments.

Basics of Verilog

This module introduces the basics of the Verilog language for logic design. It describes the use of Verilog as a design entry method for logic design in FPGAs and ASICs, including the history of Verilog's development. Then a simple example, a 4-bit comparator, is used as a first phrase in the language. Verilog rules and syntax are explained, along with statements, operators and keywords. Finally, use of simulation as a means of testing Verilog circuit designs is demonstrated using ModelSim, a simulator tool. Programming assignments are used to develop skills and reinforce the concepts presented.

Verilog and System Verilog Design Techniques

In this module use of the Verilog language to perform logic design is explored further. Many examples of combinatorial and synchronous logic circuits are presented and explained, including flip-flops, counters, registers, memories, tri-state buffers and finite state machines. Methods of hierarchical design and modular design techniques are explained and demonstrated. How to create test benches is described as a means for design verification. Students are giving ample opportunity to practice and refined their design technique by writing code as required by the programming assignments.

Writing a testbench is as complex as writing the RTL code itself. These days ASICs are getting more and more complex and thus verifying these complex ASIC has become a challenge. Typically 60-70% of time needed for any ASIC is spent on verification/validation/testing. Even though the above facts are well known to most ASIC engineers, still engineers think that there is no glory in verification.

CODE FOR COUNTER

 //-----------------------------------------------------  2 // Design Name : counter  3 // File Name : counter.v  4 // Function : 4 bit up counter  5 // Coder : Deepak  6 //-----------------------------------------------------  7 module counter (clk, reset, enable, count);  8 input clk, reset, enable;  9 output [3:0] count;  10 reg [3:0] count;  11  12 always @ (posedge clk)  13 if (reset == 1'b1) begin  14 count <= 0;  15 end else if ( enable == 1'b1) begin  16 count <= count + 1;  17 end  18  19 endmodule 
 //-----------------------------------------------------  2 // Design Name : counter  3 // File Name : counter.v  4 // Function : 4 bit up counter  5 // Coder : Deepak  6 //-----------------------------------------------------  7 module counter (clk, reset, enable, count);  8 input clk, reset, enable;  9 output [3:0] count;  10 reg [3:0] count;  11  12 always @ (posedge clk)  13 if (reset == 1'b1) begin  14 count <= 0;  15 end else if ( enable == 1'b1) begin  16 count <= count + 1;  17 end  18  19 endmodule 

TEST PLAN

We will write a self-checking test bench, but we will do this in steps to help you understand the concept of writing automated test benches. Our testbench environment will look something like the figure below.

TEST CASES

  • Reset Test : We can start with reset de-asserted, followed by asserting reset for few clock ticks and deasserting the reset, See if counter sets its output to zero.
  • Enable Test : Assert/deassert enable after reset is applied.
  • Random Assert/deassert of enable and reset.

: Design means RTL code and Testbench covering all possible corner cases)

                               always@(state)

                               begin

                                        case(state)

                                      2’b00: B = 5;

                                         2’b01: B = 3;

                                      2’b10: B = 0;

                                        endcase

                               end


Related Solutions

Design and write a verilog code and testbench for a 16-bit RISC MIPS Processor on vivado...
Design and write a verilog code and testbench for a 16-bit RISC MIPS Processor on vivado and show waveform.
using verilog to design a 8x8 unsigned multiplier(with testbench) utilizing a 2x8 multiplier as a building...
using verilog to design a 8x8 unsigned multiplier(with testbench) utilizing a 2x8 multiplier as a building block here is the testbench and code for 2x8: module cpp_mult(mplr,mcand, prod); input [1:0] mplr; input [7:0] mcand; output [9:0] prod; wire [9:0] mcand1; wire [9:0] mcand2; wire [9:0] mcand3; assign mcand0 = 10'b00000000; assign prod = (mplr==2'b00)?mcand0 :        ((mplr==2'b01)?{2'b00,mcand[7:0]}:        ((mplr==2'b10)?{1'b0,mcand[7:0],1'b0}:        ((mplr==2'b11)?{2'b00,mcand[7:0]}+{1'b0,mcand[7:0],1'b0}:8'hxx))); endmodule ____________________________________________________________________ module cpp_mult_tb(); reg [1:0] mplr; reg [7:0] mcand; wire [9:0] prod; // Instantiate the...
Design an 8-bit adder. Show Verilog code and testbench.
Design an 8-bit adder. Show Verilog code and testbench.
Please answer both the questions. 1 a) Design two bits comparators using Verilog description language Note:...
Please answer both the questions. 1 a) Design two bits comparators using Verilog description language Note: Design means RTL code and Testbench covering all possible corner cases) b) How many latches will result when the following code is synthesized? Assume B is 4-bits long.                                always@(state)                                begin                                         case(state)                                       2’b00: B = 5;                                          2’b01: B = 3;                                       2’b10: B = 0;                                         endcase                                end
Write a Huffman decoder in verilog that inputs a text file with testbench.
Write a Huffman decoder in verilog that inputs a text file with testbench.
Write a verilog code for 8-bit signed multiplication using Booth algorithm and represent the RTL view...
Write a verilog code for 8-bit signed multiplication using Booth algorithm and represent the RTL view for code
Verilog counter problem: Using the attached 4-bit up-counter module and testbench as a template, write a...
Verilog counter problem: Using the attached 4-bit up-counter module and testbench as a template, write a Verilog module that implements a certain 4-bit counter. The module should include two more input variables: “updown” and “count2”. If “updown” is 1, the circuit should count up (by 1s); if it is 0 it should count down (by 1s). If “count2” has a value of 1, the circuit should instead count up by 2s; otherwise it will have no effect (the circuit counts...
Verilog counter problem: Using the attached 4-bit up-counter module and testbench as a template, write a...
Verilog counter problem: Using the attached 4-bit up-counter module and testbench as a template, write a Verilog module that implements a certain 4-bit counter. The module should include two more input variables: “updown” and “count2”. If “updown” is 1, the circuit should count up (by 1s); if it is 0 it should count down (by 1s). If “count2” has a value of 1, the circuit should instead count up by 2s; otherwise it will have no effect (the circuit counts...
Write down the VERILOG code for an XOR gate and the testbench code to test it
Write down the VERILOG code for an XOR gate and the testbench code to test it
Digital System Design Write the verilog HDL code for 2-4 decoder (Gate level modeling) along with...
Digital System Design Write the verilog HDL code for 2-4 decoder (Gate level modeling) along with the testbench and simulate using ModelSim. Upload the assignment (i) code (ii) testbench (iii) simulation in single pdf file.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT