Homework 4A
Setup
Create a Repo
- Navigate to link
- If shown a list of IDs, select your WUSTL Key from the list (this only needs to be done once. If you already did this during studio, you won’t be given the optiona gain)
- “Accept the assignment”.
- Follow the link to the new repository for the group:
Codespaces
- We’ll be using Codespaces for many studios and assignments.
- Create a code space from the repository:
Caution!
The Codespce typically takes about 2-4 minutes to set up. If you stop working for more than a minute, please explicitly stop the Codespace (see the bottom of this assignment). You can restart the codespace by simply going to https://github.com/codespaces and clicking on the name of the Codespace for the repository. (The page will have a list of codespaces, the number of Cores and RAM for each, etc.)
Problem 1: Your assign
ment: Simple Combinational Logic
-
Run the
1.1 simple_comb testbench verification
task (Click the VSCode Tasks icon on the side bar () and then the task’s name). Observe that the
PROBLEMS
tab shows that several test cases failed: -
The “Surfer” pane will allow you to explore signals that were being used in the text. Expand the
simple_comb_tb
(this is the test bench), then thedut
(the “device under test”), then select variablesa
,b
, andc
: -
Notice the picture above only shows the initial values of
a
,b
, andc
, but you should be able to see the full signal (zoom in/out or scroll). If you click the mouse along the signal it will show you the values of each at exaclty that instant. Or if you click and drag you can see how they change as time changes. Review them from the beginning (t=0) to the end (t=170). -
Run the
0.0 Edit questions.md
task and answer question 1 in the designated place (don’t remove the# Q
lines!, but remove/replace theTODO
lines. You can answer with plain text, although you are also welcome to use MarkDown notation for styling if you’d like). -
Run the
1.2 Edit simple_comb.sv
task. Review the desciption of what’s expected and fix the designated line using basic Verilog operations (behavioral Verilog with symbols for the operations, like&
for AND). -
Re-run
1.1 simple_comb testbench verification
and confirm that all tests pass in thePROBLEMS
pane. (Or, if not, continue to editsimple_comb.sv
). -
Once it correctly passes the test bench, run ask
1.3 Simulate simple_comb.sv
, which will allow you to simulate the circuit. Be sure to hit the “play” button in theDIGITALJS: CONTROL
pane to simulate the circuit. -
Set
c
to a 1 and botha
andb
to 0. -
Complete
Q2
inquestions.md
. -
The “synthesizer” takes our HDL description and breaks it down into simpler parts. Run task
1.4 AIG Mapping
. CompleteQ3
andQ4
inquestions.md
.
Problem 2: Verilog Structure
Consider the circuit:
-
Use task
2.1 Edit structural.sv
and complete the HDL description using structural modeling!Primitive gates can be modeled with the format:
type(output, inputs...)
. For example, a 3-inputor
gate could be modeled withor(output, a, b, c);
or with a unique name for the instance of theor
gate, likeor gate1(out, a, b, c);
.Caution!
The problem asks for a structural model. You should not use
assign
oralways_comb
statements. You should use the primitive partsand(...)
,or(...)
,not(...)
, etc. Although you may pass test cases with other forms of modeling, credit will only be given for a structural model. -
Use the
2.2 Simulate structural.sv
task and the2.5 structural testbench
tasks to test your work. Revise your work until you pass the testbench (but, again, be sure you are using ONLY structural elements. No use of operators like~
,^
,&
, etc.) -
Run task 2.4 (
AIG Mapping
) and 2.5 (iCE40 Mapping
) and answerQ5
inquestions.md
.
Problem 3: Basic addition - Revisiting Hw 2a
Consider adding 2-digit binary numbers, $a$ and $b$ to produce the 2-bit result, $s$ and a one-bit carry-out, $c$:
Caution!
Note that a
, b
, and s
are each two-bit binary values (rather than each being made of two, distinct, binary inputs). Moreover, you should assume that values are “most significant bit first” unless otherwise specified.
-
Use task 3.1 to edit
add2.sv
. Complete it as described. Use tasks 3.2 and 3.3 to test your work. Update it until you pass all tests. -
Complete
Q7
-Q10
inquestions.md
End of work
Caution!
Be sure to “stop” your Codespace. You have approximately 60 hours of Codespace time per month. Codespaces often run for ~15 minutes extra if tabs are just closed.
Submission
The assignment will be submitted via GitHub and Gradescope.
1. First, be sure to commit and push files to GitHub (as shown in studio).
Caution!
Be sure all files are included, including completed questions.md
, which is 30% of the grade!!!</div>
1.1
1.2
1.3
2. Then go to GitHub.com and confirm the updates are on GitHub
3. Finally (after confirming updates are on GitHub), go to the assignment in Gradescope and import it from GitHub:
3.1
3.2
- Submission Link: Gradescope