Lab #1: Introduction to Digital Logic & VHDL

Connie Li, Phil Katz, & Katie Stockhammer

Due Monday 31 January 2005

Abstract:

In this lab, we used VHDL and MaxPlus+ II software to design a circuit whose output illuminated LEDs on a programmable logic board. To accomplish this, we used a two state sequential circuit to create a fetch/execute cycle. We implemented a 22 bit instruction register which contained the opcode, selector, address1, address2, and data values. Our main program incorporated two other entities, which were port mapped in: the program memory entity, a case statement that output the data needed for the instruction register, and the clock divider entity, which divided the 25mHz internal clock and output a 1.5Hz clock for us to use.

Descriptions:

We intended our circuit to be able to fetch code from the program memory and execute it, using an LED number as output. In order to do this, we implemented a two state sequential circuit. In the first state (state A), the circuit fetches the next instruction from the program memory. In state B, the circuit executes the code, depending on whatever the opcode says to do. Many of these instructions involved changing the light register, which was then ported to the LED panel as output. We also implemented an accumulator for more complex operations. In state B, the circuit also uses the ?selector? to determine which of the two addresses available is the next address.

The design process that we used was pretty clearly delineated in the lab assignment. First we built a very basic two state circuit. We then set up the program memory entity, and created the instruction register in the two state circuit. We then implemented the switch statements state B, for the opcode and the selector. We followed this by attempting to port in a clock divider, although we were unsuccessful in this endeavor. Instead, we implemented a push button clock to help test our code. Finally, we set up the board and downloaded our circuit to test.

We were not able to extend the lab very far. We used the push button on the board to set a clock that we could control, and we attempted to write some clever programs in the program memory. We tried to show an understanding of how to use the accumulator to do more complex arithmetic and also how to use the "jumps" to create loops.

Due to our inexperience with webpage design, we are unsure how to format a page with our VHDL code and graphical images, or how we would password protect such a page. Because of this, we will email you a copy our .vhd files; if you would like us to submit this in another way please let us know. For a graphical description of our circuit, please see figure 1 in the E25/CS25 Lab #1 Description.

Our circuit, excepting the clock divider, worked as we had intended. We think the clock divider is close to working but we are unsure of the location and nature of our "bug" and are unable to use the waveform editor to locate it. To test the circuit, we mainly used the waveform editor; however, we also downloaded our circuit to the board and our tests showed the expected LED outputs. We would like to think that the program that we implemented was somewhat "clever", although, it would have been much easier to validate our program if we were able to implement a regular clock.

We have learned a lot about basic coding in VHDL (although we still believe we have a lot more to learn). We also gained experience with the MAX+plus II program environment. This lab also increased our understanding of how an extremely simple computer operates at a very basic level. We were also impressed by our first experience in coding onto hardware.

Questions:

1: Our circuit is very similar to a miniature IAS machine. Both are state machines based on a fetch/execute cycle. If the instruction set of our circuit were larger, then it would be a general purpose computer. It would also need significantly more memory and a few more levels of sophistication would improve its performance. Like a general purpose computer, it is capable of data processing, data storage, data movement, and control.

2: Our testing plan was to use the waveform editor at every step of the way. Unfortunately, when we tried to implement the clock divider, we were unable to use the waveform editor because we could not simulate a long enough period of time (or a short enough clock cycle) for the clock divider to be used. Because of this flaw, we decided to bypass the clock divider and implement a push button clock instead. In this sense, we did not fully test the capabilities of the circuit because we did not successfully implement the system clock. This was not an ideal solution because a push button clock is not exact; sometimes a single "push" will result in multiple clock cycles. For all other aspects of the circuit, the waveform editor was extremely useful for debugging, which we did plenty of.

3: The biggest problem that we encountered was our inability to implement a clock divider. A more general problem was that the lab instructions were not always as descriptive as we would have liked; often we had to consult other groups to figure out exactly what a given instruction meant. For example, the instructions said to create two variables, and then began to refer to a "light register" and an "accumulator". However, it was never specified that those were the variables that we had just created. We also, as is readily apparent from the simplicity of our html code, are not familiar with webpage design and submission.


Phil Katz
Last modified: Mon Jan 31 14:57:31 EST 2005