mkdir ~/cs355/hw4 cp /home/cs355001/Handouts/hw4/* ~/cs355/hw4 |
You will copy these files:
basic.h - the commonly used circuit components in the CS355 assignments Full_Adder aa c_in a b | c_out sum; You can use the Full_Adder component in assignment hw4 to make the PC component help-CLK - the main simulation program file to test the CLK circuit It creates switches and probes to help you test the CLK circuit (macro) that you must make in this assignment help-PC - the main simulation program file to test the PC (Program Counter) circuit It creates switches and probes to help you test the PC circuit (macro) that you must make in this assignment clock.h - Skeletal assignment file - contains the circuits (macro definitions) that you must make for this assignment (turn in THIS file !) sample-mux - Sample EDiSim program to show you how to use the Mux built-in circuit sample-Dff - Sample EDiSim program to show you how to use the Dff built-in circuit |
|
|
|
Both circuits are implements as macros, so you will be writing two macros for this assignment.
You can find more information on writing user defined components as macros here: click here .
Just like in assignment hw3, I have provides you with 2 circuit test environment files and skeleton assignment program file.
Write the circuits inside the skeleton assignment program file
The circuit test environment program files are used to test your assignment
Background: the CPU's job is to execute an instruction. In order to execute an instruction correctly, a number of events must happen in a specific chronological order. The events are always "change the value of some (special/general purpose) registera". Since registers are updated with a clock signal, the chronological ordering of the (register ipdate) events can be control using a series of clock signals that where each clock signal is "displaced" (see figure below). In the first part of the assignment we will use a 4 state FSM (finate state machine) and a decoder to create a 4 phase clock.
Description of the input and output signals of the 4 phase clock circuit:
|
The macro header of the 4 phase clock is as follows (given in the prepared file):
Define Four_Phase_Clock Reset Clk | Ph1 Ph2 Ph3 Ph4; /* Write the 4-phase clock circuit here */ Endef; |
The Four_Phase_Clock cuicuit will be implemented using a FSM (Finite State Machine)
The meaning of inputs are as follows:
|
In addition to making the FSM, you need to use the state of the FSM to control 4 output signals. The output signals of the 4 phase clock are controlled by the state of the FSM as follows:
|
To implement the 4-phase clock, you will first implement a 4-states Finite State Machine with the following state transitions:
![]() |
The Finite State Machine will have no input signal !!! (That means the transitions of FSM will always be the same - in our case, it goes in circles...).
The circuit does have 2 input switches that perform the following functions on the D-flipflops of the FSM:
|
You must first implement the Finite State Machine (FSM) given in the above figure.
After you finish the FSM, add additional combinatorial circuit (figure out what you need yourself) to translate the state of the FSM to the 4 outputs Ph1, Ph2, Ph3 and Ph4 of the clock:
|
If we plot the outputs of the 4 signals of the 4-phase clock over time, it will looks as follows: (time flows from left to right in the figure below, so the signal further to the right is "later" in time)
![]() |
The state change of the 4-phase clock is controlled by the manual clock input signal (associated to key 0)
/home/cs355001/bin/cs355sim help-CLK |
The test circuit (help-CLK) that you see will look as follows:
You can interact with the help-ALU test circuit as follows:
|
Details on how to test the 4-phase-clock macro is given next.
How to verify the correctness of your CLK circuit: (what is the correct behavior)
|
The macro header is as follows:
Define PC_with_Branching Reset Clk Branch Addr[7..0] | PC[7..0]; /* Write your PC_with_Branching component here */ Endef; |
The inputs of the PC_with_Branching component are as follows:
|
The output signals of the PC_with_Branching component are as follows:
|
Schematically, the PC_with_Branching circuit looks like this:
![]() |
The input parameters of the PC_with_Branching component have the following functions:
|
/home/cs355001/bin/cs355sim help-PC |
The test circuit (help-PC) will look as follows:
You can interact with the help-ALU test circuit as follows:
|
|
/home/cs355001/turnin clock.h hw4 |
(A 4th extension request will be automatically denied --- personal emergencies and illiness with documentation will receive a "free" extension)
/home/cs355001/req-ext hw4 |
Students will be graded partially on the basis of their programming assignments. These programming assignments are to be treated as examinations, and are expected to be your individual work. While discussions with other students in the course may be permitted or encouraged by your instructor, you should write your program yourself. The mathlab representatives are available to explain error messages, discuss briefly technical details with which you may not be familiar, and give short suggestions as to how you might detect logic errors. The reps should not, however be asked to write part or all of your program. Your instructor (and any teaching assistants assigned to the course) will be glad to help you to the extent that he or she feels reasonable.
Submissions based on other students solutions in prior offerings of the course specifically violate these guidelines, as do submissions prepared with the help of an outside "tutor".
You should take precautions to protect the confidentiality of your work: preserve the secrecy of your password, do not make files or directories sharable, pick up your printouts promptly and dispose of printouts where they will not tempt other students. All work should be done either in the class directory of your ITD account (preferred) or in your "priv" directory (only if you do not have a class directory).
All submissions should include a comment statement near the top of the program of the form:
THIS CODE IS MY OWN WORK, IT WAS WRITTEN WITHOUT CONSULTING A TUTOR OR CODE WRITTEN BY OTHER STUDENTS - your name
Cases of apparent plagiarism or collusion will be referred to the Honor Council.