hw07_SLN

# hw07_SLN - ECE 212 HW 7 SOLUTIONS p 1 of 14...

This preview shows pages 1–4. Sign up to view the full content.

ECE 212 HW 7 SOLUTIONS p 1 of 14 //home/vdimitrov/25650/ea4fd562d41715ce0642f1e09d0a68a5cc69bedd.doc ECE 212 Homework Set 7 SOLUTIONS 1. (a) Express the infix expression ( ( A + B ) ( C + D ) ) ( E + F + ( ( G H ) ( J K ) ) ) in Reverse Polish Notation. (b) Is your answer unique? If not, give a different but equivalent RPN expression. Solution: (a) One answer: A B + C D + E F + G H J K + (b) No, the answer is not unique. Another expression is C D + A B + E F + G H J K + There are many other equivalent expressions.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
ECE 212 HW 7 SOLUTIONS p 2 of 14 2. (a) Obtain the infix equivalent for the RPN expression A B C D E F + · + · (b) How many values must the stack hold when evaluating the above expression? (c) Write an RPN expression which is equivalent to that in part (a) but which can be evaluated using a stack with at most four levels. (d) If an RPN expression contains N numerical values (or variables), then how many operations must it contain (assuming that each operation requires two values)? Solution: (a) ( ( ( (E + F ) · D ) C ) + B ) · A (b) The stack must hold A, B, C, D, E, F; the stack must hold 6 values. (c) E F + D · C B + A · To evaluate this expression, the stack must be 2 levels deep. (d) With N variables, there must be ( N – 1 ) (2-operand) operations.
ECE 212 HW 7 SOLUTIONS p 3 of 14 3. A push-down stack has the specification: Inputs: X 4-bit data. Push 1-bit control input. Pop 1-bit control input. clock Outputs: Z 4-bit data (the top of the stack). Ready The system is ready to receive an input command. Stack Depth: 4 values. Operation: do forever { Ready = 1; If Push = 1 (at a clock edge ) Ready = 0; Push the X data onto the stack; If Pop = 1 ( at a clock edge ) Ready = 0; Pop the stack; } Push and Pop will never be 1 simultaneously. A Data Path and Control Circuit appear below (over). The Data Path contains four registers for the stack contents; register A contains the data at the top of the stack. The Data Path also contains a 5-to-1 bus multiplexer. (a)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 14

hw07_SLN - ECE 212 HW 7 SOLUTIONS p 1 of 14...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online