Skip to content

Commit

Permalink
Save Changes & Submit
Browse files Browse the repository at this point in the history
  • Loading branch information
MJChku committed Feb 24, 2024
1 parent 7b355ae commit ab4d714
Show file tree
Hide file tree
Showing 43 changed files with 4,968 additions and 15 deletions.
17 changes: 17 additions & 0 deletions output.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Test passed
Test passed
Left barrel shifter test passed
Warning: file 'v1.hex' for memory 'a_memory' has a gap at addresses 64 to 255.
Warning: file 'v2.hex' for memory 'b_memory' has a gap at addresses 64 to 255.
STARTING TEST FOR VECTOR DOT PRODUCT DIM 16... index 0
GOT 410
Test 0 passed
STARTING TEST FOR VECTOR DOT PRODUCT DIM 16... index 1
GOT 354
Test 1 passed
STARTING TEST FOR VECTOR DOT PRODUCT DIM 16... index 2
GOT 524
Test 2 passed
STARTING TEST FOR VECTOR DOT PRODUCT DIM 16... index 3
GOT 410
Test 3 passed
1 change: 1 addition & 0 deletions output1.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test passed
1 change: 1 addition & 0 deletions output2.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test passed
1 change: 1 addition & 0 deletions output3.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Left barrel shifter test passed
14 changes: 14 additions & 0 deletions output4.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Warning: file 'v1.hex' for memory 'a_memory' has a gap at addresses 64 to 255.
Warning: file 'v2.hex' for memory 'b_memory' has a gap at addresses 64 to 255.
STARTING TEST FOR VECTOR DOT PRODUCT DIM 16... index 0
GOT 410
Test 0 passed
STARTING TEST FOR VECTOR DOT PRODUCT DIM 16... index 1
GOT 354
Test 1 passed
STARTING TEST FOR VECTOR DOT PRODUCT DIM 16... index 2
GOT 524
Test 2 passed
STARTING TEST FOR VECTOR DOT PRODUCT DIM 16... index 3
GOT 410
Test 3 passed
8 changes: 7 additions & 1 deletion part_1_combinational/Alu.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ typedef enum {
} InstructionType deriving (Eq,FShow, Bits);

function Bit#(32) alu (InstructionType ins, Bit#(32) v1, Bit#(32) v2);
return 0;
case (ins) matches
Add: return v1+v2;
ShiftL: return v1 << v2;
And: return v1 & v2;
Not: return ~v1;
default: return 0;
endcase
endfunction

12 changes: 12 additions & 0 deletions part_1_combinational/AluTest
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

BLUESPECDIR=`echo 'puts $env(BLUESPECDIR)' | bluetcl`

for arg in $@
do
if (test "$arg" = "-h")
then
exec $BLUESPECDIR/tcllib/bluespec/bluesim.tcl $0.so mkTest --script_name `basename $0` -h
fi
done
exec $BLUESPECDIR/tcllib/bluespec/bluesim.tcl $0.so mkTest --script_name `basename $0` --creation_time 1708789202 "$@"
Binary file added part_1_combinational/AluTest.so
Binary file not shown.
12 changes: 12 additions & 0 deletions part_1_combinational/ArbiterTest
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

BLUESPECDIR=`echo 'puts $env(BLUESPECDIR)' | bluetcl`

for arg in $@
do
if (test "$arg" = "-h")
then
exec $BLUESPECDIR/tcllib/bluespec/bluesim.tcl $0.so mkTest --script_name `basename $0` -h
fi
done
exec $BLUESPECDIR/tcllib/bluespec/bluesim.tcl $0.so mkTest --script_name `basename $0` --creation_time 1708789206 "$@"
Binary file added part_1_combinational/ArbiterTest.so
Binary file not shown.
17 changes: 14 additions & 3 deletions part_1_combinational/CombArbiter.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,19 @@ typedef struct {
Bit#(4) index;
} ResultArbiter deriving (Eq, FShow);

function ResultArbiter arbitrate(Vector#(16, Bit#(1)) ready, Vector#(16, Bit#(31)) data);
return ResultArbiter{valid: False, data : 0, index: 0};
// TODO
function ResultArbiter arbitrateTree(Vector#(16, Bit#(1)) ready, Vector#(16, Bit#(31)) data, Integer _start, Integer _end);
if(_start == _end) begin
return ResultArbiter{valid: ready[_start]==1, data: data[_start], index: fromInteger(_start)};
end
else begin
Integer mid = (_start + _end) / 2;
ResultArbiter left = arbitrateTree(ready, data, _start, mid);
ResultArbiter right = arbitrateTree(ready, data, mid+1, _end);
if(left.valid) return left;
else return right;
end
endfunction

function ResultArbiter arbitrate(Vector#(16, Bit#(1)) ready, Vector#(16, Bit#(31)) data);
return arbitrateTree(ready, data, 0, 15);
endfunction
10 changes: 9 additions & 1 deletion part_1_combinational/Shifter.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ endfunction


function Vector#(16, Word) barrelLeft(Vector#(16, Word) in, Bit#(4) shftAmnt);
return unpack(0);
Vector#(16, Word) resultVector = newVector();
Bit#(5) max = 16;
Bit#(5) wrapAmnt = max-{0, shftAmnt};
Vector#(16, Word) result = naiveShfl(in, shftAmnt);
for(Integer i = 0; i < 16; i = i + 1) begin
if( fromInteger(i) >= wrapAmnt)
result[i] = in[fromInteger(i)-wrapAmnt];
end
return result;
// Implementation of a left barrel shifter
endfunction
12 changes: 12 additions & 0 deletions part_1_combinational/ShifterTest
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

BLUESPECDIR=`echo 'puts $env(BLUESPECDIR)' | bluetcl`

for arg in $@
do
if (test "$arg" = "-h")
then
exec $BLUESPECDIR/tcllib/bluespec/bluesim.tcl $0.so mkTest --script_name `basename $0` -h
fi
done
exec $BLUESPECDIR/tcllib/bluespec/bluesim.tcl $0.so mkTest --script_name `basename $0` --creation_time 1708789210 "$@"
Binary file added part_1_combinational/ShifterTest.so
Binary file not shown.
Binary file added part_1_combinational/build/Alu.bo
Binary file not shown.
Binary file added part_1_combinational/build/AluTest.bo
Binary file not shown.
Binary file added part_1_combinational/build/ArbiterTest.bo
Binary file not shown.
Binary file added part_1_combinational/build/CombArbiter.bo
Binary file not shown.
Binary file added part_1_combinational/build/Shifter.bo
Binary file not shown.
Binary file added part_1_combinational/build/ShifterTest.bo
Binary file not shown.
Binary file added part_1_combinational/build/mkTest.ba
Binary file not shown.
Loading

0 comments on commit ab4d714

Please sign in to comment.