Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Pepin
sysdig
Commits
b0d74621
Commit
b0d74621
authored
Jan 14, 2017
by
Martin Pépin
Browse files
Merge branch 'master' of git.eleves.ens.fr:mpepin/sysdig
parents
331377f9
9c7640bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
cpu/src/alu/main.mj
View file @
b0d74621
require registers
require ALU/utils
(* The ALU implementation
TODO
*)
ALU<n>(input1:[n], input2:[n], alu_control:[4]) = (alu_zero, result:[n]) where
alu_zero = false; (* TODO *)
result = input1; (* TODO *)
ALU(input1:[32], input2:[32], alu_control:[4], alu_op:[3], use_shamt,
shamt:[5], constant:[16]) = (alu_zero, result:[32]) where
R_format = equal_zero_n<3>(alu_op);
result =
mux(R_format,
mux(alu_control[0], (* if 1 then shift or HI/Lo, else logical or artih*)
mux(alu_control[2], (* if 1 then HI/LO, else logical shift *)
mux(alu_control[3], (* Case HI/LO *)
read_HI(), (*TODO*)
read_LO()
), (*TODO*)
mux(alu_control[1], (* Case logical shift *) (*TODO : optimiser use_shamt ?*)
mux(use_shamt,
shift_by_shamt_ALU(input1, shamt, 1, alu_control[3]),
shift:_by_reg_ALU(input1, input2, 1, alu_control[3])
),
mux(use_shamt, (* Case logical shift left *)
shift_by_shamt_ALU(input1, shamt, 0, 0),
shift_by_reg_ALU(input1, input2, 0, 0)
)
)
),
mux(alu_control[1], (*if 1 then logical else arihtmetical *)
mux(alu_control[2],
mux(alu_control[3],
xor_ALU(input1, input2),
nor_ALU(input1, input2)
),
mux(alu_control[3],
or_ALU(input1, input2),
and_ALU(input1, input2)
)
),
mux(alu_control[2],
mux(alu_control[3],
(*TODO : multiplication et division*)
zero_n<32>(),
zero_n<32>()
),
add_ALU(input1, input2, alu_control[3]),
)
)
),
(*TODO : opérations pas format R *)
zero_n<32>()
);
alu_zero = equal_zero_n<32>(result);
end where
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment