Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
cf46a31
creating work plan
Nov 5, 2017
705327f
finished work plan
Nov 5, 2017
eb83f34
Worked on IF stage
Nov 6, 2017
6935b57
Made a variably-sized dff
Nov 6, 2017
6ab51ec
added two input 32 bit adder with overflow flag for program counter
rdiverdi Nov 6, 2017
cf302b4
Merge pull request #1 from KaitlynKeil/master
KaitlynKeil Nov 6, 2017
5b5ddd4
Adding updated ifetch and test bench
Nov 7, 2017
623e891
Merge pull request #2 from KaitlynKeil/master
KaitlynKeil Nov 7, 2017
173ee1b
Adding a bunch of my own registers/alus/etc... to our template cpu
Nov 7, 2017
968eaf9
added comments to control and CPU
Nov 7, 2017
7618f7c
more work on control.v
Nov 7, 2017
2cb2a1f
created framework for cpu
Nov 7, 2017
c10b04e
adding testing for ID
Nov 7, 2017
a0787da
Fixed instruction decoding files
Nov 7, 2017
ae8a31b
fixed instruction decodes
Nov 7, 2017
e7b7ee8
working on tests
Nov 7, 2017
037aab5
added dm
kwinter213 Nov 8, 2017
97e5eb9
Merge branch 'master' of https://github.com/davpapp/Lab3
kwinter213 Nov 8, 2017
8f643a4
Trying to fix ifetch; not fully done
Nov 8, 2017
e1fb74a
Fixing merge conflicts
Nov 8, 2017
7092740
Added case statement things
Nov 8, 2017
fa0ab8c
Fixed the ifetch
Nov 8, 2017
2fa0651
Committing some top module changes
kwinter213 Nov 8, 2017
c11c520
Changed some formatting
Nov 9, 2017
b0d87b9
Formatting, fixing R decode for funct
Nov 9, 2017
b79c217
setup control with the correct inputs and op-code values
rdiverdi Nov 9, 2017
ec61269
OMerge branch 'master' of https://github.com/KaitlynKeil/Lab3
rdiverdi Nov 9, 2017
b39780b
coded in control signals to control.v
rdiverdi Nov 9, 2017
484ee9f
Adding a test file for control, in middle of debugging
Nov 9, 2017
f55b818
fixed the test for the controller
rdiverdi Nov 9, 2017
d6838eb
Control module (and test) completed
Nov 9, 2017
41e599f
Testing for instruction decode DONE
Nov 9, 2017
c66b72c
Merge branch 'master' of github.com:davpapp/Lab3
Nov 9, 2017
8d7a0f5
adding register and all tests for it
Nov 9, 2017
8dccd78
a few changes
kwinter213 Nov 9, 2017
27ec1a4
adding all tests for ALU
Nov 9, 2017
823fa72
some changes? Hopefully this works
kwinter213 Nov 9, 2017
8a9d00c
Merge branch 'master' of https://github.com/davpapp/Lab3
kwinter213 Nov 9, 2017
51f0e47
Comments in CPU
Nov 9, 2017
740f9d0
comments in cpu
Nov 9, 2017
ead012a
Updated the test, tried to fix a few things
Nov 9, 2017
64f2a44
Merge branch 'master' of https://github.com/davpapp/Lab3
Nov 9, 2017
0f18df7
Fixed a numbering system error
Nov 9, 2017
b74dfe1
datamemory working af
kwinter213 Nov 10, 2017
6ede67e
Merge branch 'master' of https://github.com/davpapp/Lab3
kwinter213 Nov 10, 2017
05965cf
moved the execute code into its own module, still need to write test
rdiverdi Nov 10, 2017
1629b38
fixed merge conflict in cpu.v
rdiverdi Nov 10, 2017
979e2e7
added start of a test file for execute block: something is broken wit…
rdiverdi Nov 13, 2017
abf634c
Saving cpu stuff
Nov 13, 2017
36bc6dc
Trying to implement JAL
Nov 13, 2017
66372db
Updating cpu
Nov 13, 2017
e87961b
fixed a typo in mux.v and added assembly code for the fibonacci function
rdiverdi Nov 13, 2017
170d1d7
Merge branch 'master' of https://github.com/davpapp/Lab3
rdiverdi Nov 13, 2017
7903dad
assembly test :)
kwinter213 Nov 13, 2017
947ad33
Merge branch 'master' of https://github.com/davpapp/Lab3
kwinter213 Nov 13, 2017
af8c5df
aluK included
kwinter213 Nov 13, 2017
48e3423
cleaned up stuff a little bit
kwinter213 Nov 13, 2017
3cf6c3e
Revert "cleaned up stuff a little bit"
kwinter213 Nov 13, 2017
0ce2024
Working on assembly test
Nov 14, 2017
9870998
Merge branch 'master' of https://github.com/davpapp/Lab3
Nov 14, 2017
b4e8270
Updating structure
Nov 14, 2017
11e0b05
Merge branch 'master' of https://github.com/davpapp/Lab3
kwinter213 Nov 14, 2017
4670e0c
Made the multiplier work
Nov 14, 2017
8ec866e
Updated a few things, theoretically made JAL and JR work
Nov 14, 2017
ad32819
Made SW work better potentially?
Nov 14, 2017
4f11e84
Changed a thing so that this works
Nov 14, 2017
a12699b
Finished the assembly test
Nov 14, 2017
d95d129
Attempting to add the rt/rd mux
Nov 15, 2017
607e1ef
Also, making a new memory module
Nov 15, 2017
b56edb0
for pull
Nov 15, 2017
69c672a
fixed merge conflict
Nov 15, 2017
76c23c3
fixing merge conflicts
kwinter213 Nov 16, 2017
3872202
Merge branch 'master' of https://github.com/davpapp/Lab3
kwinter213 Nov 16, 2017
2ed6b0c
switching ALUS
kwinter213 Nov 16, 2017
d36cb4b
updated ALU with zero flag
kwinter213 Nov 16, 2017
b35e5cd
figuring out conflicts between includes
Nov 16, 2017
08b9755
fixed hex char problem
Nov 16, 2017
d436dbe
updates while I quickly launder
kwinter213 Nov 16, 2017
cb591c4
fixed errors in CPUcontrol
Nov 16, 2017
c47e018
fixed cpucontrol
Nov 16, 2017
b2b1c33
currently compiling cpu
kwinter213 Nov 16, 2017
fa32226
makefile experimentation
Nov 16, 2017
e3992cf
pushing data and text file
Nov 16, 2017
ab7b6db
Merge branch 'master' into dpapp
Nov 16, 2017
0394170
Merge branch 'master' into dpapp
Nov 16, 2017
45749fa
Merge pull request #3 from davpapp/dpapp
Nov 16, 2017
08defe1
changed read file name
Nov 16, 2017
3725721
Revert "currently compiling cpu"
Nov 16, 2017
b8d313d
commiting these
Nov 16, 2017
a93776c
merged
Nov 16, 2017
0bd0551
I put some stuff about getting data from files into memory, and it co…
rdiverdi Nov 16, 2017
1c9fed8
fixed merge conflicts
rdiverdi Nov 16, 2017
b41bab2
fixed cpu
kwinter213 Nov 16, 2017
ddfadd1
Testing CPU
Nov 16, 2017
6f7f8af
Fixed a little bit for ifetch branching
Nov 16, 2017
53a4721
Adding the tex file
Nov 16, 2017
b9e6d53
ALU AND EXEC DO THINGS GOOD
kwinter213 Nov 16, 2017
96e714c
stuff and ALU
kwinter213 Nov 16, 2017
efdfdf5
Trying to save my work
Nov 17, 2017
7c2dd98
Merge branch 'master' of https://github.com/davpapp/Lab3
Nov 17, 2017
bd39655
Fixed some register/timing issues
Nov 17, 2017
afcbe0b
Added the initialization
Nov 17, 2017
ed749b6
Updating Rd/Rt, broke everything
Nov 17, 2017
f5ffc21
Adding a clock edge back to register
Nov 17, 2017
fe2b096
Changed regfile to pos and neg edge clock
Nov 17, 2017
d8b9506
fixed a branching error and changed the memory back to write only on …
rdiverdi Nov 17, 2017
e6eb61a
working through some bugs
rdiverdi Nov 17, 2017
411fda6
Trying to make things work and making things read on pos edge
Nov 19, 2017
7da40cb
added PDF of report
rdiverdi Nov 28, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added CompArch_Lab_III.pdf
Binary file not shown.
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Assembly simulation in Verilog unified Makefile example

