CSE141L
CSE141L
Based on the given requirements, here is a possible specification for your Instruction Set
Architecture (ISA):
2. Instruction Formats:
- The ISA supports two instruction formats: R-format and I-format.
R-format:
- 3 bits for the opcode
- 3 bits for the source register A
- 3 bits for the source register B
- The result is stored in the destination register
I-format:
- 3 bits for the opcode
- 3 bits for the source register
- 3 bits for the immediate value (used for data or branch target address)
3. Registers:
- The ISA has a total of 8 registers.
- 6 general-purpose registers (R0-R5).
- 2 specialized registers (Instruction Pointer and Flags Register).
- The specialized registers are not directly accessible but are used internally for program
control and flags.
5. Addressing Modes:
- For memory instructions:
- Load: Direct addressing mode using an 8-bit address pointer.
- Store: Direct addressing mode using an 8-bit address pointer.
- For branch instructions:
- Branch if equal/branch if not equal: Immediate addressing mode for the branch target
address.
Please note that this is just one possible specification based on the given requirements. You can
modify and refine it as per your design choices and specific program requirements.
Program1:
To generate the corresponding 16-bit encoded versions for the given series of 11-bit message
blocks, you can use the provided input and output formats. Here's the step-by-step process:
1. Start with the first message block, mem[0], which contains the lower 8 data bits: b8 b7 b6 b5
b4 b3 b2 b1.
- p4 = ^(b11:b8, b4, b3, b2) = ^(0 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2) = b11 ⊕ b10 ⊕ b9 ⊕ b8 ⊕
b4 ⊕ b3 ⊕ b2.
- p2 = ^(b11, b10, b7, b6, b4, b3, b1) = ^(0 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1) = b11 ⊕ b10
⊕ b7 ⊕ b6 ⊕ b4 ⊕ b3 ⊕ b1.
- p1 = ^(b11, b9, b7, b5, b4, b2, b1) = ^(0 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1) = b11 ⊕ b9 ⊕
b7 ⊕ b5 ⊕ b4 ⊕ b2 ⊕ b1.
- p0 = ^(b11:1, p8, p4, p2, p1) = ^(0 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 p8 p4 p2 p1) = b11 ⊕
b10 ⊕ b9 ⊕ b8 ⊕ b7 ⊕ b6 ⊕ b5 ⊕ p8 ⊕ p4 ⊕ p2 ⊕ p1.
Repeat the above steps for each of the fifteen 11-bit message blocks, updating the memory
locations accordingly.
Program2:
To recover the original message from the series of 15 two-byte encoded data values in data
mem[30:59], you can use the provided coding scheme that can correct any single-bit error and
detect any two-bit error. Here's the step-by-step process:
1. Start with the first encoded data value in mem[30] and mem[31]. This corresponds to the
MSW and LSW of the encoded value.
4. If there are no errors (F1F0 = 00), store the extracted bits in the corresponding memory
locations in mem[0:29] as follows:
- mem[0] = D11.
- mem[1] = D10.
- mem[2] = D9.
- mem[3] = D8.
- mem[4] = D7.
- mem[5] = D6.
- mem[6] = D5.
- mem[7] = D4.
- mem[8] = D3.
- mem[9] = D2.
- mem[10] = D1.
- mem[11] = D0.
5. If there is one error (F1F0 = 01), you need to correct the error. Determine the bit position of
the error by converting the binary value of F1F0 to decimal (e.g., F1F0 = 01 corresponds to an
error in the least significant bit).
6. Correct the error by flipping the bit at the error position. For example, if the error position is
5, flip the value of mem[4].
7. Store the corrected bits in the corresponding memory locations in mem[0:29] as described in
step 4.
8. If there are two errors (F1F0 = 1X), you only need to set F1 to 1 to indicate the presence of
two errors. The exact error positions or values cannot be recovered, so no further action is
required.
9. Repeat steps 2-8 for each of the 15 encoded data values, updating the memory locations
accordingly.
Note: The exact number of possible inputs for each of the 2^11 possible outputs depends on
the specific coding scheme used, which is not provided in the question.
Program3:
1. Initialize necessary counters
2. Extract 5-bit pattern from data_mem[32]
3. Iterate from data_mem[0] to data_mem[31]
4. Iterate through each byte within (0 to 7)
5. Compare the 5 bits with the 5-bit pattern
6. If found, break loop and increment counter1
7. If counter1>0, counter2++
8. Counter3 = counter3 + counter1
9. Data_mem[33] = counter1
10. Data_mem[34] = counter2
11. Data_mem[35] = counter3
12. Repeat 3-11 for full message
Milestone 1:
Milestone 1 Components:
1. Introduction:
- Architecture Name: "FlexiCore"
- Overall Philosophy: FlexiCore aims to provide a flexible and versatile processor architecture
that can efficiently handle a wide range of computational tasks.
- Specific Goals:
- High performance through parallelism and efficient instruction execution.
- Support for various addressing modes and memory operations.
- Compact instruction set for code density.
- Support for error detection and correction in communication protocols.
- Classification: FlexiCore belongs to the register-based architecture class.
2. Architectural Overview:

