From 04f71ad1f0c5228cbd56996e6137479165688248 Mon Sep 17 00:00:00 2001
From: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Date: Sun, 29 Mar 2020 00:44:40 +0100
Subject: [PATCH] seminaries/qtmips/hazards-from-lecture:

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
---
 .../qtmips/hazards-from-lecture/alu-hazards.S     | 10 ++++++++++
 .../qtmips/hazards-from-lecture/beq-hazards.S     | 15 +++++++++++++++
 .../qtmips/hazards-from-lecture/lw-hazards.S      | 13 +++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 seminaries/qtmips/hazards-from-lecture/alu-hazards.S
 create mode 100644 seminaries/qtmips/hazards-from-lecture/beq-hazards.S
 create mode 100644 seminaries/qtmips/hazards-from-lecture/lw-hazards.S

diff --git a/seminaries/qtmips/hazards-from-lecture/alu-hazards.S b/seminaries/qtmips/hazards-from-lecture/alu-hazards.S
new file mode 100644
index 0000000..907d509
--- /dev/null
+++ b/seminaries/qtmips/hazards-from-lecture/alu-hazards.S
@@ -0,0 +1,10 @@
+	li   $s1, 0x11111111
+	li   $s2, 0x22222222
+	li   $s3, 0x33333333
+	li   $s4, 0x44444444
+	li   $s5, 0x55555555
+
+	add  $s0, $s2, $s3
+	and  $t0, $s0, $s1
+	or   $t1, $s4, $s0
+	sub  $t2, $s0, $s5
diff --git a/seminaries/qtmips/hazards-from-lecture/beq-hazards.S b/seminaries/qtmips/hazards-from-lecture/beq-hazards.S
new file mode 100644
index 0000000..a951d8e
--- /dev/null
+++ b/seminaries/qtmips/hazards-from-lecture/beq-hazards.S
@@ -0,0 +1,15 @@
+	li   $s1, 0x11111111
+	li   $s2, 0x22222222
+	li   $s3, 0x33333333
+	li   $s4, 0x44444444
+	li   $s5, 0x55555555
+	addi $t1, $0, 0x1234
+	addi $t2, $0, 0x1234
+
+	beq  $t1, $t2, skip
+	and  $t0, $s0, $s1
+	or   $t1, $s4, $s0
+	sub  $t2, $s0, $s5
+
+skip:
+	slt  $t3, $s2, $s3
diff --git a/seminaries/qtmips/hazards-from-lecture/lw-hazards.S b/seminaries/qtmips/hazards-from-lecture/lw-hazards.S
new file mode 100644
index 0000000..6790be5
--- /dev/null
+++ b/seminaries/qtmips/hazards-from-lecture/lw-hazards.S
@@ -0,0 +1,13 @@
+	li   $s1, 0x11111111
+	li   $s2, 0x22222222
+	li   $s3, 0x33333333
+	li   $s4, 0x44444444
+	li   $s5, 0x55555555
+
+	lw   $s0, 40($0)
+	and  $t0, $s0, $s1
+	or   $t1, $s4, $s0
+	sub  $t2, $s0, $s5
+
+.org 40
+	.word 0x12345678
-- 
GitLab