Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 42 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
404dd7c
Setting up GitHub Classroom Feedback
github-classroom[bot] Apr 16, 2024
671939a
add deadline
github-classroom[bot] Apr 16, 2024
c7ee668
added adder and tbadder
ZacharyHsieh May 2, 2024
278d8f8
swapped names to test
andrewtuna05 May 2, 2024
3e67e2d
first attempt alu and tbalu
ZacharyHsieh May 3, 2024
5f3cfee
updated to 16 bits
ZacharyHsieh May 5, 2024
2aac9f3
updated to 16 bits
ZacharyHsieh May 5, 2024
89b4a8a
updated alu.sv
ZacharyHsieh May 5, 2024
0f80965
updated alu.sv->fixed syntax errors + sll, slr
ZacharyHsieh May 5, 2024
f78374e
added aludec stuff
andrewtuna05 May 5, 2024
dfad827
fixed aludec
andrewtuna05 May 5, 2024
39d5931
updated back to 32bit
ZacharyHsieh May 5, 2024
30eb902
Merge branch 'main' of github.com:cooper-union-ece-251-marano/final-p…
ZacharyHsieh May 5, 2024
fad477d
updated back to 32bit
ZacharyHsieh May 5, 2024
f2b4013
updated description
ZacharyHsieh May 5, 2024
965179e
pudated alu.sv sll and slr
ZacharyHsieh May 5, 2024
4c63168
finished aludec
andrewtuna05 May 5, 2024
7aa4296
finished maindec and tb_maindec
ZacharyHsieh May 6, 2024
90096d9
updated adder to only have 3 ports, not 5
ZacharyHsieh May 10, 2024
6107402
updated for zero to be 1 bit only
ZacharyHsieh May 10, 2024
48fca11
updated the testbench
ZacharyHsieh May 10, 2024
0175154
updated maindec to include a control signal for jumpregister function…
ZacharyHsieh May 11, 2024
84cd901
updated datapath.sv to include jumpreg signal and a new MUX to change…
ZacharyHsieh May 11, 2024
b2376ce
updated author names
ZacharyHsieh May 11, 2024
92fd9a6
updated regfile author names + added an attempt to fix floating value…
ZacharyHsieh May 11, 2024
98656ca
added jumpreg
ZacharyHsieh May 11, 2024
c40d2e6
updated to include jumpreg
ZacharyHsieh May 11, 2024
38feb24
fixed syntax
ZacharyHsieh May 11, 2024
baba0f4
updated readme, unfinished right now
ZacharyHsieh May 11, 2024
d4a730a
updated multprog
andrewtuna05 May 11, 2024
db49c37
.\catalog\computer\mult-prog_exe
ZacharyHsieh May 11, 2024
449f3d9
re-added cpu
ZacharyHsieh May 11, 2024
255ffa8
added documentation folder and files for leaf and fib
ZacharyHsieh May 11, 2024
d57b7e0
added timing diagram
andrewtuna05 May 11, 2024
1d5d1ad
added assembly code
andrewtuna05 May 11, 2024
a7dd9a4
added leaf procedure
andrewtuna05 May 11, 2024
7707bbe
added design picture
ZacharyHsieh May 12, 2024
02f7a3b
added programs to test
andrewtuna05 May 11, 2024
4a92fff
added documentation files for ISA and assembly, updated testbench to …
ZacharyHsieh May 12, 2024
8522064
added ISA as PDF
ZacharyHsieh May 12, 2024
fc0894e
updated README
andrewtuna05 May 12, 2024
515b708
removed docx files
ZacharyHsieh May 12, 2024
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
451 changes: 16 additions & 435 deletions README.md

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions catalog/adder/adder.sv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////////////////////////////
// The Cooper Union
// ECE 251 Spring 2024
// Engineer: YOUR NAMES
// Engineer: Andrew Yuan and Zachary Hsieh
//
// Create Date: 2023-02-07
// Module Name: adder
Expand All @@ -20,11 +20,17 @@ module adder
//
// ---------------- PORT DEFINITIONS ----------------
//


input logic [n-1:0] a,
input logic [n-1:0] b,
output logic [n-1:0] y
);

//
// ---------------- MODULE DESIGN IMPLEMENTATION ----------------
//
assign y = a + b;


endmodule

Expand Down
47 changes: 28 additions & 19 deletions catalog/adder/tb_adder.sv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////////////////////////////
// The Cooper Union
// ECE 251 Spring 2024
// Engineer: YOUR NAMES
// Engineer: Zachary Hsieh and Andrew Yuan
//
// Create Date: 2023-02-07
// Module Name: tb_adder
Expand All @@ -14,25 +14,34 @@
`define TB_ADDER

`timescale 1ns/100ps
`include "adder.sv"
`include "./adder.sv"