include settings.mk

GTKWAVE := gtkwave
SIM := vvp

# Final waveform to produce is the combination of machine and program
WAVEFORM := $(TOPLEVEL)-$(PROGRAM).vcd
WAVEOPTS := filters/$(WAVEFORM:vcd=gtkw)


# Build memory image, compile Verilog, run simulation to produce VCD trace
$(WAVEFORM): settings.mk
$(MAKE) -C asm $(MEMDUMP)
$(MAKE) -C verilog $(TOPLEVEL).vvp
$(SIM) verilog/$(TOPLEVEL).vvp +mem_fn=asm/$(MEMDUMP) +dump_fn=$@


# Open waveform with saved formatting and filter options
scope: $(WAVEFORM) $(WAVEOPTS)
$(GTKWAVE) $(WAVEOPTS)


# Remove generated files, including from subdirectories
clean:
$(MAKE) -C asm clean
$(MAKE) -C verilog clean
rm -f $(WAVEFORM)

.PHONY: scope clean
50 changes: 50 additions & 0 deletions add32bit.t.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Test bench for 32 bit adder

`timescale 1 ns / 1 ps
`include "add32bit.v"

module test32bitAdder();

reg[31:0] a;
reg[31:0] b;
wire[31:0] c;
wire overflow;

add32bit test(a, b, c, overflow);