- Major Building Blocks:
- Instruction Fetch Unit (IFU): Fetches instructions from memory.
- Instruction Decode Unit (IDU): Decodes instructions and identifies their formats.
- Register File: Stores general-purpose registers.
- Arithmetic and Logic Unit (ALU): Performs arithmetic and logical operations.
- Memory Unit: Handles memory operations (load/store).
- Control Unit: Controls the execution flow and handles branching and control signals.
3. Machine Specification:
- Instruction Formats:
- Format 1: Register-Immediate (RI)
- Example: ADDI R1, R2, #10
- Format 2: Register-Register (RR)
- Example: ADD R1, R2, R3
- Format 3: Branch (B)
- Example: BEQ R1, R2, label
- Operations:
- ADD: Addition of two register values
- ADDI: Addition of a register and an immediate value
- BEQ: Branch if two registers are equal
- Internal Operands:
- General-purpose registers: R0-R7
- All registers are general-purpose and have no special functionality.
- Control Flow (Branches):
- Types: Conditional branch (BEQ)
- Target addresses are calculated based on the branch instruction and the offset specified.
- Maximum branch distance supported: ±2047 instructions (12-bit signed offset).
- Addressing Modes:
- Supported Modes: Direct addressing
- Addresses are calculated directly using the immediate or register values specified in the
instruction.
Program1:
# Program 1 - Forward Error Correction Block Coder/Transmitter
# Initialize data memory addresses
MSW_INPUT_ADDR = 0
LSW_INPUT_ADDR = 1
MSW_OUTPUT_ADDR = 30
LSW_OUTPUT_ADDR = 31
Program2:
# Program 2 - Forward Error Correction Block Decoder
# Compare the calculated parity bits with the input parity bits
IF INPUT[9:8] != p8:
parity_error_count += 1
ENDIF
IF INPUT[7:6] != p4:
parity_error_count += 1
ENDIF
IF INPUT[5:3] != p2:
parity_error_count += 1
ENDIF
IF INPUT[2:1] != p1:
parity_error_count += 1
ENDIF
IF INPUT[0] != p0:
parity_error_count += 1
ENDIF
Program3:
# Program 3 - Pattern Search
# Initialize counters
total_occurrences = 0
bytes_within_pattern = 0
total_count = 0
# Check if the current byte contains at least one copy of the pattern
IF occurrences > 0:
bytes_within_pattern += 1
ENDIF
# Update the total count considering the possibility of pattern spanning adjacent bytes
IF i != 31:
IF byte[7:3] + MESSAGE[i+1][2:0] == PATTERN:
total_count += 1
ENDIF
ENDIF
ENDFOR
Program 1 assembly:
# Declare variables for parity bits
.data
p0: .word 0
p8: .word 0
p4: .word 0
p2: .word 0
p1: .word 0
# Main program
.text
main:
# Initialize variables
li $t0, 0 # i = 0
# Increment i
addi $t0, $t0, 1
j loop
done:
# Set the done signal to indicate completion
li $t0, 1
sw $t0, done