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

other #12

Merged
merged 23 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
38f2aa7
Create controlUnti.v
ravindu439 Dec 4, 2024
1e1e2d0
Merge pull request #1 from cepdnaclk/ravindus-branch
ravindu439 Dec 4, 2024
ffdabdb
Update controlUnti.v
ravindu439 Dec 4, 2024
027deca
don tb
ravindu439 Dec 4, 2024
0a09cc1
ALUunit
samadhisakunika Dec 6, 2024
5ca6ddd
imidiate genarator and mux
ravindu439 Dec 8, 2024
71cc977
Merge pull request #2 from cepdnaclk/main
ravindu439 Dec 8, 2024
6fc8886
Merge pull request #3 from cepdnaclk/ravindus-branch
ravindu439 Dec 8, 2024
ccb3794
Update README.md
ravindu439 Dec 8, 2024
45d61a8
Update README.md
ravindu439 Dec 8, 2024
07da35e
Update README.md
ravindu439 Dec 8, 2024
4dac70c
Merge pull request #4 from cepdnaclk/036
induwara23630 Dec 8, 2024
92b9d1a
Branch controller
samadhisakunika Dec 8, 2024
d6760df
Merge pull request #5 from cepdnaclk/main
samadhisakunika Dec 8, 2024
e130117
Merge pull request #6 from cepdnaclk/Samadhi
samadhisakunika Dec 8, 2024
e450d89
Merge pull request #7 from cepdnaclk/036
induwara23630 Dec 9, 2024
4e07918
Update ALU.v
ravindu439 Dec 9, 2024
df5594c
Jump
samadhisakunika Dec 9, 2024
8b7bb9d
Merge branch 'Samadhi' of https://github.com/cepdnaclk/e20-co502-RV32…
samadhisakunika Dec 9, 2024
520b882
Merge pull request #8 from cepdnaclk/main
samadhisakunika Dec 9, 2024
1f75404
Merge pull request #9 from cepdnaclk/Samadhi
samadhisakunika Dec 9, 2024
43c8595
Merge pull request #10 from cepdnaclk/main
ravindu439 Dec 9, 2024
2659b93
Merge pull request #11 from cepdnaclk/ravindus-branch
ravindu439 Dec 9, 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
18 changes: 18 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "windows-gcc-x86",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "C:/MinGW/bin/gcc.exe",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "windows-gcc-x86",
"compilerArgs": [
""
]
}
],
"version": 4
}
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": true,
"cwd": "e:/CO502-2024 Advanced Computer Architecture (Nov 2024)/e20-co502-RV32IM-pipeline-implementation-group-2/ControlUnit",
"program": "e:/CO502-2024 Advanced Computer Architecture (Nov 2024)/e20-co502-RV32IM-pipeline-implementation-group-2/ControlUnit/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
59 changes: 59 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wcast-align",
"-Wconversion",
"-Wsign-conversion",
"-Wnull-dereference"
],
"C_Cpp_Runner.msvcWarnings": [
"/W4",
"/permissive-",
"/w14242",
"/w14287",
"/w14296",
"/w14311",
"/w14826",
"/w44062",
"/w44242",
"/w14905",
"/w14906",
"/w14263",
"/w44265",
"/w14928"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.useUndefinedSanitizer": false,
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false
}
46 changes: 46 additions & 0 deletions ALUunit/ALU.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// ALU unit

module alu (data1,data2,opcode,Output);
input [31:0] data1,data2;
input [4:0] opcode;

output reg [31:0] Output;

wire [31:0] MULH_result,MULHU_result,MULHSU_result;
wire [63:0] mulh_result,mulhu_result,mulhsu_result;

assign mulh_result = $signed (data1)*$signed(data2) ; // Calculation of Multiplication High instruction
assign MULH_result = mulh_result[63:32];

assign mulhu_result = $signed (data1)*$unsigned(data2) ; // Calculation of Multiplication high unsigned values instruction
assign MULHU_result = mulhu_result[63:32];

assign mulhsu_result = $unsigned (data1)*$unsigned(data2) ; // Calculation of Multiplication high signed unsigned instruction
assign MULHSU_result = mulhsu_result[63:32];


always @(*) begin
case (opcode)
5'b00000:Output = data1+data2; //ADD instruction
5'b00001:Output = data1-data2; //SUB instruction
5'b00010:Output = data1|data2; //OR instruction
5'b00011:Output = data1^data2; //XOR instruction
5'b00100:Output = data1&data2; //AND instruction
5'b00101:Output = data1>>data2; //SLR instruction
5'b00110:Output = data1<<data2; //SLL instruction
5'b00111:Output = data1>>>data2; //SRA instruction
5'b01000:Output = data1*data2; //MUL instruction
5'b01001:Output = MULH_result; //MULH instruction
5'b01010:Output = MULHU_result; //MULHU instruction
5'b01011:Output = MULHSU_result; //MULHSU instruction
5'b01100:Output = $signed(data1)/$signed(data2); //DIV instruction
5'b01101:Output = $unsigned(data1)/$unsigned(data2); //DIVH instruction
5'b01110:Output = $signed(data1)% $signed(data2); //REM instuction
5'b01111:Output = $unsigned(data1)% $unsigned(data2); //REMU instruction
5'b10000:Output = (data1<data2)?32'b1:32'b0; //SLT instruction
5'b10001:Output = data2; //Forwarding instruction
default:Output = 32'b0;
endcase
end

endmodule
Loading
Loading