add mul, disable slow mode

This commit is contained in:
2020-09-25 00:08:47 +02:00
parent 88a4d77b8f
commit f7e0998696
3 changed files with 33 additions and 4 deletions
+11 -2
View File
@@ -166,8 +166,17 @@ impl RunThread {
// TODO carry?
frame.write(*dst, val)?;
}
Op::Mul(_, _) => {
unimplemented!()
Op::Mul(dst, src) => {
frame.status.clear();
let mut a = frame.read(dst.as_rd())?;
let mut b = frame.read(*src)?;
let val = a.wrapping_mul(b);
frame.status.zero = (val == 0);
frame.status.positive = is_positive(val);
frame.status.negative = is_negative(val);
//frame.status.overflow = b > a; // TODO detect overflow
frame.write(*dst, val)?;
}
Op::Div(_, _) => {
unimplemented!()
+2 -1
View File
@@ -10,7 +10,8 @@ use crate::frame::StackFrame;
use crate::program::Program;
use crate::exec::EvalRes;
const CYCLE_TIME : Duration = Duration::from_millis(100);
const CYCLE_TIME : Duration = Duration::from_millis(0);
//const CYCLE_TIME : Duration = Duration::from_millis(100);
#[derive(Clone, Copy, Eq, PartialEq, Debug, Ord, PartialOrd)]
pub struct ThreadToken(pub u32);