Due date: See Canvas
mkdir ~/cs355/hw3 cp /home/cs355001/Handouts/hw3/* ~/cs355/hw3 |
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; // A full-address Decoder2x4 aa c[1..0] | s[3..0]; // A 2x4 decoder You can use the Full_Adder and the 2x4 decoder components in this assignment help-ALU - the simulation program file to test the ALU circuit It creates switches and probes to help you test the ALU16 circuit (macro) that you must make in this assignment help-SHIFT - the simulation program file to test the SHIFTER circuit It creates switches and probes to help you test the SHIFTER16 circuit (macro) that you must make in this assignment alu-shf.h - Skeletal assignment file - contains the circuits (macro definitions) that you must make for this assignment |
You only need to edit the alu-shf.h file and turn it in for this assignment.
In this assignment, you will design and implement two components for your computer, which are:
|
Both circuits are implemented as macros, so you will be writing two macros for this assignment.
New feature of EDiSim used in this assignment:
Information that you will need for this assignment:
|
You have used macros in assignment 2; I have included the link to macros in case you need a refresher.
Please read the write ups on how to use array notation in EDiSim above.
Note:
|
The ALU16 macro header is like this (and I have written it in the alu-shf.h assignment file:
Define ALU16 a[15..0] b[15..0] c[1..0] | s[15..0] N Z; /* Complete the 16 bit ALU circuit here */ Endef; |
The inputs of the ALU16 circuits are:
|
The output signal variables are as follows:
|
After you have written the ALU16 macro in the file alu-shf.h, you can test the ALU16 circuit using this command:
/home/cs355001/bin/cs355sim help-ALU |
The test circuit (help-ALU) will look as follows:
You can interact with the help-ALU test circuit as follows:
Check whether the output value and the flags are computed correctly !!!
You can observe the correct behavior by running this program and use the above instructions to interact with the circuit:
|
|
NOTE:
|
The macro header is as follows:
Define SHIFTER16 a[15..0] c[1..0] | s[15..0]; /* Complete the 16 bit shifter circuit here */ Endef; |
The input parameters of the shifter circuit are as follows:
|
The output signals of the SHIFTER16 circuit are as follows:
|
After you have written the SHIFTER16 macro in the file alu-shf.h, you can test the SHIFTER16 circuit using this command:
/home/cs355001/bin/cs355sim help-SHIFT |
The test circuit (help-SHIFT) will look as follows:
You can interact with the help-ALU test circuit as follows:
Check whether the output value is computed (= shifted) correctly !!!
You can observe the correct behavior by running this program and use the above instructions to interact with the circuit:
|
|
/* --------------------------------------------------------------------- Skeleton assignment file alu-shf.h --------------------------------------------------------------------- */ /* ------------------------------------------------------------------------ THIS CODE IS MY OWN WORK, IT WAS WRITTEN WITHOUT CONSULTING A TUTOR OR CODE WRITTEN BY OTHER STUDENTS - your name ------------------------------------------------------------------------ */ Define ALU16 a[15..0] b[15..0] c[1..0] | s[15..0] N Z; /* Complete the 16 bit ALU circuit here */ Endef; Define SHIFTER16 a[15..0] c[1..0] | s[15..0]; /* Complete the 16 bit shifter circuit here */ Endef; |
because:
|
Complete the assignment by writing the ALU16 and SHIFTER16 macros.
You can make and use other macros to help you define the ALU16 and SHIFTER16 macros. Put these macros in the alu-shf.h file.
|
|
|
cd ~/cs355/hw3 /home/cs355001/turnin alu-shf.h hw3 |
(A 4th extension request will be automatically denied --- personal emergencies and illiness with documentation will receive a "free" extension)
/home/cs355001/req-ext hw3 |
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.