Implementing bit-intensive programs in StreamIt/StreamBit 1. Writing Bit manipulations using the StreamIt language with StreamBit Compiler

Size: px
Start display at page:

Download "Implementing bit-intensive programs in StreamIt/StreamBit 1. Writing Bit manipulations using the StreamIt language with StreamBit Compiler"

Transcription

1 Implementing bit-intensive programs in StreamIt/StreamBit 1. Writing Bit manipulations using the StreamIt language with StreamBit Compiler The StreamIt language, together with the StreamBit compiler, allows for a very different development process from a traditional language like C. Instead of having the algorithm and implementation encoded in a complex piece of code which you have to test and debug every time you want to try a different implementation strategy, the StreamBit compiler allows you to write your code once, at a high level of abstraction, and without having to worry about performance. Once your code has been written, the compiler allows you to suggest performance improving transformations which may be specific to a particular machine and a particular program, without letting you introduce errors in the program. For the contest, you will only have to write the high level StreamIt description. The rest of the document will explain everything you need to know in order to do this. It will cover the basics of StreamIt, as well as some of the limitations of the current implementation. Before you proceed, it is recommended that you install the StreamBit compiler so you can follow along the examples. You can download Windows/Cygwin binaries for the compiler from Or you can use it from any eecs research account on either an x86/linux or an IA64/Linux machine. To do this, simply type $ source ~asolar/install_sbit.sh from a command prompt. After that, you can compile your programs typing $ compilesbit.sh yourfile.str This will generate a C code that implements your program. You can then run the command: $ runprog yourfile.str To generate a harness that will call the C code, and then it will compile it and run it, so you can see the results of your program. 1

