CS 352 Lecture 17 – Catchup

Dear students,

Last week lots of good misunderstandings of memory came up. When misunderstandings appear, the right things are happening. Conflict surfaces in your brain, which is step 1 of learning. Step 2 is resolving that conflict. Today, then, I want to start by revisiting some ideas of how memory and pointers work in C and really in the entire computer.

I will unveil the following programming one line at a time. Your job is to determine what’s happening.

 0: int a[] = {65535, 991, 992, 993};
 1: printf("%d\n", a);
 2: printf("%d\n", *a);
 3: printf("%d\n", &a[1]);
 4: printf("%d\n", a + 3);
 5: printf("%d\n", 2[a]);
 6: int *p = a;
 7: printf("%d\n", p);
 8: printf("%d\n", &p);
 9: printf("%d\n", *p);
10: unsigned char *b = (unsigned char *) a;
11: printf("%d\n", *b);
12: printf("%d\n", *(b + 1));
13: printf("%d\n", *(b + 2));
14: printf("%d\n", *(b + 3));

Some folks have expressed confusion about HDL and n-way components. Also, the next homework requires doing some HDL tricks that I don’t think are necessarily intuitive. Rather than continuing to build on a wobbly foundation, let’s sketch out schematics for some of these components and translate them to HDL. We’ll visit these: Mux4Way, DMux4Way, Inc16, LeastByte (which is not part of any homework), ALU, Bit, Register, RAM8, RAM64, and PC.

See you next class!

Sincerely,

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *