Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Legal Assignments Vs Illegal Assignments Confirm that the statements below are l

ID: 2989776 • Letter: L

Question

Legal Assignments Vs Illegal Assignments

Confirm that the statements below are legal (see main causes of mistakes in section 3.19).

a) s2(7) <= s1;
b) s3 <= s4(0);
c) s2 <= v1 XOR "10001000";
d) s5 <= v2/2;
e) s3 <= 'Z';
f) s2 <= (OTHERS=>'0');
g) v2 := 35;
h) v1 := "11110000";

And Explain why the assignments below are illegal (see main causes of mistakes in section 3.19).

a) s1(0) <= s2(0);
b) s3 <= s1 OR s2(2);
c) s2 <= (8=>'0', OTHERS=>'Z'); d) v2 <= -35;
e) s3 := 'Z';
f) s2(7 DOWNTO 5) <= v1(3 DONWTO 0) OR "1000";
g) v1(7) <= s1 AND s2(0);
h) s4(0) <= s2(0);

Legal versus Illegal Assignments Below is a summary of the most common mistakes made when assigning values to array type objects. In short, most mistakes fall in one (or more) of the causes listed below. A subsequent example illustrates the occurrence of such problems. Cause 1: Type mismatch (both sides of the assignment must be of the same type or of the same base type). Example: One side is BIT; the other is BOOLEAN. Cause 2: Size mismatch (both sides of the assignment must have the same number of bits or a predefined number of bits). Example: One side has 8 bits; the other has 4. Cause 3: Invalid value or invalid representation. Examples: BIT does not accept the value 'Z'; an integer cannot be represented with quotes; a bit vector requires double quotes. Cause 4: Incorrect indexing (the order and the range limits must be obeyed). Examples: The order (ascending or descending) of the index is reversed; the index values fall outside the actual range. Data Types 79 Cause 5: Incorrect assignment operator ("

Explanation / Answer

Confirm that the statements below are legal (see main causes of mistakes in section 3.19).

a) s2(7) <= s1;its legal
b) s3 <= s4(0);its legal
c) s2 <= v1 XOR "10001000";its legal
d) s5 <= v2/2;its legal
e) s3 <= 'Z';its legal
f) s2 <= (OTHERS=>'0');its illegal;
g) v2 := 35;its legal
h) v1 := "11110000";its legal

And Explain why the assignments below are illegal (see main causes of mistakes in section 3.19).

a) s1(0) <= s2(0);illegal due to invalid representation(ie) s1 cannot be represent by array
b) s3 <= s1 OR s2(2); Type mismatch
c) s2 <= (8=>'0', OTHERS=>'Z'); invalid representation

d) v2 <= -35;Incorrect assignment oprator
e) s3 := 'Z';Incorrect assignment oprator
f) s2(7 DOWNTO 5) <= v1(3 DONWTO 0) OR "1000";size mismatch;
g) v1(7) <= s1 AND s2(0);;Incorrect assignment oprator
h) s4(0) <= s2(0);type mismatch;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote