Jump to content
  • entry
    1
  • comments
    2
  • views
    1,249

Simulated Processor - Creating an instruction Set

SilicateWielder

1,085 views

Hello,

 

So the other day, I was bored and thought, "You know what, I want to learn how to design a working instruction set," and thus I have been working out the details for a simulated processor using my own custom instruction set rather than getting some homework done that I really should be doing.

 

Here is what I currently have worked out:

Croltex SM8 (simulated processor) specs
------------------------------------
L1 Cache - 64 bytes
L2 Cache - 128 bytes
L3 Cache - 256 bytes
L4 Cache - 512 bytes (Because I want to have L4 cache)

Instruction Set - Multimode 8-bit (M8)

M8 Instruction set definitions
------------------------------
  /------------ Function group
  |    /--- Operation
  |    |
0000 0000

Instruction set Data Tags (0000)

	0000 0000 (00 00) = T-CBH (Marker - Command Begins Here)
	0000 0001 (00 01) = T-CCH (Marker - Command Continues Here)
	0000 0010 (00 02) = T-CEH (Marker - Command Ends Here)
	0000 0011 (00 03) = T-VBH (Marker - Variable Begins Here)
	0000 0100 (00 04) = T-LBH (Marker - List Begins Here)
	0000 0101 (00 05) = T-SBH (Marker - String Begins Here)
	0000 0110 (00 06) = T-IBH (Marker - Integer Begins Here)
	0000 0111 (00 07) = T-FBH (Marker - Float Begins Here)
	0000 1000 (00 08) = T-FBH (Marker - Boolean Begins Here)
	0000 1001 (00 09) = T-OBH (Marker - Operator Begins Here)
	0000 1010 (00 10) = T-NVH (Marker - Null Value Here)
	0000 1011 (00 11) = T-PBH (Marker - Parameter Begins Here)
	0000 1100 (00 12) = T-PEH (Marker - Parameter Ends Here)
	0000 1101 (00 13) = T-FBH (Marker - File Begins Here)
	0000 1110 (00 14) = T-FEH (Marker - File Ends Here)

Variable operations (0001)
	0001 0000 (01 00) = V-CEV (Variable - Create Empty Variable)
	0001 0001 (01 01) = V-LVC (Variable - Lock Variable Content)
	0001 0010 (01 01) = V-UVC (Variable - Unlock Variable Content)
	0001 0011 (01 03) = V-SVC (Variable - Set Variable Content)
	0001 0100 (01 04) = V-GVC (Variable - Get Variable Content)
	0001 0101 (01 05) = V-MVL (Variable - Make Locally Available)
	0001 0110 (01 06) = V-MVG (Variable - Make Globally Available)

