3.6 Exercises
-
Write a code segment that contains just one statement to import file basic_types.e.
-
Determine which comments in the following piece of e code are written correctly. Circle the comments that are written incorrectly.
<' Import the basic test environment for the CPU... import cpu_test_env; '> This particular test requires the code that bypasses bug#72 as well as the constraints that focus on the immediate instructions. <' /*Import the bypass bug file*/ import bypass_bug72; //Import the cpu test file_0012 import cpu_test0012; --Import the cpu test file_0013 import cpu_test0013; '>
-
Practice writing the following numbers. Use _ for readability.
-
Decimal number 123 as a sized 8-bit number in binary
-
A 16-bit hexadecimal with decimal value 135
-
An unsized hex number 1234
-
64K in decimal
-
64K in e
-
-
Name the predefined constants in e.
-
Write the correct string to produce each of the following outputs.
-
“This is a string displaying the % sign”
-
“out = in1 + in2 \\”
-
“Please ring a bell \t”
-
“This is a backslash \ character\n”
-
-
Determine whether the following identifiers are legal:
-
system1
-
1reg
-
~latch
-
@latch
-
exec[
-
exec@
-
-
Define a macro LENGTH equal to 16.
-
Declare the following fields in e.
-
An 8-bit unsigned vector called a_in
-
A 24-bit unsigned vector called b_in
-
A 24-bit signed vector called c_in
-
An integer called count
-
A time field called snap_shot
-
A string called l_str
-
A 1-bit field called b
-
-
Declare an enumerated type called frame_type. It can have values SMALL and LARGE. Declare a field called frame of this enumerated type.
-
Write the following actions with simulator variables.
-
Assign the value of simulator variable top.x1.value to len field in e.
-
Write the value 7 to the simulator variable top.x1.value.
-
-
Describe the four levels of e syntax hierarchy. Identify three keywords used at each level of the hierarchy.