資源簡介
計算機原理課程實習報告,簡單模擬CPU的工作過程,包含代碼,實習報告,可運行

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
using?System.IO;
using?System.Text.Regularexpressions;
namespace?WindowsFormsCPU
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????????//通用寄存器初始化
????????????R0.Text?=?“00000000“;
????????????R1.Text?=?“00000000“;
????????????R2.Text?=?“00000000“;
????????????R3.Text?=?“00000000“;
????????????R4.Text?=?“00000000“;
????????????R5.Text?=?“00000000“;
????????????R6.Text?=?“00000000“;
????????????R7.Text?=?“00000000“;
????????????R8.Text?=?“00000000“;
????????????R9.Text?=?“00000000“;
????????????R10.Text?=?“00000000“;
????????????R11.Text?=?“00000000“;
????????????R12.Text?=?“00000000“;
????????????R13.Text?=?“00000000“;
????????????R14.Text?=?“00000000“;
????????????R15.Text?=?“00000000“;
????????????SR.Text?=?“00000000“;
????????}
????????//數值初始化
????????//指令數組總數
????????public?int?instructionSum?=?0;
????????//指令的字符串數組
????????public?string[]?instruction;
????????//單步執行指令的步數
????????public?int?stepCount?=?0;
????????//空格指令分割函數,返回的是指令碼的字符串
????????static?string?getIrString(string?str)
????????{
????????????string[]?tempStr;
????????????tempStr?=?str.Split(‘?‘);
????????????//測試空格分割
????????????//foreach?(string?i?in?tempStr)
????????????//{
????????????//????Console.Write(“經過空字符分割的指令“);
????????????//????Console.WriteLine(i);
????????????//}
????????????//空分割測試函數
????????????Console.WriteLine(“getIrString,返回的指令碼是{0}“tempStr[0]);
????????????return?tempStr[0];
????????}
????????//指令碼譯碼函數,要求形參是完整的指令,返回對應的指令碼的字符串
????????static?string?getIrBinaryString(string?str)
????????{
????????????str?=?getIrString(str);
????????????string?tempStr?=?getIrString(str);
????????????Console.WriteLine(“getIrBinaryString?指令碼{0}“?tempStr);
????????????if?(str?==?“add“)
????????????????tempStr?=?“00001100“;
????????????else?if?(str?==?“sub“)
????????????????tempStr?=?“00001000“;
????????????else?if?(str?==?“Mul“)
????????????????tempStr?=?“10011100“;
????????????else?if?(str?==?“RJMP“)
????????????????tempStr?=?“1100“;
????????????else?if?(str?==?“BRMI“)
????????????????tempStr?=?“11110001“;
????????????else?if?(str?==?“Mov“)
????????????????tempStr?=?“00101100“;
????????????else?if?(str?==?“Ldi“)
????????????{
????????????????tempStr?=?“1110“;
????????????????Console.WriteLine(“getIrBinaryString?中,翻譯了Ldi“);
????????????}
???????????????//?tempStr?=?“1110“;
????????????else?if?(str?==?“Ld“)
????????????????tempStr?=?“10010000“;
????????????else?if?(str?==?“st“)
????????????????tempStr?=?“10010010“;
????????????else?if?(str?==?“nop“)
????????????????tempStr?=?“00000000“;
????????????tempStr?=?newStr(tempStr);
????????????return?tempStr;
????????}
????????//指令拼接部分,返回部分一個長度為8的字符串,將一個字符串復制
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-07-14?16:31??201614600226吳廣麗\
?????目錄???????????0??2018-07-14?16:30??201614600226吳廣麗\WindowsFormsCPU\
?????目錄???????????0??2018-07-14?16:30??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\
?????文件?????????187??2018-06-30?13:53??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\App.config
?????文件???????25288??2018-07-01?20:24??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\Form1.Designer.cs
?????文件???????25285??2018-07-01?22:03??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\Form1.cs
?????文件????????5817??2018-07-01?20:24??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\Form1.resx
?????文件?????????527??2018-06-30?13:53??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\Program.cs
?????目錄???????????0??2018-07-14?16:30??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\Properties\
?????文件????????1354??2018-06-30?13:53??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\Properties\AssemblyInfo.cs
?????文件????????2882??2018-06-30?13:53??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\Properties\Resources.Designer.cs
?????文件????????5612??2018-06-30?13:53??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\Properties\Resources.resx
?????文件????????1102??2018-06-30?13:53??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\Properties\Settings.Designer.cs
?????文件?????????249??2018-06-30?13:53??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\Properties\Settings.settings
?????文件????????3810??2018-06-30?14:18??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\WindowsFormsCPU.csproj
?????目錄???????????0??2018-07-14?16:30??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\bin\
?????目錄???????????0??2018-07-14?16:30??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\bin\Debug\
?????文件???????24064??2018-07-01?22:03??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\bin\Debug\WindowsFormsCPU.exe
?????文件?????????187??2018-06-30?13:53??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\bin\Debug\WindowsFormsCPU.exe.config
?????文件???????54784??2018-07-01?22:03??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\bin\Debug\WindowsFormsCPU.pdb
?????文件???????24224??2018-07-01?22:37??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\bin\Debug\WindowsFormsCPU.vshost.exe
?????文件?????????187??2018-06-30?13:53??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\bin\Debug\WindowsFormsCPU.vshost.exe.config
?????文件?????????490??2018-04-12?07:35??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\bin\Debug\WindowsFormsCPU.vshost.exe.manifest
?????目錄???????????0??2018-07-14?16:30??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\obj\
?????目錄???????????0??2018-07-14?16:30??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\obj\Debug\
?????文件????????1453??2018-07-01?17:27??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????7192??2018-07-01?22:35??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????目錄???????????0??2018-07-14?16:31??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\obj\Debug\TempPE\
?????文件???????????0??2018-06-30?13:53??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件???????????0??2018-06-30?13:53??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件???????????0??2018-06-30?13:53??201614600226吳廣麗\WindowsFormsCPU\WindowsFormsCPU\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
............此處省略11個文件信息
- 上一篇:基本粒子群算法
- 下一篇:葡萄酒支持向量機SVM分類
評論
共有 條評論