summaryrefslogtreecommitdiff
path: root/src/arch/x86/isa/insts
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-10-02 22:02:30 -0700
committerGabe Black <gblack@eecs.umich.edu>2007-10-02 22:02:30 -0700
commitfea7165b55f7eca4b1a549628029b06c5d19aa1c (patch)
tree6aa141772eba57662aa1d65e3cb529b1f2437f98 /src/arch/x86/isa/insts
parent2dd65dc2546216ef132e30f5c590e11e35b4ff37 (diff)
downloadgem5-fea7165b55f7eca4b1a549628029b06c5d19aa1c.tar.xz
X86: Implement STOS.
--HG-- extra : convert_revision : 95f3bf185f07fe644d6ab96bbb6e598e406b92f4
Diffstat (limited to 'src/arch/x86/isa/insts')
-rw-r--r--src/arch/x86/isa/insts/general_purpose/string/store_string.py58
1 files changed, 45 insertions, 13 deletions
diff --git a/src/arch/x86/isa/insts/general_purpose/string/store_string.py b/src/arch/x86/isa/insts/general_purpose/string/store_string.py
index 08a126c1f..a8655cf96 100644
--- a/src/arch/x86/isa/insts/general_purpose/string/store_string.py
+++ b/src/arch/x86/isa/insts/general_purpose/string/store_string.py
@@ -53,16 +53,48 @@
#
# Authors: Gabe Black
-microcode = ""
-#let {{
-# class STOS(Inst):
-# "Add 0 0 0"
-# class STOSB(Inst):
-# "Add 0 0 0"
-# class STOSW(Inst):
-# "Add 0 0 0"
-# class STOSD(Inst):
-# "Add 0 0 0"
-# class STOSQ(Inst):
-# "Add 0 0 0"
-#}};
+microcode = '''
+def macroop STOS_M {
+ # Find the constant we need to either add or subtract from rdi
+ ruflag t0, 10
+ movi t3, t3, dsz, flags=(CEZF,), dataSize=asz
+ subi t4, t0, dsz, dataSize=asz
+ mov t3, t3, t4, flags=(nCEZF,), dataSize=asz
+
+ st rax, es, [1, t0, rdi]
+
+ add rdi, rdi, t3, dataSize=asz
+};
+
+def macroop STOS_E_M {
+ # Find the constant we need to either add or subtract from rdi
+ ruflag t0, 10
+ movi t3, t3, dsz, flags=(CEZF,), dataSize=asz
+ subi t4, t0, dsz, dataSize=asz
+ mov t3, t3, t4, flags=(nCEZF,), dataSize=asz
+
+topOfLoop:
+ st rax, es, [1, t0, rdi]
+
+ subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
+ add rdi, rdi, t3, dataSize=asz
+ bri t0, label("topOfLoop"), flags=(CSTRZnEZF,)
+ fault "NoFault"
+};
+
+def macroop STOS_N_M {
+ # Find the constant we need to either add or subtract from rdi
+ ruflag t0, 10
+ movi t3, t3, dsz, flags=(CEZF,), dataSize=asz
+ subi t4, t0, dsz, dataSize=asz
+ mov t3, t3, t4, flags=(nCEZF,), dataSize=asz
+
+topOfLoop:
+ st rax, es, [1, t0, rdi]
+
+ subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
+ add rdi, rdi, t3, dataSize=asz
+ bri t0, label("topOfLoop"), flags=(CSTRnZnEZF,)
+ fault "NoFault"
+};
+'''