Question: Can you help me code problem 1 and 2 . To compile your code and run the testbench press F 9 in an Emacs buffer

Can you help me code problem 1 and 2.
To compile your code and run the testbench press F9 in an Emacs buffer in a properly set up
account. The testbench will apply inputs to several instantiations of modules pmatch_base and
pmatch_mark. The instantiations differ in the length of the string. At the end of execution the
number of errors for each module at each size are shown. The output below is from a correctly
solved assignment:
Total pmatch_base n=4: Errors: 0cl,0op,0mk.
Total pmatch_base n=5: Errors: 0cl,0op,0mk.
Total pmatch_base n=7: Errors: 0cl,0op,0mk.
Total pmatch_base n=8: Errors: 0cl,0op,0mk.
Total pmatch_base n=9: Errors: 0cl,0op,0mk.
Total pmatch_base n=17: Errors: 0cl,0op,0mk.
Total pmatch_mark n=4: Errors: 0cl,0op,0mk.
Total pmatch_mark n=5: Errors: 0cl,0op,0mk.
Total pmatch_mark n=7: Errors: 0cl,0op,0mk.
Total pmatch_mark n=8: Errors: 0cl,0op,0mk.
Total pmatch_mark n=9: Errors: 0cl,0op,0mk.
Total pmatch_mark n=17: Errors: 0cl,0op,0mk.
Each line starting with Total shows a tally of results. After Total the line shows the module name,
either pmatch_base or pmatch_mark, and n, the length of the string. A tally of each output's error
is shown after Errors:, cl is the number of incorrect closing-parentheses values, op is the number
of opening-parenthesis values, and mk is the number of incorrectly marked strings.
Further up, the testbench shows sample output and error details. For each instantiation the
first n_errors_show =5 incorrect outputs are shown on lines starting with Error. If it would
help to see more then feel free to search for n_errors_show and increase the value. In addition the
details of the first n_samples_show =6 correct outputs are shown on lines starting with Sample.
The output below shows correct outputs:
Starting pmatch_base tests for n=5.
Sample pmatch_base n=5'()': close =0, open =0(both correct)
Sample pmatch_base n=5'.()': close =0, open =0(both correct)
Sample pmatch_base n=5')(': close =1, open =1(both correct)
Sample pmatch_base n=5')': close =1, open =0(both correct)
Sample pmatch_base n=5'))': close =2, open =0(both correct)
Sample pmatch_base n=5'()))': close =2, open =0(both correct)
Sample pmatch_base n=5'())(': close =1, open =1(both correct)
Sample pmatch_base n=5'())((': close =1, open =2(both correct)
Sample pmatch_base n=5'))((': close =2, open =2(both correct)
In the sample above the first Error line indicates that for input () both the left_out_n_unmat_close
and right_out_n_unmat_open outputs were 0, which is correct because there were no unmatched
parentheses. The second sample is also properly matched. It consists of parentheses, a dot (which
is just an ordinary character), and spaces. The third sample has both one unmatched opening
parenthesis and an unmatched closing parenthesis.
The testbench starts applying patterns found in str_special. Feel free to add your own to
help with debugging. After the patterns in str_special are used the testbench will make up
random patterns.
The output below is of a run using a partially correct pmatch_base:
The testbench starts applying patterns found in str_special. Feel free to add your own to
help with debugging. After the patterns in str_special are used the testbench will make up
random patterns.
The output below is of a run using a partially correct pmatch_base:
Sample pmatch_base n=5'()': close =0, open =0(both correct)
Sample pmatch_base n=5'.()': close =0, open =0(both correct)
Sample pmatch_base n=5')(': close =1, open =1(both correct)
Sample pmatch_base n=5')': close =1, open =0(both correct)
Error pmatch_base n=5'))': close 0!=2(correct)
Sample pmatch_base n=5'()))': close =2, open =0(both correct)
Error pmatch_base n=5'))((': close 0!=2(correct)
Error pmatch_base n=5'))': close 0!=2(correct)
The errors reported above seem to show that the left_out_n_unmat_close is wrong when the
string starts with two consecutive opening parentheses.
The str_marked output of module pmatch_mark is supposed to show the string with the cor-
rectly matched parentheses replaced by angle brackets (actually less-than and greater-than sym-
bols). Appearing below is sample output of the module in a correctly solved assignment. Two lines
are used to show the result of each input. The first shows the input string, such as () in the first
sample, the second line shows the marked string, such as >.
Sample pmatch_mark n=5'()': close =0, open =0(both correct)
Sample pmatch_mark n=5'>,(marked_outpuut)
Sample pmatch_mark n=5'.()': close =0, open =0(both correct)
Sample pmatch_mark n=5'.>'(marked_outpuut)
Sample pmatch_mark n=5')(': close =1, open =1(both correct)
Sample pmatch_mark n=5')('(marked_outpuut)
Sample pmatch_mark n=5')': close =1, open =0(both correct)
Sample pmatch_mark n=5'),(marked_outpuut)
Sample pmatch_mark n=5'))': close =2, open =0(both correct)
Sample pmatch_mark n=5')),(marked_outpuut)
Sample pmatch_mark n=5'()))':
5 of 6
Problem 1: Module pmatc
S
Can you help me code problem 1 and 2 . To compile

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!