List operations (0010)
	0010 0000 (02 00) = L-CEL (List - Create Empty List)
	0010 0001 (02 01) = L-LLC (List - Lock List Content)
	0010 0010 (02 02) = L-ULC (List - Unlock List Content)
	0010 0011 (02 03) = L-SVC (List - Set Value's Content)
	0010 0100 (02 04) = L-GVC (List - Get Value's Content)
	0010 0101 (02 05) = L-MLA (List - Make Locally Available)
	0010 0110 (02 06) = L-MGA (List - Make Globally Available)
	

Mathematical operations (0011)
	0011 0000 (03 00) = M-SAO (Math - Standard Addition Operation)
	0011 0001 (03 01) = M-SSO (Math - Standard Subtraction Operation)
	0011 0010 (03 02) = M-SMO (Math - Standard Multiplication Operation)
	0011 0011 (03 03) = M-SDO (Math - Standard Division Operation)
	0011 0100 (03 04) = M-SEO (Math - Standard Exponential Operation)
	0011 0101 (03 05) = M-SRO (Math - Square Root Operation)
	0011 0110 (03 06) = M-SCO (Math - Standard Ceiling Operation)
	0011 0111 (03 07) = M-SFO (Math - Standard Floor Operation)
	0011 1000 (04 08) = M-SRO (Math - Standard Rounding Operation)
	0011 1001 (04 09) = M-SAO (Math - Standard Absolute Operation)
	0011 1010 (04 10) = M-SCO (Math - Standard Cosine Operation)
	0011 1011 (04 11) = M-SSO (Math - Standard Sine Operation)
	0011 1100 (04 12) = M-STO (Math - Standard Tan Operation)
	0011 1101 (04 13) = M-ACO (Math - Anti Cosine Operation)
	0011 1110 (04 14) = M-ASO (Math - Anti Sine Operation)
	0011 1111 (04 15) = M-ATO (Math - Anti Tan Operation)

Comparison Operations (0100)
	0100 0000 (04 00) = C-VAI (Comparison - Values Are Same)
	0100 0001 (04 01) = C-VNI (Comparison - Values Not Same)
	0100 0010 (04 02) = C-VTS (Comparison - Value Types are Same)
	0100 0011 (04 03) = C-VTI (Comparison - Value Type is)
	0100 0100 (04 04) = C-VTA (Comparison - Value Types Are)
	0100 0101 (04 05) = C-FVG (Comparison - First Value is Greater)
	0100 0110 (04 06) = C-FVL (Comparison - First Value is Lesser)

String operations (0101)
	0101 0000 (05 00) = S-CVS (Strings - Concatenate Values as String)
	0101 0001 (05 01) = S-CVL (Strings - Concatenate Values as List)

RAM Operations (0110)
	0111 0000 (07 00) = R-SFD (Storage - Search for Devices)
	0111 0001 (07 01) = R-SDI (Storage - Select Device ID)
	0111 0010 (07 02) = R-GMC (Storage - Get RAM Capacity)
	0111 0011 (07 03) = R-GMU (Storage - Get RAM Usage)
	0111 0100 (07 04) = R-CNF (Storage - Create New File)
	0111 0101 (07 05) = R-GFI (Storage - Get File ID)
	0111 0110 (07 06) = R-GFS (Storage - Get File Size)
	0111 0111 (07 07) = R-SAF (Storage - Select Active File)
	0111 1000 (07 08) = R-RFC (Storage - Rewrite File Content)
	0111 1001 (07 09) = R-AFC (Storage - Add File Content)
	0111 1010 (07 10) = R-DFE (Storage - Delete File Entry)

Storage Operations (0111)
	0111 0000 (07 00) = S-SFD (Storage - Search for Devices)
	0111 0001 (07 01) = S-SDI (Storage - Select Device ID)
	0111 0010 (07 02) = S-GSC (Storage - Get Storage Capacity)
	0111 0011 (07 03) = S-GSU (Storage - Get Storage Usage)
	0111 0100 (07 04) = S-SSF (Storage - Search Stored Files)
	0111 0101 (07 05) = S-CNF (Storage - Create New File)
	0111 0110 (07 06) = S-GFI (Storage - Get File ID)
	0111 0111 (07 07) = S-GFS (Storage - Get File Size)
	0111 1000 (07 08) = S-SAF (Storage - Select Active File)
	0111 1001 (07 09) = S-SFN (Storage - Change File Name)
	0111 1010 (07 10) = S-RFC (Storage - Rewrite File Content)
	0111 1011 (07 11) = S-AFC (Storage - Add File Content)
	0111 1100 (07 12) = S-DFE (Storage - Delete File Entry)

System Operations (1000)
	1000 0000 (08 00) = P-CNP (Processor - Create New Process)
	1000 0001 (08 01) = P-CNP (Processor - Kill Process)
	1000 0010 (08 02) = P-GPL (Processor - Grab Process List) 
	1000 0010 (08 04) = P-GDL (Processor - Grab Device List)
	1000 0000 (08 05) = P-LIM (Processor - Load Instruction from Memory)
	1000 0001 (08 06) = P-PLI (Processor - Perform Loaded Instruction)

 

2 Comments

My major criticism is that it's very high level and complex, as in each instruction is trying to do a lot of things at once. This looks more like an API for system software related things, like the POSIX standard.

 

I guess it depends on what you were trying to do though, design wise.

Link to comment
Link to post
On 6/2/2017 at 10:16 PM, M.Yurizaki said:

My major criticism is that it's very high level and complex, as in each instruction is trying to do a lot of things at once. This looks more like an API for system software related things, like the POSIX standard.

 

I guess it depends on what you were trying to do though, design wise.

Thanks for the input, I'll try and simplify the instruction set.

Link to comment
Link to post
×