Scripting Languages and Verification Lab (Winter Sem 2014-15) 14MVD0123 14MVD0106
SCRIPTING LANGUAGES AND VERIFICATION LAB LAB REPORT
EXPT 2: WRITE A PERL PROGRAM TO GENERATE A TEST BENCH FOR A GIVEN VERILOG CODE
Aditya Vibhute 14MVD0123
1
Scripting Languages and Verification Lab (Winter Sem 2014-15) 14MVD0123 14MVD0106
EXP 2: WRITE A PERL PROGRAM TO GENERATE A TEST BENCH FOR A GIVEN VERILOG CODE
OBJECTIVE: Write a PERL Program to Generate a Test bench for a given Verilog Code.
DESCRIPTION: Keywords and Functions: 1. 2. 3. 4.
print: To print the required data. for: for loop; used for terminating running of the program after a specified limit rand: this function returns random values between user defined range. while: while loop is used to run a piece of code until the condition remains true, as soon as the condition becomes false, program terminates/comes out of the loop. 5. if: program will be executed if the specified condition is true. 6. split: this function is used to split the string of characters. Sometimes a specified delimiter is used to make divisions in between the string. 7. foreach: it is similar to for loop. Foreach helps us to check whether element of the list stored in an array variable is given word.
CODE (Combinational Circuit):
#!usr\bin\perl open OUT,">fulladd_tb.v"; open IN,"fulladd.v"; $test_vector=9; while($a=) { if($a=~/module\s(\w+)\((.*)\)\;/) { $name=$1; $portlist=$2; } if ($a=~/input\s+(.*)\;/) { $input=$1; @b=split/,/,$input; $k=@b; }
2
Scripting Languages and Verification Lab (Winter Sem 2014-15) 14MVD0123 14MVD0106
Thank you for interesting in our services. We are a non-profit group that run this website to share documents. We need your help to maintenance this website.