initial begin
// Add some numbers with no overflow
a = 32'd7;
b = 32'd6;
#50;
$display("6 + 7 = %d", c);
$display("overlow: %b", overflow);
a = 32'd657;
b = 32'd912;
#50;
$display("657 + 912 = %d", c);
$display("overlow: %b", overflow);
a = 32'd700;
b = 32'd900;
#50;
$display("700 + 900 = %d", c);
$display("overlow: %b", overflow);
// Add some numbers with overflow
a = 32'd2**31-5;
b = 32'd2**31-10;
#50;
$display("overflow: %d", c);
$display("overlow: %b", overflow);
a = -32'sd2**31-5;
b = -32'sd2**31-10;
#50;
$display("overflow %d", c);
$display("overlow: %b", overflow);
// add a positive and a negative
a = -32'sd700;
b = 32'd900;
#50;
$display("-700 + 900 = %d", c);
$display("overlow: %b", overflow);
end
endmodule
21 changes: 21 additions & 0 deletions add32bit.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 32 bit adder

module add32bit (
input[31:0] a,
input[31:0] b,
output reg[31:0] c,
output overflow
);

reg carry;
wire carryXorSign;
wire sameSign;

xnor signTest(sameSign, a[31], b[31]);
xor adder(carryXorSign, carry, c[31]);
and ovrflTest(overflow, carryXorSign, sameSign);

always @(a or b) begin
{carry, c} = a + b;
end
endmodule
76 changes: 76 additions & 0 deletions adder.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Adder circuit

module behavioralFullAdder
(
output sum,
output carryout,
input a,
input b,
input carryin
);
// Uses concatenation operator and built-in '+'
assign {carryout, sum}=a+b+carryin;
endmodule

module structuralFullAdder
(
output sum,
output carryout,
input a,
input b,
input carryin
);
wire ab; //setting up wires
wire acarryin;
wire bcarryin;
wire orpairintermediate;
wire orsingleintermediate;
wire orall;
wire andsumintermediate;
wire andsingleintermediate;
wire andall;
wire invcarryout;
and andab(ab, a, b); // a and b
and andacarryin(acarryin, a, carryin); // a and carryin
and andbcarryin(bcarryin, b, carryin); // b and carryin
or orpair(orpairintermediate, ab, acarryin); // (a and b) or (a and carryin)
or orcarryout(carryout, orpairintermediate, bcarryin); // ((a and b) or (a and carryin)) or (b and carryin)
or orintermediate(orsingleintermediate, a, b); // a or b
or orallinputs(orall, orsingleintermediate, carryin); // (a or b) or carryin
not inv(invcarryout, carryout); // not carryout
and sumintermediate(andsumintermediate, invcarryout, orall); // (a or b or carryin) and not carryout
and andintermediate(andsingleintermediate, a, b); // a and b
and andallinputs(andall, andsingleintermediate, carryin); // (a and b) and carryin
or adder(sum, andsumintermediate, andall); // ((a or b or carryin) and not carryout) or (a and b and c)
endmodule

module FullAdder4bit
(
output[3:0] sum, // 2's complement sum of a and b
output carryout, // Carry out of the summation of a and b
output overflow, // True if the calculation resulted in an overflow
input[3:0] a, // First operand in 2's complement format
input[3:0] b, // Second operand in 2's complement format
input carryin
);
wire carryout1; // wire setup for carryouts from each adder
wire carryout2;
wire carryout3;
wire aandb;
wire anorb;
wire bandsum;
wire bnorsum;
wire abandnoror;
wire bsumandnornor;
structuralFullAdder adder1(sum[0], carryout1, a[0], b[0], carryin); // first adder to handle the first added bits
structuralFullAdder adder2(sum[1], carryout2, a[1], b[1], carryout1); // second adder to take the carryout from the first adder and the next added bits
structuralFullAdder adder3(sum[2], carryout3, a[2], b[2], carryout2); // third adder to take the second carryout and the third added bits
structuralFullAdder adder4(sum[3], carryout, a[3], b[3], carryout3); // fourth adder to take the third carryout and the fourth bits
and andinputs(aandb, a[3], b[3]); // logic to determine overflow (overflow occurs when two positives result in a negative or two negatives result in a positive, the larges bit in both inputs are equal and the largest bit in the output is not the same)
nor norinputs(anorb, a[3], b[3]);
and andsum(bandsum, b[3], sum[3]);
nor norsum(bnorsum, b[3], sum[3]);
or orinputcombs(abandnoror, aandb, anorb);
nor norsumcombs(bsumandnornor, bandsum, bnorsum);
and finaland(overflow, abandnoror, bsumandnornor);
endmodule
27 changes: 27 additions & 0 deletions adder1bit.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
`define AND and #30
`define OR or #30
`define NOT not #10
`define XOR xor #30
`define NOR nor #20
`define NAND nand #20

module Adder1bit
(
output sum,
output carryout,
input a,
input b,
input carryin
);
wire aandb, aorb;
wire s, _carryin;
wire outputIfCarryin, outputIf_Carryin;
`XOR(s, a, b);
`XOR(sum, s, carryin);
`AND(aandb, a, b);
`OR(aorb, a, b);
`NOT(_carryin, carryin);
`AND(outputIfCarryin, aandb, _carryin);
`AND(outputIf_Carryin, aorb, carryin);
`OR(carryout, outputIfCarryin, outputIf_Carryin);
endmodule
Loading