The module will have the following input data: a - 8 bits b - 32 bits compare - 1 bit change - 3 bits The module will have the following output data: compare_out - 2 bits return_out - 16 bits select_out - x bits, where x represents the minimum number of bits needed to calculate the sum of positions containing 0 bits from a Initially, the compare_out and return_out outputs will have all bits set to "1". The select_out output will be independent of module stimuli and will calculate the sum of positions containing 0 bits from a. The module reacts only to inputs a, b, and return. The compare_out output changes only when compare is 1'b1; otherwise, it will remain at its previous value (for this subpoint, the use of the decision operator is desired). If compare is 1, the compare_out output: Will be 10 if the most significant 8 bits of b are less than a Will be 00 if the most significant 8 bits of b are greater than a Will be 01 if the most significant 8 bits of b are equal to bus a The return_out output will only be modified when change has a value different from 3'b111. If change is equal to 3'b100, then the return_out output will be equal to the bus formed by the least significant bits of a and b. If change is equal to 3'b001, then the return_out output will be equal to the bus formed by the most significant bits of a and b. If change is equal to 3'b101, then the return_out output will be equal to the bus formed by a and the least significant bits of b. If change is equal to 3'b011, then the return_out output will be equal to the bus formed by a and the most significant bits of b. If change is equal to 3'b000, then the return_out output will be equal to the bus formed by a and a. If change is equal to 3'b010, then the return_out output will be equal to the bus formed by the least significant bits of b and the most significant bits of b. For any other value of the change input, the return_out output will have a value equal to the bus formed by the least significant 16 bits of b negated. 3. Create the corresponding testbench for the module from exercise 2 using the decision table test technique, and explain the chosen cases.

Berger wrote: > How to do this pleaseYoumust start with something, and when you encouterspecificproblems,thenyou can ask. BTW: if this simple tasks gets you into big problems then maybe you should work out the very basics once more. And for next time: give your thread a much more meanigful headline. A big lot of threads could be titeld "How to do this?"

Moin, Jean Paul Gaultier had pretty much the same problem back in the 80s/early 90s: "Aow tou dou zat?" And iirc the text correctly, one of the solutions he stated was: Bring some - bring some - technic idea... scnr, WK

:
Edited by User

Here a suggestion in LISP:

1 | ;; Helper function to calculate the sum of positions containing 0 bits from a |

2 | (defun sum-of-positions-0 (a) |

3 | (loop :with sum = 0 |

4 | :for i :from 0 :below 8 |

5 | :when (= 0 (logand 1 (ash a i))) |

6 | :do (incf sum (ash 1 i)) |

7 | :finally (return sum))) |

8 | |

9 | ;; Function to calculate the compare_out, return_out, and select_out |

10 | (defun module (a b compare change) |

11 | (let* ((compare-out 3) ; all bits set to "1" initially |

12 | (return-out #xFFFF) ; all bits set to "1" initially |

13 | (select-out (sum-of-positions-0 a))) ; calculate select_out |

14 | |

15 | ;; Compare_out logic |

16 | (when (= compare 1) |

17 | (cond ((< (ash b -24) a) (setf compare-out 2)) |

18 | ((> (ash b -24) a) (setf compare-out 0)) |

19 | ((= (ash b -24) a) (setf compare-out 1)))) |

20 | |

21 | ;; Return_out logic |

22 | (unless (= change 7) |

23 | (cond ((= change 4) (setf return-out (logior (logand a 255) (logand b #xFFFFFFFF)))) |

24 | ((= change 1) (setf return-out (logior (ash a 24) (logand b #x00FFFFFF)))) |

25 | ((= change 5) (setf return-out (logior (ash a 16) (logand b #xFFFF)))) |

26 | ((= change 3) (setf return-out (logior (ash a 16) (logand b #xFFFF0000)))) |

27 | ((= change 0) (setf return-out (logior (ash a 16) a))) |

28 | ((= change 2) (setf return-out (logior (logand b #xFFFF) (ash b 16)))) |

29 | (t (setf return-out (lognot (logand b #xFFFF)))))) |

30 | |

31 | ;; Return the results as a list |

32 | (list compare-out return-out select-out))) |

33 | |

34 | ;; Test cases using decision table test technique |

35 | (defun test-case (a b compare change) |

36 | (format t "Test Case: ~A ~A ~A ~A~%" a b compare change) |

37 | (let ((result (module a b compare change))) |

38 | (format t "Compare_out: ~A~%" (first result)) |

39 | (format t "Return_out: ~A~%" (second result)) |

40 | (format t "Select_out: ~A~%" (third result)) |

41 | (format t "~%"))) |

42 | |

43 | ;; Generate and run test cases |

44 | (defun generate-test-cases () |

45 | (dolist (a '(0 1 2 255)) |

46 | (dolist (b '(0 1 2 4294967295)) |

47 | (dolist (compare '(0 1)) |

48 | (dolist (change '(0 1 2 3 4 5 6 7)) |

49 | (test-case a b compare change)))))) |

50 | |

51 | ;; Run the test cases |

52 | (generate-test-cases) |

:
Edited by User

- "I don't have any clue how to do this, and I need it until next week" - "That's easy. There are many electronics forums across the web. Post it into some of them. Possibly there will be an idiot writing the code for you. Learn early how to let others make your job. And don't spent any time with responding to comments. You want code, not smalltalk, right?" - "But if they don't answer, I have to do it by myself." - "No. In this case you will try another forum or ask chatGPT. You still did not get the point completely. The reason why you become an engineer is to earn money, not to work as an engineer. So don't waste time with learning a programming language or such silly stuff." - "Sure, great. Let me just do that and then go to gaming party."

**Please log in before posting. Registration is free and takes only a minute.**

**Existing account**

**No account?**Register here.