module tb_adder;
parameter n = 32;
logic [(n-1):0] a, b, y;

initial begin
$dumpfile("adder.vcd");
$dumpvars(0, uut);
$monitor("a = 0x%0h b = 0x%0h y = 0x%0h", a, b, y);
end

initial begin
a <= #n'hFFFFFFFF;
b <= #n'hFFFFFFFF;
end

adder uut(
.A(a), .B(b), .Y(y)
);
parameter N = 32;

reg [N-1:0] A;
reg [N-1:0] B; //inputs are reg for test bench

wire [N-1:0] Y; //outputs are wire for test bench

//
// ---------------- INITIALIZE TEST BENCH ----------------
//

//apply input vectors
initial begin: apply_stimulus
A = 32'b00110101100100111001111111000000;
B = 32'b10101111010000000101010001011001;
$display("A=%b B=%b Y=%b\n", A, B, Y);
$finish;
end


//
// ---------------- INSTANTIATE UNIT UNDER TEST (UUT) ----------------
//
adder uut(.a(A), .b(B), .y(Y));

endmodule

`endif // TB_ADDER
27 changes: 26 additions & 1 deletion catalog/alu/alu.sv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////////////////////////////
// The Cooper Union
// ECE 251 Spring 2024
// Engineer: YOUR NAMES
// Engineer: Zachary Hsieh and Andrew Yuan
//
// Create Date: 2023-02-07
// Module Name: alu
Expand All @@ -20,11 +20,36 @@ module alu
//
// ---------------- PORT DEFINITIONS ----------------
//

input logic clk,
input logic [n-1:0] a,
input logic [n-1:0] b,
input logic [2:0] op,
output logic [n-1: 0] y,
output logic zero
);
//
// ---------------- MODULE DESIGN IMPLEMENTATION ----------------
//


assign zero = (y==0);

always @(a,b,op) begin
case(op)
3'b000: y = a & b; //and
3'b001: y = a | b; //or
3'b010: y = a + b; //add
3'b011: y = ~(a | b); //nor
3'b100: y = a-b; //subtract
3'b101: y = (a < b) ? {n{1'b1}} : {n{1'b0}}; //set less than
3'b110: y = a << b[4:0]; //sll; we have 32 bits, so our max shift amount of 32, which is 5 bits of b if we assume that b is the shift amount and a is the shifted number
3'b111: y = a >> b[4:0]; //slr
endcase
end



endmodule

`endif // ALU
66 changes: 64 additions & 2 deletions catalog/alu/tb_alu.sv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////////////////////////////
// The Cooper Union
// ECE 251 Spring 2024
// Engineer: YOUR NAMES
// Engineer: Zachary Hsieh and Andrew Yuan
//
// Create Date: 2023-02-07
// Module Name: tb_alu
Expand All @@ -17,7 +17,69 @@
`include "alu.sv"

module tb_alu;
parameter n = 32;
parameter N = 32;

reg [N-1:0] A;
reg [N-1:0] B;
reg [2:0] OP;
reg CLK;

wire [N-1:0] Y;

initial begin : initialize_variable
A = 0;
B = 0;
end

always begin : clock
#5 CLK = ~CLK;
end

always @(posedge CLK)
begin
case (OP)
3'b000: $display("A=%b B=%b OP=%b Y=%b Zero=%b\n", A, B, OP, Y, ZERO);
3'b001: $display("A=%b B=%b OP=%b Y=%b Zero=%b\n", A, B, OP, Y, ZERO);
3'b010: $display("A=%b B=%b OP=%b Y=%b Zero=%b\n", A, B, OP, Y, ZERO);
3'b011: $display("A=%b B=%b OP=%b Y=%b Zero=%b\n", A, B, OP, Y, ZERO);
3'b100: $display("A=%b B=%b OP=%b Y=%b Zero=%b\n", A, B, OP, Y, ZERO);
3'b101: $display("A=%b B=%b OP=%b Y=%b Zero=%b\n", A, B, OP, Y, ZERO);
3'b110: $display("A=%b B=%b OP=%b Y=%b Zero=%b\n", A, B, OP, Y, ZERO);
3'b111: $display("A=%b B=%b OP=%b Y=%b Zero=%b\n", A, B, OP, Y, ZERO);
endcase
end


//apply input vectors
initial begin
$dumpfile("tb_alu.vcd");
$dumpvars(0, tb_alu.uut);
A = 32'b11100000010100010110011110101010;
B = 32'b01100001100101100100101001011111;
CLK = 0;
#10;
OP = 3'b000;
#10;
OP = 3'b001;
#10;
OP = 3'b010;
#10;
OP = 3'b011;
#10;
OP = 3'b100;
#10;
OP = 3'b101;
#10;
OP = 3'b110;
#10;
$finish;
end

//
// ---------------- INSTANTIATE UNIT UNDER TEST (UUT) ----------------
//
alu uut(.a(A), .b(B), .clk(CLK), .op(OP), .zero(ZERO), .y(Y));


endmodule
`endif // TB_ALU
31 changes: 26 additions & 5 deletions catalog/aludec/aludec.sv
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//////////////////////////////////////////////////////////////////////////////////
// The Cooper Union
// ECE 251 Spring 2024
// Engineer: YOUR NAMES
// Engineer: Zachary Hsieh & Andrew Yuan
//
// Create Date: 2023-02-07
// Module Name: aludec
// Description: 32-bit RISC ALU decoder
// Description: 16-bit RISC ALU decoder
//
// Revision: 1.0
//
Expand All @@ -16,15 +16,36 @@
`timescale 1ns/100ps

module aludec
#(parameter n = 32)(
#(parameter n = 16)(
//
// ---------------- PORT DEFINITIONS ----------------
//

input logic [5:0] funct, //
input logic [1:0] aluop, //Operation type
output logic [2:0] alucontrol //ALU operations
);
//
// ---------------- MODULE DESIGN IMPLEMENTATION ----------------
//

always @*
begin
case(aluop) //I-type instructions
2'b11: alucontrol <= 3'b010; // addi (for lw/sw/jr/addi)
2'b10: alucontrol <= 3'b100; // subi (for beq)
2'b01: alucontrol <= 3'b101; //slt (for slti)
default: case(funct) // R-type instructions
6'b100100: alucontrol <= 3'b000; // and
6'b100101: alucontrol <= 3'b001; // or
6'b100000: alucontrol <= 3'b010; // add
6'b100111: alucontrol <= 3'b011; // nor
6'b100010: alucontrol <= 3'b100; // subtract
6'b101010: alucontrol <= 3'b101; // slt
6'b000000: alucontrol <= 3'b110; // sll
6'b000010: alucontrol <= 3'b111; // slr
default: alucontrol <= 3'bxxx; // ???
endcase
endcase
end
endmodule

`endif // ALUDEC
51 changes: 49 additions & 2 deletions catalog/aludec/tb_aludec.sv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////////////////////////////
// The Cooper Union
// ECE 251 Spring 2024
// Engineer: YOUR NAMES
// Engineer: Zachary Hsieh & Andrew Yuan
//
// Create Date: 2023-02-07
// Module Name: tb_aludec
Expand All @@ -17,7 +17,54 @@
`include "aludec.sv"

module tb_aludec;
parameter n = 32;
// Inputs
reg [5:0] funct;
reg [1:0] aluop;

// Outputs
wire [2:0] alucontrol;

// Instantiate the Unit Under Test (UUT)
aludec uut (
.funct(funct),
.aluop(aluop),
.alucontrol(alucontrol)
);

// Testbench logic
initial begin
// Initialize Inputs
funct = 0;
aluop = 0;

// Wait for global reset
#100;

// Test various combinations
funct = 6'b100000; aluop = 2'b00; #100;
funct = 6'b100101; aluop = 2'b00; #100;
funct = 6'b100000; aluop = 2'b00; #100;
funct = 6'b100111; aluop = 2'b00; #100;
funct = 6'b100010; aluop = 2'b00; #100;
funct = 6'b101010; aluop = 2'b00; #100;
funct = 6'b000000; aluop = 2'b00; #100;
funct = 6'b000010; aluop = 2'b00; #100;

funct = 6'bxxxxxx; aluop = 2'b01; #100; // Tests for partial don't care in `funct`
funct = 6'bxxxxxx; aluop = 2'b10; #100; // Tests for partial don't care in `funct`
funct = 6'bxxxxxx; aluop = 2'b11; #100; // Tests for partial don't care in `funct`

// Additional test for undefined operation
funct = 6'b010101; aluop = 2'b11; #100;

// Finish simulation
$finish;
end

// Monitor changes
initial begin
$monitor("At time %t, funct = %b, aluop = %b, alucontrol = %b", $time, funct, aluop, alucontrol);
end

endmodule
`endif // TB_ALUDEC
16 changes: 8 additions & 8 deletions catalog/computer/mult-prog_exe
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
2002000a
2003000f
00620018
00001010
00001012
ac020054
00000000
00000000
0c040004
0c050004
0C060002
0C070005
00854020
00c74820
01098022
02001020
00000000
00000000
00000000
Expand Down
Loading