23F CST8216 Lab Assignment 3 - Lab Week Eleven
pdf
keyboard_arrow_up
School
McMaster University *
*We aren’t endorsed by this school
Course
CST8234
Subject
Industrial Engineering
Date
Dec 6, 2023
Type
Pages
5
Uploaded by 9safe9
CST8216 Processor Architecture
Lab Exercises
Last Revision Fall 2023
Page
1
of
5
© 2023 D. Haley
23F CST8216 Lab Assignment 3 - Lab Week Eleven.Docx
Assignment 3 (80 marks) – Lab Week 11 – The Marks Analysis Project
and Dual-
Mode Counter Project
Approximate time to complete: 3-4 hours. This lab should be started as soon as possible.
Due Date and Submission Requirements
Week 11 or 12 Lab Period
Task Two (10 marks) – Code Demo of Counter_HEX_Display.asm on Dragon12 Plus board. Only one attempt is
permitted and there are no late demos of this lab work.
Saturday end of Week 12 by 11:30 PM using appropriate Brightspace links.
Task One (20 marks) – Assignment 3 – Quiz Questions
Task Two (20 marks) – Counter_HEX_Display.asm code
Task Three (30 marks) – Marks Analysis Project MSWord document and Marks_Analysis.asm code
This lab exercise may be optionally performed by up to
THREE
students
in the same lab section
working as a
group (students pick their own partners). Also, ensure all student names/numbers are on all program listings
and documentation for all students to receive credit for the work (No name, no credit).
There is only ONE
submission required per group of students – ENSURE THAT EVERYONE IN THE GROUP KNOWS WHO IS
SUBMITTING THE SOLUTIONS.
Notes:
1. Names/Student Numbers missing on any demonstration code will result in no credit for the demo.
2. Names/Student Numbers missing on any submission code will result in no credit for the
submission.
3. Any submission submitted in a compressed file (e.g. .zip), will not be assessed.
4. The marking Rubric is on Brightspace, attached to the Assignment Submission Link.
Purpose of the LAB
The purpose of this lab is a follow-on to confirm your knowledge of the following Hybrid lectures, as well as Week
Nine’s Lecture material.
•
Week 6 – Flowchart Lecture
•
Week 7 – Addressing Modes and Iteration
•
Week 9 – Intro to Arrays
To do so, complete Assignment 3 Quiz Questions, the Dual-Mode Counter Project, and the Marks Analysis
Project, which will also formally introduce you to structured problem solving for assembly language.
Task One – Quiz Questions (20 marks)
Complete the quiz, which is based upon the use of the Instruction Set, and its Addressing Modes with Arrays.
Note that Hybrid Quiz 5, which permits 3 attempts for completion, also provides more practice with this material.
CST8216 Processor Architecture
Lab Exercises
Last Revision Fall 2023
Page
2
of
5
© 2023 D. Haley
23F CST8216 Lab Assignment 3 - Lab Week Eleven.Docx
Task Two – The Dual Mode Counter Project (20 marks)
For this part of the assignment, you are required to code a counter that
counts in both BCD and HEX using 68HCS12
Assembly Language
. When the program initially executes, it will count in BCD from $00 to $15, then it will count in
HEX from $00 HEX to $15 HEX, then continually repeat the BCD and HEX counts until Stop in pressed in the
simulator or Reset is pressed on the Dragon12 Plus Hardware Trainer board, correctly displaying the count on the
HEX Displays as illustrated below.
Note that you must use
only one
of the Accumulators to hold your count; the ideal one to use based upon lecture
discussions regarding the instruction
daa
. Then, on an as-required basis, you will need to push and pull its value to and
from the stack to save the count at the appropriate time(s) in your program.
Visio-Counter Flowchart
To assist you in your understanding of this problem, the high-level flowchart in Visio-Counter.pdf
has been provided, which must be used as the basis of your coding solution. Ensure that your solution uses the
exact logic
depicted in the flowchart, which is in the A3 CounterPackage.zip described below.
To assist in your software development, the A3_Counter_Hex_Display Package.zip contains the following material:
a.
Counter_HEX_Display.asm.txt
is a backup of the Starter
Code, provided in case the starter code becomes
misaligned when opening it.
b.
Counter_HEX_Display.asm
is the starter code to build
upon for the final version of your solution.
c.
Counter Hex Display.mp4
demonstrates how to
configure the Simulator to run a program that also uses
an API.s19 file.
d.
Counter on Dragon 12 Board.mp4
demonstrates the
expected program run on the hardware board
e.
Visio-Counter.pdf
is the flowchart containing
Counter_Hex_Display.asm implementation details.
f.
API.s19
is the Motorola s19 file that contains the
assembled API, which must be loaded into the
Simulator.
g.
23W CST8216 API Booklet.pdf
explains the Assembly
Language Subroutines and Library Routines in API.s19
that are to be used by Counter_Hex_Display.asm.
h.
Load api and code s19.pdf
contains the instructions on
how to load API.s19 onto the hardware board.
We will first use the 7-Segment HEX Displays on the
Simulator to continually display our count from $00
BCD to $15 BCD
$00 HEX to $15 HEX
$00 BCD
to $15 BCD
etc. You may wish to use a delay of 750
ms when observing the count
.
Once the BCD counter is functional in the Simulator,
use the 7-Segment HEX Displays on the hardware
board to continually display our count from $00 BCD to
$15 BCD
$00 HEX to $15 HEX
$00 BCD to $15
BCD
etc. You may wish to use a delay of 125 ms when
observing the count.
Note that as well as loading
Counter_HEX_Displays.s19
into the Simulator,
you must also load API.s19 for your
solution to function. The video “
Counter.mp4
”
contains instructions on how to do that as well as
presenting the expected program run.
Note that as well as loading
Counter_HEX_Displays.s19
onto the hardware board,
you must also load API.s19
for your solution to function. The document “
load api
and code s19 file.pdf
” contains instructions on how to
do that. The video “
Counter on Dragon 12
Board.
mp4” presents the expected program run on the
board.
CST8216 Processor Architecture
Lab Exercises
Last Revision Fall 2023
Page
3
of
5
© 2023 D. Haley
23F CST8216 Lab Assignment 3 - Lab Week Eleven.Docx
Development Requirements and Implementation Details
To be considered for full credit for the coding portion of the Dual-Mode Counter Project, you are to w
rite a “main”
Assembly Language program called
Counter_HEX_Display.asm
that solves the
problem specification detailed in this document and
illustrated in the provided flowchart and videos.
Here are the Implementation Details for
Counter_HEX_Display.asm
a.
Use the supplied Starter Code as a starting point for your solution, noting the comments within.
b.
Implement the
exact logic
depicted in the supplied flowchart.
c.
The counter must first count in BCD from $00 to $15, then it must count in HEX from $00 HEX to $15 HEX, then
continually repeat the BCD and HEX counts until Stop is pressed.
d.
You MUST use Iteration in your solution as detailed in the flowchart. Use
Count_Mode
as a flag, as detailed in the
Starter Code. Do not have one loop for counting in BCD and another loop for counting in HEX.
e.
Do NOT code the HEX or BCD values into an array and use it to output the count.
f.
Make use of the supplied Library Routines in lines 42 – 46 of the code. The instructions for their use are in the
23W CST8216 API Booklet.pdf.
g.
Make use of the CONSTANTS
DIGIT3_PP0 and DIGIT2_PP1
as well as
DVALUE
in your solution.
h.
You MUST use ONLY one Accumulator for the BCD count and correctly use the instruction
daa
as taught in
lecture and fully documented in the course texts; otherwise; little credit will be given for your solution even if it
appears to be 100% functional.
i.
You MUST use the
Stack
to temporarily store and retrieve the value of the BCD count as applicable. YOU MAY
NOT USE any other methods to temporarily store and retrieve values; otherwise, little credit will be given for your
solution.
j.
Use AsmIDE to develop the program code and the Simulator to debug your solution.
k.
Fully document Program Header to include Student Name(s), Student Number(s), and the Code Completion Data.
This information must be included; otherwise, there will be NO CREDIT for the submission.
l.
Fully document Counter_HEX_Display.asm, describing WHAT each line of code does, NOT the instruction set.
Note that your code should be able to fit between lines 71 and 110 of the supplied starter code listing. If you find yourself
greatly
exceeding that limit, then you are likely on the wrong track with this assignment.
It may seem odd that the flowchart indicates that you must Extract the MSB and LSB from the count to display the count’s value on
the HEX displays. This requirement exists because only
one
value can be displayed on the HEX displays at any one time unless
you use something called “Interrupt Driven Software,” which is beyond the scope of those. As such, we must use a process called
“Time Division Multiplexing” and display only one digit at a time. But, if we do it quickly enough, it will appear as if both digits are
being displayed at the same time. Note that this is only true on the hardware board and not in the Simulator.
Here is a pictorial representation of the functionality of these two Subroutines, which are included for you in the API.s19 file.
Extract_MSB
– Subroutine to extract MSB (the upper nibble of the Accumulator) from an 8-bit Accumulator as per the following
example:
Extract_LSB
– Subroutine to extract LSB (the lower nibble of the Accumulator) from an 8-bit Accumulator as per the following
illustration:
Note
: You must demonstrate your Hex_Display.asm code on the Dragon12 Plus board during
your Week 11 or Week 12 lab period. The demo mark will be included in the marking rubric
for the Hex_Display.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CST8216 Processor Architecture
Lab Exercises
Last Revision Fall 2023
Page
4
of
5
© 2023 D. Haley
23F CST8216 Lab Assignment 3 - Lab Week Eleven.Docx
Task Three – The Marks Analysis Project (30 marks total)
For this part of the assignment, you are required to create a 68HCS12 Assembly Language program that reads in an array
of Marks, assigns Letter Grades to each Mark, records the Grades in a separate array and tallies (counts) the number of
occurrences of each Letter Grade.
Implementation Details (20 marks)
The following set of requirements must be implemented in your solution.
The Program Name must be:
Marks_Analysis.asm
and it must be created using AsmIDE
Appropriate documentation must be used both in the Program Header and within the code so that the
program functionally is clear
You must use the supplied
Marks.txt
file in your solution, rather than the
values illustrated in this example
All “Marks” must be defined as constants within your solution
o
e.g. EIGHTY
equ
80
Letter Grades must be assigned as follows:
o
Mark >=
80
: A
o
Mark >=
70
: B
o
Mark >=
60:
C
o
Mark >=
50
: D
o
All other Marks: F
All Labels must follow course standards
o
e.g. Loop, Check70, AssignB
The Marks array origin must be $1000
The Marks array must include the labels “Marks” and “EndMarks”
The Marks array must be loaded into AsmIDE via a provided file called Marks.txt
The Grades array origin must be $1020
The memory allocated for the Grades array must be dynamically created
As you iterate through the Marks array, assigning Letter Grades, you must also tally (count) the
number of
occurrences of each Letter Grade and store the values in memory where it is clear what letter grade the
numbers correlate with. Hint: Look at the layout of the Memory Display Address window in the simulator to pick
those memory locations.
The program code origin must be $2000. Load the stack with this address.
The Iteration method chosen must use a dynamically created array length (Counter approach) or a
dynamically created array size (Memory Address approach), but not both. I recommend that the Memory
Address approach be used.
The reading of Marks and storing of Letter Grades must use the Indexed (IDX) Addressing Mode.
Branch Instructions must match the data type of the Marks array, except for Unary Branch Instructions
A second program run (e.g. File
Reset
Go), must produce the same results as the initial program run.
CST8216 Processor Architecture
Lab Exercises
Last Revision Fall 2023
Page
5
of
5
© 2023 D. Haley
23F CST8216 Lab Assignment 3 - Lab Week Eleven.Docx
Solving the Problem (10 marks total)
Pre-Coding Submissions
Normally, your solution must include the following submissions in a MSWord document (include all
Names/Student Numbers):
a.
Flowchart – Created from Program Specifications (use draw.io, Visio, or equivalent)
b.
Program Constants and Variables, detailed layout of arrays and results – created from Program Specifications
and Flowchart.
c.
Main program loop pseudocode
d.
Test Plan – Expected Results – include the Marks Array used and its Memory Map, Memory Map of the
expected Grades Array and the Memory Map of the tally of occurrences of each Letter Grade.
e.
Detailed account of group activity – e.g. which student did what work, what problems were encountered,
how many hours were spent on each portion. Students who do not participate in this activity will not receive
credit for it.
Note: Steps a – d must detail the problem solution. That is, those steps must provide sufficient information to
able to code from it.
However, for this Lab Exercise, the solution has been provided to you so that you can see the detail expected if
you were not provided with the problem solution. See
Marks Analysis Problem Solving Document.pdf
While the provided problem solution contains both Pre-Coding and Post-Coding solutions, you are required to
submit
your
Post-Coding work, as detailed below.
Post-Coding Submission Requirements List (10 marks)
Besides submitting a fully documented and fully functional Marks_Analysis.asm file,
in a separate file,
t
he
following Requirements List details what your solution must include in a MSWord document (include all
Names/Student Numbers):
a.
Test Plan – Actual Results – Upon loading the program into memory
a.
The Marks Array used (Remember: Use the supplied Marks array, not the “example” array)
b.
Screen shot of Marks Array in memory upon loading the program into memory
b.
Test Plan – Actual Results – After Program Run #1
a.
Screen shot that includes the Marks Array, the Letter Grades Array and the tally of occurrences of
each Letter Grade
c.
Test Plan – Actual Results – After Program Run #2
a.
Screen shot that includes the Marks Array, the Letter Grades Array and the tally of occurrences of
each Letter Grade
d.
Include a list of any problems encountered and how you overcame them – e.g. was Program Run #2 the same
as the original program run? If it was correct, then state so in the document.
e.
Detailed account of group activity – e.g. which student did what work and how many hours were spent on
each portion. Students who do not participate in this activity will not receive credit for it.