XML

kent logo

CO527 Anonymous Questions and Answers

This page lists the various questions and answers. To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.

We have taken the liberty of making some minor typographical corrections to some of the questions as originally put. Although most of the questions here will have been submitted anonymously, this page also serves to answer some questions of general interest to those on the course.


Question 1:

Submission reference: IN1862

What is the average air-speed velocity of an unladen student?

Answer 1:

About 145 m/s.


Question 2:

Submission reference: IN2637

Why the names "Vdd" and "Vss"?

Answer 2:

Tradition mostly; "Vdd" is for drain and "Vss" for source in FET terminology.

Keywords: electronics


Question 3:

Submission reference: IN2640

What does the PORT register actually do, and how does it work with PUD and what is the pull up resistor?

Answer 3:

The PORT register's operation depends on whether the pins (individually) are configured for input (DDR = 0) or output (DDR = 1). In the case of output ports (where the AVR drives a voltage onto the pin) the PORT register value controls whether the port is driven high (PORT = 1) to +5v, or low (PORT = 0) to ground. In the case of input ports (where DDR = 0), the PORT setting controls the use of the internal pull-up resistor. If set to 0, the internal pull-up is disabled and the pin is high-impedance (acts like it's not connected to anything, more or less, so won't create strange electrical effects in an external circuit). If set to 1, the internal pull-up is enabled and the pin is pulled up to +5v through (according to the datasheet) a 20k to 50k-ohm resistor.

My explanation of the pull-up resistor in the slides (and in the lecture) is sufficient for what I expect you to know in CO527, but if you want to find out more, Wikipedia (Pull-up_resistor) has a fairly lengthy description.

Keywords: avr


Question 4:

Submission reference: IN2642

Will we find out which question we got wrong from the multiple choice assessment?

Answer 4:

Not as such, but if you really want to find out, feel free to pop by the office and I can look.

Alternatively, the software is open-source, so feel free to add that functionality and send a patch request! (I'll get around to it at some point — envisaged is some way of tagging questions with keywords then reporting that back at the end of the quiz).

Keywords: quiz


Question 5:

Submission reference: IN2648

What are pc-adj, br-rel, pc-set and br-abs from the second lecture?

Answer 5:

These are explained in the slides for the second lecture! But the names are not so important (e.g. "br-rel" is for "branch relative"). More important is understanding the function, e.g. when br-rel is asserted (set to 1), understanding what the value on pc-adj is and how it changes the program counter (PC).

Keywords: architecture


Question 6:

Submission reference: IN2650

What comes out of the switches on the "Construction: PC and Instruction Memory" slide? If br-rel goes in, how does the switch determine what goes out? Also, what is the difference between pc-adj and pc-set?

Answer 6:

You need to understand the difference between signals and data here — br-rel and br-abs are control signals that set the multiplexors there one way or the other. What goes out is simply what went in on the appropriate input. In the case of the br-rel switch, if it's 0 then the output of that switch is just the incremented PC; if it's 1 then the output is the result of the addition between the incremented PC and the value presented on pc-adj. I'm just reading off the diagram here, which you should be able to to do for yourself! I did explain these in the lecture at that time, which is why I encourage you to take notes in lectures! :-).

The difference between pc-adj and pc-set: what they are used for. It's explained on the slide! If you need more guidance than this, ask one of your peers (preferred) or pop by my office sometime (S113).

Keywords: architecture


Question 7:

Submission reference: IN2651

Could you please use your mouse when pointing at things for the examples today? So when we go over it on the recordings, we can see what you were pointing at in the lecture? :)

Answer 7:

I'll try, but probably not — it's not a nice way of pointing at things, I much prefer to use pens or a stick, which may (or may not) be captured by the camera.


Question 8:

Submission reference: IN2657

Are there any lectures whose content features more heavily in the second online test?

Answer 8:

Lectures 2 (last bit) and 3 for the architectural stuff, lectures 4 and 5 for the assembly mostly (though the instruction set reference from Atmel is probably the best reference for these, linked on Moodle along with other useful stuff).


Question 9:

Submission reference: IN2663

In lecture 7 what does the up_counter assembly code actually do?

Answer 9:

It increments one of the counter values. I'll explain a bit more fully in the answer to the next anon question.

Keywords: assembly

Referrers: Question 10 (2013)


Question 10:

Submission reference: IN2664

In the up_counter why do you lsl r16? why do you need to shift it left one place (multiply it by 2)?

Answer 10:

It's because the counters are 16-bit values, not 8-bit ones. Partly answering Question 9 (2013), from the code, we have:

.data
TempData:
    .space 10*2      ; 20 bytes for 10 16-bit counters

