# Midterm Exam

The midterm is scheduled for April 2 in class. A set of study topics is available on the exams page. Bring questions to class Thursday and Tuesday.

# Combinational not Sequential ALU

The project 3 description specifies a sequential ALU. It should be combinational. Also, the VHDL skeleton uses a control input with 3 values (2 downto 0). Only two are required. I have posted an updated project description should you want to download a new version. However, these are the only changes.

# Project 3 update

Fri, Mar 20 2009 02:20
| Permalink

I just updated the project 3 writeup to use std_logic rather than bit. Shouldn't make any difference other than being consistent with what's in the KURM synthesis library. If you started to use bit, it should be easy to simply replace bit with std_logic and bit_vector with std_logic_vector.

# Project 3 due date

Project 3 due date is the week starting April 7. Note that the Monday lab is still a week behind.

# Project 3 due date

Project 3 due date is the week starting April 7. Note that the Monday lab is still a week behind.

# Project 3 due date

Project 3 due date is the week starting April 7. Note that the Monday lab is still a week behind.

# Book references

Tue, Mar 10 2009 09:18
| Permalink

There are references in the texts for topics I have been covering in class. However, it appears most of the information has been moved to the CD-ROM in the current edition of Computer Organization and Design.

In Ashenden, there are two examples of ALUs on p203 and 208. They are both more abstract that what I covered in class, but the structure of the code is identical. In Computer Organization and Design, ALU information is on the CD-ROM in chapter C.

In Computer Organization and Design, there is information on register files on the CD-ROM in chapter C.

In Computer Organization and Design, arithmetic is discussed starting on page 222.

In Ashenden, there are two examples of ALUs on p203 and 208. They are both more abstract that what I covered in class, but the structure of the code is identical. In Computer Organization and Design, ALU information is on the CD-ROM in chapter C.

In Computer Organization and Design, there is information on register files on the CD-ROM in chapter C.

In Computer Organization and Design, arithmetic is discussed starting on page 222.

# Homework 3

Thu, Mar 5 2009 09:18
| Permalink

Homework 3 is available on the homework page. Due date is March 12 in class.

# Why sign extend works

Thu, Feb 26 2009 03:28
| Permalink

By far the most common question that I'm getting in office hours is why sign extend works the way it does. I'll take a shot at explaining it here...

So, let's assume that I would like to add two binary numbers of different lengths. For example:

0101 + 01

It's a pretty simple matter to extend 11 with a pair of 0s to the left to make the numbers the same length. You do this all the time for decimal numbers:

0101 + 0001 = 0110

No problem. Let's to the same thing with subtraction and the same two values:

0101 - 01

add the zeros:

0101 - 0001

take the 2's compliment:

0101 + 1111

add:

0100

and all is well.

But what if we take the two's compliment before we extend 01 to 4 bits? In other words:

0101 + 11

If we add two zeros like we did earlier, we get the wrong answer:

0101 + 0011 = 1000

But, if we add two ones instead, we get the answer that we should:

0101 + 1111 = 0100

This is the situation we have with offset. The value is already in 2's compliment form before we extend it. Thus, we need to add 1's for negative numbers and 0's for positive numbers. As always, we can tell the difference between positive and negative because the high bit for a negative number is 1.

So, let's assume that I would like to add two binary numbers of different lengths. For example:

0101 + 01

It's a pretty simple matter to extend 11 with a pair of 0s to the left to make the numbers the same length. You do this all the time for decimal numbers:

0101 + 0001 = 0110

No problem. Let's to the same thing with subtraction and the same two values:

0101 - 01

add the zeros:

0101 - 0001

take the 2's compliment:

0101 + 1111

add:

0100

and all is well.

But what if we take the two's compliment before we extend 01 to 4 bits? In other words:

0101 + 11

If we add two zeros like we did earlier, we get the wrong answer:

0101 + 0011 = 1000

But, if we add two ones instead, we get the answer that we should:

0101 + 1111 = 0100

This is the situation we have with offset. The value is already in 2's compliment form before we extend it. Thus, we need to add 1's for negative numbers and 0's for positive numbers. As always, we can tell the difference between positive and negative because the high bit for a negative number is 1.

# Never improvise...

Thu, Feb 26 2009 11:33
| Permalink

This year is the first year I've used a sensitivity list with the instruction interpreter process model. Recall that we made our KURM CPU process sensitive to clk and reset. I completely forgot that you cannot use a wait in a process that has a sensitivity list. Our memory access must uses waits, so there's no way around this problem other than to eliminate the sensitivity list. Thankfully, this is quite simple.

Delete your sensitivity list for the process and add the following as the first line of your process:

wait on clk,reset;

This will accomplish the same thing - causing your process to wait on a change on either the clock or the reset.

Delete your sensitivity list for the process and add the following as the first line of your process:

wait on clk,reset;

This will accomplish the same thing - causing your process to wait on a change on either the clock or the reset.