From 495846286d55ff91c22bf30de4fc67921f16198d Mon Sep 17 00:00:00 2001 From: Test_User Date: Sat, 17 Jun 2023 03:25:36 -0400 Subject: Add some parameter types, make parameters a dynamic size without harming cpu readablity too much --- cpu/instructions/overview.txt | 30 +++++++++------ cpu/instructions/parameter.txt | 83 ++++++++++++++++++++++++++++++++---------- 2 files changed, 83 insertions(+), 30 deletions(-) diff --git a/cpu/instructions/overview.txt b/cpu/instructions/overview.txt index 280c845..6ec50d3 100644 --- a/cpu/instructions/overview.txt +++ b/cpu/instructions/overview.txt @@ -21,18 +21,26 @@ Dynamic VLIW size_of_instructions // size so it won't have to parse each to find where the immediate references start for each: opcode - num_instructions - for each * params per instruction: + size_of_params // size for similar reason as to the above + if size_of_params == 0: + num_instructions + for each param: + value (see ./parameter.txt for details) + + has_shared_immediate_references + if has_shared_immediate_references: + size_of_immediate_references + for each: value - size_of_immediate_references - for each: - value - num_flag_save_definitions - for each: - instruction index in queue - which flags to save (1 bit per flag type available) - where to save them - bitwise offset in the destination (log2(bits_for_current_mode) bits) + + has_flag_save_definitions + if has_flag_save_definitions: + num_flag_save_definitions + for each: + instruction index in queue + which flags to save (1 bit per flag type available) + where to save them + bitwise offset in the destination (log2(bits_for_current_mode) bits) A minimum of instructions per queue must be accepted by all CPUs TODO: define n diff --git a/cpu/instructions/parameter.txt b/cpu/instructions/parameter.txt index 311c00a..b50266a 100644 --- a/cpu/instructions/parameter.txt +++ b/cpu/instructions/parameter.txt @@ -1,36 +1,81 @@ -n: min number of bits to be able to represent all parameter types -y: min size required to represent each power of two value less than or equal to the current mode (in bytes, and greater than or equal to 1) -x: n + y + max([min size to represent each valid offset into the immediate value array], [min size to represent all registers]) +NOTE: `required' refers to what the specification allows, not what the specific CPU allows. Format is not to be implementation dependent. + +n: min number of bits required to be able to represent all parameter types +x: min size required to represent each power of two value less than or equal to the current mode (in bytes, and greater than or equal to 1) +y: min size to specify a particular segment register Binary format: - type[n], data[x] + type[n], data[] Types: - Short immediate reference: - Value is placed directly in the data section + Single immediate reference: + Data size: x + [size of immediate value] + data[0 to x-1]: + Size of immediate value + data[x to end]: + Raw value - Immediate reference: - data[n to x-y-1]: - size of immediate value + Shared immediate reference: + Data size: x + [minimum size required to represent an offset in the immediate references section] + data[0 to x-1]: + Size of immediate value - data[x-y to x-1]: - byte offset into the array of immediate values + data[x to end]: + Offset into the array of immediate values Register: - data[n to x-y-1]: - how much of the register to use + Data size: x + [minimum size required to specify any register] + data[0 to x-1]: + How much of the register to use + + data[x to end]: + Which register to use - data[x-y to x-1]: - which register to use + Memory at single immediate reference: + Uses RAM pointed to by the value as obtained in `single immediate reference` above + SS0 will be used for filling in the segment with unspecified bits + Prepends n bits to the data: + data[0 to n-1]: + Size of memory to use - Memory at immediate reference: - Uses RAM pointed to by the value as obtained in `immediate reference` above - Size is specified by data[0 to n-1] + Memory at shared immediate reference: + Uses RAM pointed to by the value as obtained in `shared immediate reference` above + SS0 will be used for filling in the segment with unspecified bits + Prepends n bits to the data: + data[0 to n-1]: + Size of memory to use Memory at register: Uses RAM pointed to by the value as obtained in `register` above - Size is specified by data[0 to n-1] + SS0 will be used for filling in the segment with unspecified bits + Prepends n bits to the data: + data[0 to n-1]: + Size of memory to use + + Memory at single immediate reference with segment override: + Uses RAM pointed to by the value as obtained in `single immediate reference` above + Prepends n + y bits to the data: + data[0 to n-1]: + Size of memory to use + data[n to n+y-1]: + Which segment register to use + + Memory at shared immediate reference with segment override: + Uses RAM pointed to by the value as obtained in `shared immediate reference` above + Prepends n + y bits to the data: + data[0 to n-1]: + Size of memory to use + data[n to n+y-1]: + Which segment register to use + + Memory at register with segment override: + Uses RAM pointed to by the value as obtained in `register` above + Prepends n + y bits to the data: + data[0 to n-1]: + Size of memory to use + data[n to n+y-1]: + Which segment register to use TODO: Will add more later -- cgit v1.2.3