If one could peer at the AVR's SRAM, it would be laid out something like this:

  --+----+----+----+----+----+----+----+----+----+--
    | aa | bb | cc | dd | ee | ff | aa | bb | cc | ...
  --+----+----+----+----+----+----+----+----+----+--
    ^    +1   +2   +3   +4   +5   +6   +7   +8   +9 ...  (up to +19 for TempData)
    `-- TempData starts here

The first counter value (counter 0) starts at TempData+0, and has the value 0xaabb (16-bit == 2 bytes). The second counter (counter 1) starts at TempData+2 and has the value 0xccdd, and so on. Thus, to get from a counter value (0-9) to its address in SRAM, you need to multiply by 2 — or shift-left one. A few slides on from that has an alternative version of the code.

Keywords: assembly


Question 11:

Submission reference: IN2674

With the rotate left through carry operation, is the least significant bit used for the carry?

Answer 11:

No, the most significant bit. The bits are shifted left, with the existing carry bit put in the least significant (rightmost) bit of the register, and the most significant (leftmost) bit becomes the new carry bit. Observation: if you do this 9 times on the same register, you'll get back to where you started (and similarly with the rotate right through carry instruction).

Keywords: assembly


Question 12:

Submission reference: IN2670

Hello, could someone explain how to solve the assembler fragment questions? E.g.:

    ldi r16, 0x04
    ldi r17, 0x03
    mul r16, r17
    add r16, r0

what is the value of r16 after execution?

Answer 12:

I explained this in one of the week 16 lectures, but basically you first need to find out what each instruction is doing. The slides or the AVR instruction set reference will be useful for this. The first two instructions in this instance are straightforward: load immediate values into r16 and r17, with r16=4 and r17=3. Then multiply — if you look at the docs, you'll see the result of this is 16-bit and placed in r1:r0. Clearly, 3*4=12, so after the multiply r1=0 and r0=12. The last instruction adds r0 (value 12) to r16 (value still 4), so the result is 16 in this instance (or 0x10 in hexadecimal).

Keywords: assembly


Question 13:

Submission reference: IN2688

what does the instruction "in r16, SREG" do?

Answer 13:

Generally, the "in" instruction read an 8-bit I/O register (or I/O port) and stores it in a general purpose register (r0..r31). In this case, the instruction is reading the status register (SREG), which holds the condition codes and other flags, and stores it in r16. This sort of code would typically be in an interrupt handler, where the state of SREG is essentially unknown and therefore must be saved before the interrupt handler potentially trashes it.

Keywords: assembly


Question 14:

Submission reference: IN2766

From the lab, how does the computer decide which LED to turn on? I was unsure of how the computer says that it wants to turn on red but not turn on yellow and green as they are all connected to the same circuit.

Answer 14:

Labeling the AVR as a "computer" sounds a little odd! (micro-controller would be a more appropriate noun here). But to answer your question, there are essentially three circuits (electronically) when the 3 LEDs are connected — each starts with +5v (Vcc) passes through a resistor (360-ohm) then one of the LEDs, and finishes at one of the AVR's I/O pins. The way things are wired up in the practical labs, these are the AVR's "PORTB" pins 5, 4 and 3. On the Arduino these are the sockets numbered 13, 12 and 11.

In software, a program can use something like this to turn the LEDs into a particular state:

    cbi   PORTB, 5        ; PB5 low -> red LED on
    sbi   PORTB, 4        ; PB4 high -> yellow LED off
    sbi   PORTB, 3        ; PB3 high -> green LED off

The sbi and cbi instructions set and clear individual bits in I/O registers (the port B port-register in this case, which when configured for output, drives those particular pins high or low).

Keywords: avr , electronics


Question 15:

Submission reference: IN2767

For our lab report, should lots of examples be used?

Answer 15:

Not possible to give a simple answer to that I'm afraid. It may make sense to use examples, but I think there's a real risk that these invite verbatim descriptions of what was done in the lab, which is not overly useful. On the other hand, examples can be useful to illustrate a point which you've just made, in which case they're a good thing.

The sort of thing I don't particularly want to see might be "I learned a lot in the CO527 labs, e.g. that breadboard contains tiny sprung clips that hold bits of wire.".

The sort of thing I might want to see: "The CO527 lab gave me a better understanding of electrical circuits. For example, when wiring up the piezo buzzer I was much more confident about how things were being connected and used, but for the first LED circuits I followed the diagram blindly and kept double-checking.".

In this sort of scenario, anyone can write the first statement (the example is facts), but not everyone can write the second (as the example is something about learning and whether, how or to what extent that happened is very much individual and subjective). Maybe that helps..!

Keywords: lab-report


Question 16:

Submission reference: IN2788

Where do you want the 40mm margins for the lab report? because on the actual assessment itself it says top right and bottom and just above the submission it says left right and top?

Answer 16:

Apologies, my bad. It should be top, bottom and right.


Question 17:

Submission reference: IN2820

With index block organisation, is there one index block for each file in the system, so if you were to have 100 files would there be 100 index blocks(depending on how big the files are)?

Answer 17:

There is at least one index block for every file; that's why we talked about extra overheads for each file. There may be more than one; if the file is big, there may not be space in a single index block to specify all of the blocks making up the file. The multiple index blocks will be linked together in some way.


Question 18:

Submission reference: IN2821

What is relocatable code?

Answer 18:

See lecture 16 (and/or a book/internet!).


Question 19:

Submission reference: IN2810

For the operating systems exam will we have to do the things that we are doing in assessment 6?

Answer 19:

No, and it wouldn't make sense to either — you do not have extensive file-system documentation on-hand, and the coursework takes hours; the exam has to be done in 2! But that doesn't mean filing-systems (as a topic) would be absent from the exam, of course.

Keywords: exam


Question 20:

Submission reference: IN2822

What does the P bit (private mapping) actually show? (in relation to application page mappings in Linux).

Answer 20:

This shows that the mapping is private to the process, in the sense that only one process has it. Of course, the mapping can be shared up to the point where the process tries to modify the data there in some way, at which point a private copy will be made (but in such cases, the mapping is still private). Explicitly shared mappings arise either as a result of memory-mapped files (mapped file file-system) or from explicitly shared memory (e.g. for interprocess communication, see man shm_open on POSIX systems).

Keywords: memory-management

Valid CSS!

Valid XHTML 1.0!

Maintained by Fred Barnes, last modified Wed May 25 15:07:20 2016