2 1.1. The basics of StreamIt The StreamBit system uses StreamIt as its input language. StreamIt is a dataflow language that was developed at MIT by Thies et. al., and it builds on some of the research on synchronous dataflow that was done at Berkeley in the 1980s by Edward Lee s group. The main unit of abstraction in StreamIt is the filter. A filter reads data from an input stream and writes it into a FIFO output stream. Additionally, as a consequence of being a synchronous dataflow language, all filters must specify their input and output rate statically, which enables the compiler to schedule filter execution statically at compile time. Statically declared input and output rates Input and output type of the filter bit->bit filter DropThird{ work pop 3 push 2{ push( pop() ); push( pop() ); pop(); Work function defines the behavior of the filter... For the particular subset of StreamIt that we handle, filters can be aggregated into splitjoins and pipelines. A pipeline is simply a sequence of filters that are linked together so the output of filter i becomes the input of filter i+1. bit->bit pipeline PL{ add A(); add B(); add C(); A splitjoin contains a splitter which takes the input stream and distributes it among its N children, and then a joiner that takes the output of the N filters and merges it in a predefined way. We currently support two different types of splitters: roundrobin splitters and duplication splitters. The duplication splitters, as their name implies, simply pass identical copies of their input to all the filters in the splitjoin. The roundrobin splitters, on the other hand, distribute the bits from the input to the individual filters in a roundrobin fashion. For the join points, we support two major classes of joiners, roundrobin joiners and aggregation joiners. The aggregation joiners read bits from each of the branches of the splitjoin and aggregate them to produce a single bit by using either the AND, OR or XOR operators; hence we distinguish three types of such joiners, one for each operator. The semantics of roundrobin joiners are very similar to those of the roundrobin splitters; they PL A B C 2

3 read bits in a roundrobin fashion from all the filters in the splitjoin and write them to the output. bit->bit splitjoin SJ{ split roundrobin(1,1,1); add A(); add B(); add C(); join roundrobin(1,1,1); A Split roundrobin(1,1,1) B C Join roundrobin(1,1,1) A Split roundrobin(1,1,1) B Join xor() C bit->bit splitjoin SJ{ split roundrobin(1,1,1); add A(); add B(); add C(); join xor(); ( xor xor ) Both splitjoins and pipelines involve implicit scheduling and buffer management. For example, if Filter A is defined to produce 5 bits, but Filter B transforms blocks of 6 bits, you can simply define the two filters separately and compose them in a pipeline, without having to worry about how to interleave the executions of filters A and B, or how much buffer space to allocate to store the results of A before B can read them. You can find some more examples of the use of pipelines and splitjoins, along with all the exercises described in this tutorial at: A Word on Native Filters The StreamBit compiler focuses on bit level manipulations, so we concentrate on filters that have input and output streams of type bit. Additionally, we need to be able to convert 3

4 the code into a Boolean expression, so we require that all loops have fixed number of iterations and that the number of bits read and the number of bits pushed or popped from the input/output streams can be determined at compile time. Finally, we don t allow such filters to have state. Our system also allows the user to write filters that do not adhere to the restrictions above. For example, filters that produce integers instead of bits, or filters that have state. We call these native filters, and their only requirement is that they push and pop exactly the declared number of data items into their streams; however, we only allow sketching for filters that satisfy the constraints mentioned above. Such native filters will be very useful, both to generate input for your program, and to produce debug output. As an example, consider the program: void->void pipeline testnatives{ add void->int filter { work push 2{ printf( Creating Input\n ); push( 0x0F0F0F0F ); push( 0xF0F0F0F0 ); add int->void filter { work pop 1{ int x = pop(); printf( Got %x\n, x); printb( x ); This program has only native filters. One is a void->int filter that produces bits, and the other one is an int->void filter that reads them. If you compile and run this program with: $ compilesbit.sh testnatives.str $ runprog.sh testnatives.str The first few lines of output will look like this: Creating Input Got f0f0f0f Got f0f0f0f Creating Input Got f0f0f0f Got f0f0f0f Filter is going to push two integers and will not pop anything In a native filter you can use printf just like in C Pipeline will take care of scheduling the two filters, so the mismatch in the input and output rates of the two filters is not a problem printb allows you to print integers bit by bit. 4

5 Note that because of the scheduling, the second filter executes twice for each time the first one executes Coding Bit manipulations in StreamIt Permutations Permutations play a very important role in bit manipulation tasks. In StreamIt, a permutation can be easily implemented in a filter. Within a filter, you can use the peek function to access a particular bit in the stream, and push it into the output. Examples: All the following are examples of permutations. Permutations can also be represented by matrices, where the input bits are multiplied as a vector with a matrix to produce the output bits. A filter to drop every third bit: bit->bit filter DropThird{ work pop 3 push 2{ push( pop() ); push( pop() ); pop();... A filter to reverse a 32 bit block: bit->bit filter Reverse{ work pop 32 push 32{ for(int i=0; i<32; ++i){ push( peek(31-i ) ); A filter to apply a permutation given by the list of numbers [4,1,2,3,0,5] bit->bit filter Arbitrary{ work pop 6 push 6{ int [6] X={4,1,2,3,0,5; for(int i=0; i<6; ++i) push( peek( X[i] ) ); for(int i=0; i<6; ++i) pop(); 1 1 The StreamIt language requires that you call pop as many times as you declared that you are going to pop. However, the StreamBit compiler does not require this. As long as you don t try to pop more than you declared, the compiler will add the necessary additional pops for you. 5

6 Exercise: Use the Filters provided in permutation.str to write the following program. You want to have a pipeline with the filters in the following order: Generate -> Shuffle -> Read The filters Generate, IntToBit, BitToInt and Read are already provided for you. You have to write Shiffle to satisfy the following specification. Shuffle must shuffle a block of 16 bits based on the following list of numbers. Shuffle := [11, 3, 15, 7, 10, 2, 14, 6, 9, 1, 13, 5, 8, 0, 12, 4]; This means that the first bit of the output will be bit 11 from the input, the second bit of the output will be bit 3 from the input, and so forth. After you compile and run the program, it should print the following list of numbers: Arbitrary Boolean Functions The filters can represent any arbitrary boolean mapping from the input to the output. However, the StreamBit compiler requires filters that take in bits and generate bits have to adhere to certain restrictions. In particular: - The number of push and pop statements must be independent of the input, and the compiler must be able to determine at compile time that you will not push or pop more bits than what you stated in the work declaration. o A corollary of this restriction is that if the argument to an if statement depends on the input then there must be the same number of push and pops on each branch. o Another corollary is that the number of iterations in a loop can not depend on a value that was popped from the stream if the loop body contains push or pop statements. - Filters that transform bits can not have state. Exercises: Using the filters in BoolFilterPL.str, you want to have a pipeline with the filters in the following order: Generate -> BoolFilter -> Read Where BoolFilter takes in 4 bits and produces 2 bits according to the following Boolean functions: Output[0] = (Input[1] and Input[2]) xor (Input[0] or Input[3]); Output[1] = (Input[2] or Input[3]) and Not( Input[2] and Input[1] ); 6

7 After running the filter you should get a list of numbers starting with Note: In the current version of StreamIt allows you to use most of the C bitwise operators on the bit data-types. These include &,, and ^. If you want to negate something, you have to xor it with 1. Also, you can NOT use the boolean operators &&, and! on bit data-types. The StreamBit compiler is a little more lenient, so it will allow all the operators mentioned above. Merging Streams As you saw in the StreamIt tutorial, splitjoins can be very useful when you have a stream, and you want to perform a different action with different elements of the stream. However, splitjoins can also be useful when you want to merge two streams together. In order to do this, you can use a splitjoin with a roundrobin splitter that passes zero bits to the filter producing the bits you want to merge. Example: Suppose you want to write a filter called Interleave, which takes an input stream, and between every bit, interleaves the bits generated by filter Gen which takes zero bits as input, and generates some bits every time it is fired. This can be done with the following code; the complete exaple is in merging1.str: bit->bit splitjoin Interleave{ split roundrobin( 1, 0); add Identity(); add Gen(); join roundrobin( 1, 1); Example: Suppose that instead of interleaving the bits, you want to AND the bits generated by Gen into the input stream. Then, all you have to do is use an AND joiner instead of a roundrobin: bit->bit splitjoin Interleave{ split roundrobin( 1, 0); add Identity(); add Gen(); join and(); 7

8 Try replacing this Interleave for the original Interleave in merging1. The result should be a list of numbers 1, 2,. You can also try it with different operators (i.e. OR or XOR joins). Representing Complex networks using splitjoins In some cases, the task may require a more complex interconnection pattern than what splitjoins offer. However, it is generally possible to achieve these interconnection patterns by combining several splitjoins with some permutations in between. Example: Consider the following example. You have a 32 bits wide block and you want to pass the Right Half (R), to filter R1, and the Left Half (L) to filter L1. Then you want to Xor L1(L) with R and R1(R) with L, and pass those quantities through L2 and R2 respectively to get the result. The process is shown in the figure. This can actually be implemented using splitjoins as follows. First, pass the complete block LR through a filter FDup that makes two copies of it. Then, pass it through a roundrobin splitter that takes one of the L s through L1, and the other one through an Identity filter, and similarly with R. After a roundrobin joiner, the result will be a block of the form [ L1(L), R, L, R1(R)]. That block can then be given to a filter FCombine that takes in 32 bit blocks (the size of [ L1(L), R] or [L, R1(R)]), and xors the first 16 bits with the second 32 bits. Finally, this can be passed to a roundrobin filter that applies L2 and R2, and the result will be the same as the network in the first figure, but using only what is provided in StreamIt. 8

9 Table Filters In many cases, a filter is best described as a mapping from input bits to output bits expressed as a table. The current StreamBit compiler allows you to express this through the use of sbox filters. The term sbox comes from the substitution boxes present in many public key ciphers. Example: A filter that takes in 3 bits, and it s output consists of 4 bits defined by the following table { 0xF, 0xE, 0x1, 0x3, 0x6, 0xA, 0xB, 0xC. This means that if the three input bits are 010, then we interpret them as 2, and we return the 4 bits corresponding to entry 2 in the table, which is bit->bit sbox test{ int[8] X = {0xF, 0xE, 0x1, 0x3, 0x6, 0xA, 0xB, 0xC; int input_rate=3; int output_rate=4; The rest of the example is in TestSbox.str. Note: If you are participating in the contest, this is all the information you need to know in order to complete the programming task. However, if you are interested in how to improve the performance of your application through sketching, read on. 9

10 1.3. Optimizing your Program One of our goals is to allow the programmer to write code without having to worry at all about performance. As we saw before, in languages like C, the goal of high performance often conflicts with the goal of having code that is easy to read and understand. The StreamBit compiler solves this problem by allowing you to tell the compiler to do many transformations that you would otherwise have to do yourself by hand (potentially making your code hard to read), and which you can t always trust a compiler to do well on its own given how unpredictable their effects on performance can be. The Optimization Specification Language In order to express the changes you want the compiler to make on your program, you can use the Optimization Specification Language. The language has three main components. First, there are rudimentary control structures, mainly for loops, along with basic integer arithmetic. Second, there is a simple mechanism for accessing any filter within your program. Finally, there is a set of transformations which can transform a filter in your program based on a complete or partial specification. The control structures In its current form, the language only provides a for loop construct, with syntax similar to the loops in java or C. In addition, the language provides basic integer arithmetic, including addition, subtraction, and multiplication, as well as basic Boolean operators. Variables don t have to be declared, and can be used as needed. The filter paths The language allows you to access any filter within your program by using a filter path. For the top level filter, the one that represents the complete program, the filter path will simply be the filter s name. For all other filters, the filter path will be the parent s filter path, followed by a dot, followed by their name. A filter s parent is the pipeline or splitjoin that contains it. If the path is ambiguous, for example because there are two filters with the same name in a pipeline, or if you want to access the filters in a pipeline using a loop, you can use the method filter(int i), to access the ith filter in a pipeline or a filter without using it s name. The Functions The most important piece of the Optimization specification language is a set of 10 Transformation functions and two display functions that can be combined to achieve a very large number of different optimizations. 10

11 Unroll[N](Filter); Copies the body of a filter N times, so the new filter will now take in N times as many bits as before and produce N times more bits as well. Useful for getting the size of the filter to be a multiple of the word size. ColSplit[sizelist](Filter); Takes in a filter, and splits it into a splitjoin of several smaller filter. Each new filter will produce the same number of bits as the original one, but they will each take only a fraction of the original bits. If no sizelist is given, the new filters will take in W bits, where W is the width of a word. If a sizelist is given, it will consist of a list of numbers, where the kth number will correspond to how many bits the new filter k will take in, and the sum of all numbers must equal the inputs size of the original filter. RowSplit[sizelist] (Filter); Similar to ColSplit described above, except in this case, the new filter will take in a filters will take in the same a complete copy of the input bits and will produce only a subset of the output bits. As before, if no seizelist is provided, the output sizes will be equal to W, the word size. DiagSplit(Filter); When you have a filter that takes in several words of input and produces the same number of words of output, and the nth word of output depends only on the nth word of input, you can use DiagSplit to break your filter into several independent filters, each taking one word in and producing one word out. SRRtoDUP(Filter); Takes in a splitjoin with a roundrobin splitter, and converts it into a splitjoin with a duplications splitter. JRRtoXOR(Filter); Similar to the previous one, but in this case, a splitjoin with a roundrobin joiner gets converted into a roundrobin with an or joiner. These two functions are useful 11

12 when the number of bits passed to the roundrobin splitter is not a multiple of the word size. StandardDecomp(Filter); This function takes in a filter whose input and output sizes are a multiple of the words size, and decomposes it into a set of filters each of them corresponding to individual instructions (shifts, ands, ors). It is unlikely that you will be using this function; it is mainly used by the system to generate code. MakeTable(Filter); This function takes in a filter, and replaces it with a table lookup. Keep in mind that the size of the table will be 2^in where in is the input size of the filter. Thus, it is unwise to use it on filters with input sizes greater than 10 or so. If you have a filter with a larger input size, you can use the ColSplit function to break it into filters with small input sizes, and apply MakeTable independently to each. Restructure[spec](Filter); Restructure takes in a pipeline, and a description of how that pipeline should look like after restructuring. A later section will explain this command in more detail. PermutFactor[spec](Filter); This command takes in a permutation and a partial description of how bits should be shifted at every step, and produces a sequence of filters each one implementing a step. It will be described in detail in the next section. Print[ fname,n](filter); The print command produces a picture of a filter/pipeline/splitjoin. The string fname specifies the name of the output file, and the optional parameter N determines how many levels of nesting deep to display. PrintMatrix[ fname ](Filter); This function shows the matrices used for the internal representations of the filters. It is useful when performing decompositions. 12

13 Decomposing permutations with PermutFactor To illustrate how PermutFactor works, consider the following example. You have the DropThird filter form the previous section, and you have already unrolled it and cut it out into filters that work on a 32 bit block. Now, you want to specify to the system that you want to implement it using log-shifting as explained earlier. At a high level, what you want is to implement the filter with only a few steps. The amount that we shift bits in a given step will be twice as much as in the previous step, but only a subset of the bits shift in every step. We can express all of these high level ideas in the following sketch: PermutFactor[ [ shift(0:31 by 0 1)], [ shift(0:31 by 0 2)], [ shift(0:31 by 0 4)], [ shift(0:31 by 0 8)] ]( DropThird ); What this means, is that in the first step, bits 0 through 31, which is all bits, will shift by either zero or 1. In the second step, they will shift by either 0 or 2; in the next by either zero or 4, and in the last by either zero or 8. This information is sufficient for the system to decompose DropThird into a sequence of 4 steps, each one corresponding to a step in the log-shifting as explained above. The precise semantics of the PermutFactor are as follows. Each one of the square brackets corresponds to a step. Thus, in the above example, you have four steps. On each step, you can have a list, potentially empty, of shift specifications. Shift specifications fall into four categories. Type 1 shift( bitlist by x) Type 2 shift(bitlist by?) Where x is an integer expression, and bitlist is a list of bits. A list of bits can include ranges of the form a:b, as well as individual numbers, all separated by commas. In this case, the meaning is that all bits in bitlist are to be shifted by amount x given. This is similar to the previous case, but now the amount by which all the bits in bitlist will move is up to the system to decide. This is useful when you know a set of bits will have to move together but you don t want to worry by how much. 13

14 Type 3 shfit(bitlist by a b ) Type 4 pos(bitlist to poslist) In this case, instead of a single shift amount, we are giving the system a limited number of choices of how much each of the bits in the list will be allowed to shift. In this case, instead of specifying by how much to shift, we specify that when we get to this step, we want the bits in bitlist to be in the positions specified in poslist. In this case, the two lists must be of the same size. This shift specification can not be included in the first step, since the position of the bits in the first step is what determines their numbering. In all steps, the bits are referred in the shift specifications by their original positions, where the first bit is bit zero. So going back to our original example DropThird, you can use the functions seen thus far to tell the system that you want to pack things first within words before packing into words, and then to tell the system that the packing within words should be done using log shifting. The full TSL spec would look like this: Unroll[WS](DropThird); PermutFactor[ [shift(0:1, 32:33, 64:65 by 0)], [shift(0:31 by?), shift(32:63 by?), shift(64:95 by?)] ](DropThird); DiagSplit( DropThird.filter(0) ); for( i = 0; i<3; i=i+1){ PermutFactor[ [ shift(0:31 by 0 1)], [ shift(0:31 by 0 2)], [ shift(0:31 by 0 4)], [ shift(0:31 by 0 8)] ] ( DropThird.filter(0) ); In this case, the first unroll converts the filter into a filter that produces multiples of the word size. Then, the first PermutFactor specifies that in the first step, bits 0,1,32,33,64 and 65 are not allowed to move, and in the second step, bits that started out in the same 32 bit word shift by the same amount. This means, that by this point, the bits must already be packed within the word. Now, given that this first filter in the decomposition operates on all words independently, we can use DiagSplit to break it into a splitjoin of 3 independent filters. Finally, on each of the three independent filters, we can specify how to decompose it using log-shifting. 14

15 Restructuring pipelines with the Restructure command There are three main types of restructurings that can be performed with the restructure command. Merge Several Matrix Filters together into a single filter that can be implemented more efficiently Merge a filter into a roundrobin splitter or joiner to improve its performance Merge several Filters into a pipeline to allow for further restructuring later on Restructure takes in a pipeline, and returns a new pipeline with the same semantics as the old one, but with a different structure. The syntax of restructure is as follows. Restructure[ filterspec, filterspec, ](pipeline) Each one of the filterspecs represents an element that will be added to the pipeline, and can be any of three things. A local name of a filter contained in the pipeline o In this case, the filter added to the pipeline is simply the filter referred to by this name. A list of filter specs enclosed in brackets o In this case, the filter represented by this filterspec is a pipeline, containing all the filters represented by the filterspecs in the list. If the first item on the list is a string, that s the name that will be given to the new pipeline. A Merge Specification. o This represents a set of filters that will be merged. Merge specifications have the following syntax: Merge[ type, Name, filter, filter, ] The type can be either: matrix, splitjoin, or pipeline, and the exact semantics of the Merge will depend on the type. In the case of pipeline, the effect of Merge will be the same as if you had specified [ Name, filter, filter, ]. If you use type matrix, the system will try to merge all the filters into a single filter, and the new filter will be called Name. Finally, if you use the type splitjoin, the system will try to merge all the filters that are not splitjoins into the filters that are. The following examples will help illustrate the power of Merge. 15

16 Example: Suppose you have the following filters: bit->bit filter A{ work pop 3 push 3{ boolean x = pop()==1; boolean y = pop()==1; boolean z = pop()==1; push( (x && y)? (bit)1: (bit)0); push( (x && z)? (bit)1: (bit)0 ); push( (y && z)? (bit)1: (bit)0 ); bit->bit filter B{ work pop 2 push 2{ push( peek(0) ); push( peek(1)==1 && peek(0)==1? (bit)1: (bit)0 ); pop(); pop(); bit->bit filter C{ work pop 2 push 2{ push( peek(1)!= peek(0)? (bit)1: (bit)0); push( pop() ); pop(); bit->bit pipeline ABCpl{ add A(); add B(); add C(); Then, then, you can use merge to do the following Transformations: First, the command Restructure[ A, [ BCpl, B, C] ](ABCpl); Will have the equivalent effect of rewriting the program as bit->bit pipeline BCpl{ add B(); add C(); bit->bit pipeline ABCpl{ add A(); add BCpl(); 16

17 And will be equivalent to the command Restructure[ A, Merge[pipeline, BCpl, B, C] ](ABCpl); Now, we can also use Restructure to merge A and B. Restructure[ Merge[matrix, AB, A, B], C](ABCpl); The result is a new filter AB which is equivalent to A followed by B. In general, the structure of A and B would determine whether the restructured pipeline is more efficient than the original one. ABCpl A B C ABCpl AB C Finally, suppose we start with the following filter: bit->bit splitjoin ABsj{ split roundrobin(3,2); add A(); add B(); join roundrobin(3, 2); bit->bit pipeline ABC{ add ABsj(); add C(); Then, we can apply the Restructure Command, Restructure[ Merge[splitjoin, ABsj, ABsj, C] ](ABC); The Result will be a pipeline containing a single splitjoin that looks like this: In this case, The splitjoin has been unrolled so it now has 4 branches instead of two, each with its own copy of A and B. C has also been unrolled, and pieces of C have been incorporated into each of the branches. Each of the branches will actually satisfy the hierustics for a table implementation, so the compiler will implement each of the branches as its own separate table. However, if you want to guarantee that all the branches will be implemented as tables, you can specify it with the following code: 17

18 Restructure[Merge[splitjoin, "ABsj", ABsj, C] ](tmp); for(i=0; i<4; i=i+1){ MakeTable( tmp.abcsj.filter(i) ); Limitations of Merge When merging into a matrix, it is only possible to merge several matrices of the same type. What this means, is that filters that use different operators, for example a filter that uses ANDs and ORs and a filter that uses XORs can not be merged together. In the above example, we could merge A and B, because they both use only AND operators. This is not a problem in the case of permutations, since those involve no operators among the bits. Merging a matrix into a splitjoin will have a different effect depending on the type of splitter and joiner. Splitjoins can be merged together only when the weights of the spliter and joiner match. 18

StreamIt Language Specification Version 2.1

StreamIt Language Specification Version 2.1 StreamIt Language Specification Version 2.1 streamit@cag.csail.mit.edu September, 2006 Contents 1 Introduction 2 2 Types 2 2.1 Data Types............................................ 3 2.1.1 Primitive Types.....................................

More information

Cache Aware Optimization of Stream Programs

Cache Aware Optimization of Stream Programs Cache Aware Optimization of Stream Programs Janis Sermulins, William Thies, Rodric Rabbah and Saman Amarasinghe LCTES Chicago, June 2005 Streaming Computing Is Everywhere! Prevalent computing domain with

More information

StreamIt Language Specification Version 2.0

StreamIt Language Specification Version 2.0 StreamIt Language Specification Version 2.0 streamit@cag.lcs.mit.edu October 17, 2003 Contents 1 Introduction 3 2 Types 3 2.1 Data Types............................. 3 2.1.1 Primitive Types......................

More information

CSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators

CSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators CSE 351: The Hardware/Software Interface Section 2 Integer representations, two s complement, and bitwise operators Integer representations In addition to decimal notation, it s important to be able to

More information

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find CS1622 Lecture 15 Semantic Analysis CS 1622 Lecture 15 1 Semantic Analysis How to build symbol tables How to use them to find multiply-declared and undeclared variables. How to perform type checking CS

More information

UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

More information

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors. 1 LECTURE 3 OUTLINES Variable names in MATLAB Examples Matrices, Vectors and Scalar Scalar Vectors Entering a vector Colon operator ( : ) Mathematical operations on vectors examples 2 VARIABLE NAMES IN

More information

BITWISE OPERATORS. There are a number of ways to manipulate binary values. Just as you can with

BITWISE OPERATORS. There are a number of ways to manipulate binary values. Just as you can with BITWISE OPERATORS There are a number of ways to manipulate binary values. Just as you can with decimal numbers, you can perform standard mathematical operations - addition, subtraction, multiplication,

More information

Operators. Java operators are classified into three categories:

Operators. Java operators are classified into three categories: Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.

More information

Teleport Messaging for. Distributed Stream Programs

Teleport Messaging for. Distributed Stream Programs Teleport Messaging for 1 Distributed Stream Programs William Thies, Michal Karczmarek, Janis Sermulins, Rodric Rabbah and Saman Amarasinghe Massachusetts Institute of Technology PPoPP 2005 http://cag.lcs.mit.edu/streamit

More information

Lecture 6 Decision + Shift + I/O

Lecture 6 Decision + Shift + I/O Lecture 6 Decision + Shift + I/O Instructions so far MIPS C Program add, sub, addi, multi, div lw $t0,12($s0) sw $t0, 12($s0) beq $s0, $s1, L1 bne $s0, $s1, L1 j L1 (unconditional branch) slt reg1,reg2,reg3

More information

ECE220: Computer Systems and Programming Spring 2018 Honors Section due: Saturday 14 April at 11:59:59 p.m. Code Generation for an LC-3 Compiler

ECE220: Computer Systems and Programming Spring 2018 Honors Section due: Saturday 14 April at 11:59:59 p.m. Code Generation for an LC-3 Compiler ECE220: Computer Systems and Programming Spring 2018 Honors Section Machine Problem 11 due: Saturday 14 April at 11:59:59 p.m. Code Generation for an LC-3 Compiler This assignment requires you to use recursion

More information

CIS 194: Homework 6. Due Monday, February 25. Fibonacci numbers

CIS 194: Homework 6. Due Monday, February 25. Fibonacci numbers CIS 194: Homework 6 Due Monday, February 25 Files you should submit: Fibonacci.hs This week we learned about Haskell s lazy evaluation. This homework assignment will focus on one particular consequence

More information

Technical Questions. Q 1) What are the key features in C programming language?

Technical Questions. Q 1) What are the key features in C programming language? Technical Questions Q 1) What are the key features in C programming language? Portability Platform independent language. Modularity Possibility to break down large programs into small modules. Flexibility

More information

Bits and Bytes. Why bits? Representing information as bits Binary/Hexadecimal Byte representations» numbers» characters and strings» Instructions

Bits and Bytes. Why bits? Representing information as bits Binary/Hexadecimal Byte representations» numbers» characters and strings» Instructions Bits and Bytes Topics Why bits? Representing information as bits Binary/Hexadecimal Byte representations» numbers» characters and strings» Instructions Bit-level manipulations Boolean algebra Expressing

More information

The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and

The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Op. Use Description + x + y adds x and y x y

More information

GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one.

GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one. http://www.tutorialspoint.com/go/go_operators.htm GO - OPERATORS Copyright tutorialspoint.com An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.

More information

The Arithmetic Operators

The Arithmetic Operators The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Examples: Op. Use Description + x + y adds x

More information

Principle of Complier Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore

Principle of Complier Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore Principle of Complier Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore Lecture - 20 Intermediate code generation Part-4 Run-time environments

More information

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

More information

Page 1. Where Have We Been? Chapter 2 Representing and Manipulating Information. Why Don t Computers Use Base 10?

Page 1. Where Have We Been? Chapter 2 Representing and Manipulating Information. Why Don t Computers Use Base 10? Where Have We Been? Class Introduction Great Realities of Computing Int s are not Integers, Float s are not Reals You must know assembly Memory Matters Performance! Asymptotic Complexity It s more than

More information

UW CSE 351, Winter 2013 Final Exam

UW CSE 351, Winter 2013 Final Exam Full Name: Student ID #: UW CSE 351, Winter 2013 Final Exam March 20, 2013 2:30pm - 4:20pm Instructions: Write your full name and UW student ID number on the front of the exam. When the exam begins, make

More information

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation Computer Organization CS 231-01 Data Representation Dr. William H. Robinson November 12, 2004 Topics Power tends to corrupt; absolute power corrupts absolutely. Lord Acton British historian, late 19 th

More information

Lecture Notes on Ints

Lecture Notes on Ints Lecture Notes on Ints 15-122: Principles of Imperative Computation Frank Pfenning Lecture 2 August 26, 2010 1 Introduction Two fundamental types in almost any programming language are booleans and integers.

More information

Programming and Data Structure

Programming and Data Structure Programming and Data Structure Dr. P.P.Chakraborty Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture # 09 Problem Decomposition by Recursion - II We will

More information

(Refer Slide Time: 00:03:51)

(Refer Slide Time: 00:03:51) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 17 Scan Converting Lines, Circles and Ellipses Hello and welcome everybody

More information

A Simple Syntax-Directed Translator

A Simple Syntax-Directed Translator Chapter 2 A Simple Syntax-Directed Translator 1-1 Introduction The analysis phase of a compiler breaks up a source program into constituent pieces and produces an internal representation for it, called

More information

There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals:

There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals: Numeric Types There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals: 1-123 +456 2. Long integers, of unlimited

More information

Physics 306 Computing Lab 5: A Little Bit of This, A Little Bit of That

Physics 306 Computing Lab 5: A Little Bit of This, A Little Bit of That Physics 306 Computing Lab 5: A Little Bit of This, A Little Bit of That 1. Introduction You have seen situations in which the way numbers are stored in a computer affects a program. For example, in the

More information

Announcements. Lab Friday, 1-2:30 and 3-4:30 in Boot your laptop and start Forte, if you brought your laptop

Announcements. Lab Friday, 1-2:30 and 3-4:30 in Boot your laptop and start Forte, if you brought your laptop Announcements Lab Friday, 1-2:30 and 3-4:30 in 26-152 Boot your laptop and start Forte, if you brought your laptop Create an empty file called Lecture4 and create an empty main() method in a class: 1.00

More information

Computer Vision. Matlab

Computer Vision. Matlab Computer Vision Matlab A good choice for vision program development because Easy to do very rapid prototyping Quick to learn, and good documentation A good library of image processing functions Excellent

More information

Functional Programming in Haskell Part I : Basics

Functional Programming in Haskell Part I : Basics Functional Programming in Haskell Part I : Basics Madhavan Mukund Chennai Mathematical Institute 92 G N Chetty Rd, Chennai 600 017, India madhavan@cmi.ac.in http://www.cmi.ac.in/ madhavan Madras Christian

More information

(Refer Slide Time: 01.26)

(Refer Slide Time: 01.26) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture # 22 Why Sorting? Today we are going to be looking at sorting.

More information

A Microprocessor Systems Fall 2009

A Microprocessor Systems Fall 2009 304 426A Microprocessor Systems Fall 2009 Lab 1: Assembly and Embedded C Objective This exercise introduces the Texas Instrument MSP430 assembly language, the concept of the calling convention and different

More information

Slide 1 CS 170 Java Programming 1 Multidimensional Arrays Duration: 00:00:39 Advance mode: Auto

Slide 1 CS 170 Java Programming 1 Multidimensional Arrays Duration: 00:00:39 Advance mode: Auto CS 170 Java Programming 1 Working with Rows and Columns Slide 1 CS 170 Java Programming 1 Duration: 00:00:39 Create a multidimensional array with multiple brackets int[ ] d1 = new int[5]; int[ ][ ] d2;

More information

Twister: Language Reference Manual

Twister: Language Reference Manual Twister: Language Reference Manual Manager: Anand Sundaram (as5209) Language Guru: Arushi Gupta (ag3309) System Architect: Annalise Mariottini (aim2120) Tester: Chuan Tian (ct2698) February 23, 2017 Contents

More information

Why Don t Computers Use Base 10? Lecture 2 Bits and Bytes. Binary Representations. Byte-Oriented Memory Organization. Base 10 Number Representation

Why Don t Computers Use Base 10? Lecture 2 Bits and Bytes. Binary Representations. Byte-Oriented Memory Organization. Base 10 Number Representation Lecture 2 Bits and Bytes Topics! Why bits?! Representing information as bits " Binary/Hexadecimal " Byte representations» numbers» characters and strings» Instructions! Bit-level manipulations " Boolean

More information

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance. 2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C

More information

StreamIt: A Language for Streaming Applications

StreamIt: A Language for Streaming Applications StreamIt: A Language for Streaming Applications William Thies, Michal Karczmarek, Michael Gordon, David Maze, Jasper Lin, Ali Meli, Andrew Lamb, Chris Leger and Saman Amarasinghe MIT Laboratory for Computer

More information

CHAPTER 7 ARRAYS: SETS OF SIMILAR DATA ITEMS

CHAPTER 7 ARRAYS: SETS OF SIMILAR DATA ITEMS CHAPTER 7 ARRAYS: SETS OF SIMILAR DATA ITEMS Computers process information and usually they need to process masses of information. In previous chapters we have studied programs that contain a few variables

More information

Chapter 3: Operators, Expressions and Type Conversion

Chapter 3: Operators, Expressions and Type Conversion 101 Chapter 3 Operators, Expressions and Type Conversion Chapter 3: Operators, Expressions and Type Conversion Objectives To use basic arithmetic operators. To use increment and decrement operators. To

More information

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators JAVA Standard Edition Java - Basic Operators Java provides a rich set of operators to manipulate variables.

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #43. Multidimensional Arrays

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #43. Multidimensional Arrays Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #43 Multidimensional Arrays In this video will look at multi-dimensional arrays. (Refer Slide Time: 00:03) In

More information

CS 241 Data Organization Binary

CS 241 Data Organization Binary CS 241 Data Organization Binary Brooke Chenoweth University of New Mexico Fall 2017 Combinations and Permutations In English we use the word combination loosely, without thinking if the order of things

More information

Boolean Representations and Combinatorial Equivalence

Boolean Representations and Combinatorial Equivalence Chapter 2 Boolean Representations and Combinatorial Equivalence This chapter introduces different representations of Boolean functions. It then discusses the applications of these representations for proving

More information

Shift and Rotate Instructions

Shift and Rotate Instructions Shift and Rotate Instructions Shift and rotate instructions facilitate manipulations of data (that is, modifying part of a 32-bit data word). Such operations might include: Re-arrangement of bytes in a

More information

COMP2611: Computer Organization. Data Representation

COMP2611: Computer Organization. Data Representation COMP2611: Computer Organization Comp2611 Fall 2015 2 1. Binary numbers and 2 s Complement Numbers 3 Bits: are the basis for binary number representation in digital computers What you will learn here: How

More information

Fall 2016 CSE Qualifying Exam CSCE 531, Compilers

Fall 2016 CSE Qualifying Exam CSCE 531, Compilers Fall 2016 CSE Qualifying Exam CSCE 531, Compilers 1. LR-Parsing (a) Give definitions of FIRST( ) and FOLLOW(X). (b) Consider the following augmented grammar G with start symbol S 0 : S 0! S S! V = E S!

More information

Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur

Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions 8/24/2012 Dept of CS&E 2 Arithmetic operators Relational operators Logical operators

More information

The C Programming Language Guide for the Robot Course work Module

The C Programming Language Guide for the Robot Course work Module The C Programming Language Guide for the Robot Course work Module Eric Peasley 2018 v6.4 1 2 Table of Contents Variables...5 Assignments...6 Entering Numbers...6 Operators...7 Arithmetic Operators...7

More information

Why Don t Computers Use Base 10? Lecture 2 Bits and Bytes. Binary Representations. Byte-Oriented Memory Organization. Base 10 Number Representation

Why Don t Computers Use Base 10? Lecture 2 Bits and Bytes. Binary Representations. Byte-Oriented Memory Organization. Base 10 Number Representation Lecture 2 Bits and Bytes Topics Why bits? Representing information as bits Binary/Hexadecimal Byte representations» numbers» characters and strings» Instructions Bit-level manipulations Boolean algebra

More information

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple

More information

CSCI 2212: Intermediate Programming / C Chapter 15

CSCI 2212: Intermediate Programming / C Chapter 15 ... /34 CSCI 222: Intermediate Programming / C Chapter 5 Alice E. Fischer October 9 and 2, 25 ... 2/34 Outline Integer Representations Binary Integers Integer Types Bit Operations Applying Bit Operations

More information

CS 231 Data Structures and Algorithms, Fall 2016

CS 231 Data Structures and Algorithms, Fall 2016 CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard

More information

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Scan Converting Lines, Circles and Ellipses Hello everybody, welcome again

More information

Stating the obvious, people and computers do not speak the same language.

Stating the obvious, people and computers do not speak the same language. 3.4 SYSTEM SOFTWARE 3.4.3 TRANSLATION SOFTWARE INTRODUCTION Stating the obvious, people and computers do not speak the same language. People have to write programs in order to instruct a computer what

More information

(Refer Slide Time: 1:27)

(Refer Slide Time: 1:27) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 1 Introduction to Data Structures and Algorithms Welcome to data

More information

It can be confusing when you type something like the expressions below and get an error message. a range variable definition a vector of sine values

It can be confusing when you type something like the expressions below and get an error message. a range variable definition a vector of sine values 7_april_ranges_.mcd Understanding Ranges, Sequences, and Vectors Introduction New Mathcad users are sometimes confused by the difference between range variables and vectors. This is particularly true considering

More information

COSC121: Computer Systems: Runtime Stack

COSC121: Computer Systems: Runtime Stack COSC121: Computer Systems: Runtime Stack Jeremy Bolton, PhD Assistant Teaching Professor Constructed using materials: - Patt and Patel Introduction to Computing Systems (2nd) - Patterson and Hennessy Computer

More information

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types

More information

Pointers, Arrays and Parameters

Pointers, Arrays and Parameters Pointers, Arrays and Parameters This exercise is different from our usual exercises. You don t have so much a problem to solve by creating a program but rather some things to understand about the programming

More information

Full file at C How to Program, 6/e Multiple Choice Test Bank

Full file at   C How to Program, 6/e Multiple Choice Test Bank 2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d)

More information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information

COMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette

COMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette COMP 250: Java Programming I Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette Variables and types [Downey Ch 2] Variable: temporary storage location in memory.

More information

A Stream Compiler for Communication-Exposed Architectures

A Stream Compiler for Communication-Exposed Architectures A Stream Compiler for Communication-Exposed Architectures Michael Gordon, William Thies, Michal Karczmarek, Jasper Lin, Ali Meli, Andrew Lamb, Chris Leger, Jeremy Wong, Henry Hoffmann, David Maze, Saman

More information

CS61C Machine Structures. Lecture 12 - MIPS Procedures II & Logical Ops. 2/13/2006 John Wawrzynek. www-inst.eecs.berkeley.

CS61C Machine Structures. Lecture 12 - MIPS Procedures II & Logical Ops. 2/13/2006 John Wawrzynek. www-inst.eecs.berkeley. CS61C Machine Structures Lecture 12 - MIPS Procedures II & Logical Ops 2/13/2006 John Wawrzynek (www.cs.berkeley.edu/~johnw) www-inst.eecs.berkeley.edu/~cs61c/ CS 61C L12 MIPS Procedures II / Logical (1)

More information

StreamIt on Fleet. Amir Kamil Computer Science Division, University of California, Berkeley UCB-AK06.

StreamIt on Fleet. Amir Kamil Computer Science Division, University of California, Berkeley UCB-AK06. StreamIt on Fleet Amir Kamil Computer Science Division, University of California, Berkeley kamil@cs.berkeley.edu UCB-AK06 July 16, 2008 1 Introduction StreamIt [1] is a high-level programming language

More information

Government Polytechnic Muzaffarpur.

Government Polytechnic Muzaffarpur. Government Polytechnic Muzaffarpur. Name of the Lab: COMPUTER PROGRAMMING LAB (MECH. ENGG. GROUP) Subject Code: 1625408 Experiment: 1 Aim: Programming exercise on executing a C program. If you are looking

More information

6.001 Notes: Section 1.1

6.001 Notes: Section 1.1 6.001 Notes: Section 1.1 Slide 1.1.1 This first thing we need to do is discuss the focus of 6.001. What is this course all about? This seems quite obvious -- this is a course about computer science. But

More information

DEPARTMENT OF MATHS, MJ COLLEGE

DEPARTMENT OF MATHS, MJ COLLEGE T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,

More information

CS 11 C track: lecture 8

CS 11 C track: lecture 8 CS 11 C track: lecture 8 n Last week: hash tables, C preprocessor n This week: n Other integral types: short, long, unsigned n bitwise operators n switch n "fun" assignment: virtual machine Integral types

More information

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

Object oriented programming. Instructor: Masoud Asghari Web page:   Ch: 3 Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning

More information

Computer Organization CS 206 T Lec# 2: Instruction Sets

Computer Organization CS 206 T Lec# 2: Instruction Sets Computer Organization CS 206 T Lec# 2: Instruction Sets Topics What is an instruction set Elements of instruction Instruction Format Instruction types Types of operations Types of operand Addressing mode

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK B.E. - Electrical and Electronics Engineering IV SEMESTER CS6456 - OBJECT ORIENTED

More information

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines. Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of

More information

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square)

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square) CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square) Introduction This semester, through a project split into 3 phases, we are going

More information

CS 251 Intermediate Programming Java Basics

CS 251 Intermediate Programming Java Basics CS 251 Intermediate Programming Java Basics Brooke Chenoweth University of New Mexico Spring 2018 Prerequisites These are the topics that I assume that you have already seen: Variables Boolean expressions

More information

Lesson 12 - Operator Overloading Customising Operators

Lesson 12 - Operator Overloading Customising Operators Lesson 12 - Operator Overloading Customising Operators Summary In this lesson we explore the subject of Operator Overloading. New Concepts Operators, overloading, assignment, friend functions. Operator

More information

Dynamic Expressivity with Static Optimization for Streaming Languages

Dynamic Expressivity with Static Optimization for Streaming Languages Dynamic Expressivity with Static Optimization for Streaming Languages Robert Soulé Michael I. Gordon Saman marasinghe Robert Grimm Martin Hirzel ornell MIT MIT NYU IM DES 2013 1 Stream (FIFO queue) Operator

More information

2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting)

2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting) 2.1 Unit 2 Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting) 2.2 Skills & Outcomes You should know and be able to apply the following skills with confidence Perform addition & subtraction

More information

Bits, Words, and Integers

Bits, Words, and Integers Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are

More information

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1 CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Winter 2008 3/11/2008 2002-08 Hal Perkins & UW CSE V-1 Agenda Java virtual machine architecture.class files Class loading Execution engines

More information

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University 9/5/6 CS Introduction to Computing II Wayne Snyder Department Boston University Today: Arrays (D and D) Methods Program structure Fields vs local variables Next time: Program structure continued: Classes

More information

Bits and Bytes January 13, 2005

Bits and Bytes January 13, 2005 15-213 The Class That Gives CMU Its Zip! Topics Bits and Bytes January 13, 25 Why bits? Representing information as bits Binary / Hexadecimal Byte representations» Numbers» Characters and strings» Instructions

More information

UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING

UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING CMPE13/L: INTRODUCTION TO PROGRAMMING IN C SPRING 2012 Lab 3 Matrix Math Introduction Reading In this lab you will write a

More information

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1 Agenda CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Summer 2004 Java virtual machine architecture.class files Class loading Execution engines Interpreters & JITs various strategies

More information

age = 23 age = age + 1 data types Integers Floating-point numbers Strings Booleans loosely typed age = In my 20s

age = 23 age = age + 1 data types Integers Floating-point numbers Strings Booleans loosely typed age = In my 20s Intro to Python Python Getting increasingly more common Designed to have intuitive and lightweight syntax In this class, we will be using Python 3.x Python 2.x is still very popular, and the differences

More information

A Bad Name. CS 2210: Optimization. Register Allocation. Optimization. Reaching Definitions. Dataflow Analyses 4/10/2013

A Bad Name. CS 2210: Optimization. Register Allocation. Optimization. Reaching Definitions. Dataflow Analyses 4/10/2013 A Bad Name Optimization is the process by which we turn a program into a better one, for some definition of better. CS 2210: Optimization This is impossible in the general case. For instance, a fully optimizing

More information

The pixelman Language Reference Manual. Anthony Chan, Teresa Choe, Gabriel Kramer-Garcia, Brian Tsau

The pixelman Language Reference Manual. Anthony Chan, Teresa Choe, Gabriel Kramer-Garcia, Brian Tsau The pixelman Language Reference Manual Anthony Chan, Teresa Choe, Gabriel Kramer-Garcia, Brian Tsau October 2017 Contents 1 Introduction 2 2 Lexical Conventions 2 2.1 Comments..........................................

More information

Beginning C Programming for Engineers

Beginning C Programming for Engineers Beginning Programming for Engineers R. Lindsay Todd Lecture 6: Bit Operations R. Lindsay Todd () Beginning Programming for Engineers Beg 6 1 / 32 Outline Outline 1 Place Value Octal Hexadecimal Binary

More information

Bitwise Data Manipulation. Bitwise operations More on integers

Bitwise Data Manipulation. Bitwise operations More on integers Bitwise Data Manipulation Bitwise operations More on integers bitwise operators ex Bitwise operators on fixed-width bit vectors. AND & OR XOR ^ NOT ~ 01101001 & 01010101 01000001 01101001 01010101 01101001

More information

MICROPROCESSORS A (17.383) Fall Lecture Outline

MICROPROCESSORS A (17.383) Fall Lecture Outline MICROPROCESSORS A (17.383) Fall 2010 Lecture Outline Class # 03 September 21, 2010 Dohn Bowden 1 Today s Lecture Syllabus review Microcontroller Hardware and/or Interface Programming/Software Lab Homework

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 11

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 11 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2018 Lecture 11 EXCEPTION HANDLING Many higher-level languages provide exception handling Concept: One part of the program knows how to detect a problem,

More information

srl - shift right logical - 0 enters from left, bit drops off right end note: little-endian bit notation msb lsb "b" for bit

srl - shift right logical - 0 enters from left, bit drops off right end note: little-endian bit notation msb lsb b for bit Clemson University -- CPSC 231 Shifts (p. 123) srl - shift right logical - 0 enters from left, bit drops off right end 0 b 31 b 30 b 2 b 1 b 0 note: little-endian bit notation msb lsb "b" for bit a f 5

More information

Week - 04 Lecture - 01 Merge Sort. (Refer Slide Time: 00:02)

Week - 04 Lecture - 01 Merge Sort. (Refer Slide Time: 00:02) Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 04 Lecture - 01 Merge Sort (Refer

More information

MATLIP: MATLAB-Like Language for Image Processing

MATLIP: MATLAB-Like Language for Image Processing COMS W4115: Programming Languages and Translators MATLIP: MATLAB-Like Language for Image Processing Language Reference Manual Pin-Chin Huang (ph2249@columbia.edu) Shariar Zaber Kazi (szk2103@columbia.edu)

More information

Why embedded systems?

Why embedded systems? MSP430 Intro Why embedded systems? Big bang-for-the-buck by adding some intelligence to systems. Embedded Systems are ubiquitous. Embedded Systems more common as prices drop, and power decreases. Which

More information

Learning Forth. Developer Technical Support DTS. for Macintosh Open Firmware (Part I) 2/1/01 version 0.9 (part I) 1

Learning Forth. Developer Technical Support DTS. for Macintosh Open Firmware (Part I) 2/1/01 version 0.9 (part I) 1 Learning Forth for Macintosh Open Firmware (Part I) Developer Technical Support DTS 2/1/01 version 0.9 (part I) 1 Introduction This document is the first in a series of documents intended for hardware

More information

A flow chart is a graphical or symbolic representation of a process.

A flow chart is a graphical or symbolic representation of a process. Q1. Define Algorithm with example? Answer:- A sequential solution of any program that written in human language, called algorithm. Algorithm is first step of the solution process, after the analysis of

More information