Please consult the list of instructions to be implemented . The following is a quick summary of that list:
Opcode | Manual page | Variations |
---|---|---|
ADD | 3-22 | All variations |
OR | 3-32 | All variations |
BTC | 3-57 | All variations |
CALL | 3-59 | All variations except m16:16 and m16:32 |
CLD | 3-73 | All variations |
CMOVC | 3-81 | All variations of CMOVC |
SCAS | 3-96 | All CMPS variations |
CMPXCHG | 3-107 | All variations |
DAA | 3-182 | All variations |
HLT | 3-324 | All variations |
IRETD | 3-354 | IRETD variation for 32-bit stack |
Jcc | 3-362 | All JNE and JNBE variations (4 total) |
JMP | 3-366 | All variations except m16:16 and m16:32 |
MOV | 3-441 | All variations except moffs format |
MOVQ | 3-486 | All variations except xmm format |
NOT | 3-517 | All variations |
PADDD | 3-537 | All variations except xmm format |
POP | 3-599 | All variations |
PINSRW | 3-653 | All variations |
PUSH | 3-663 | All variations |
REPNE SCAS | 3-687 | Repeat CMPS variation only |
RET | 3-690 | All variations |
SAL | 3-703 | All variations of SAL |
SAR | 3-703 | All variations of SAR |
STD | 3-745 | All variations |
XCHG | 3-803 | All variations |
Note that the NOP
instruction is a special case of the XCHG
instruction.
An effective address is computed from the instruction, e.g., a base plus displacement specified with the Mod r/m byte.
A linear address is calculated by summing the effective address with the appropriate segment register having been shifted 16 bits to the left for a total size of 32-bits.
Main memory is 32KB in size. The exact configuration is per your design. Please use the SRAM parts from the library to construct your main memory.
Instruction and data cache size is limited to 1KB of data storage total. The exact configurations are per your design; however, the cache line size must be greater than your data bus width. Please use RAM parts from the library to construct your tag and data stores. You may use register parts to construct the valid bits, so that they can be initialized to zero easily.
A bus must connect the processor, main memory and your I/O devices. Its width and arbitration scheme are per your design; however, the maximum data bus width is 32 bits.
When using the gates from the library, each gate is itself able to drive up to 4 other gates. If you need to drive more than 4 inputs buffering is required. We have provided several buffers in the library modules. Please adhere to the following rules while providing buffering:
Each segment has a constant (hardwired) segment limit associated with it. When an effective address exceeds the segment limit a general protection exception is taken (see Interrupts and Exceptions below for details). Be advised that when accessing a word, double word, or quad word, all the bytes in the data must fall within the segment limit.
Default Segment Register Details
As explained in Section 3.7.3.1, Table 3-2 of the Basic Architecture manual, SS
, not DS
, is the default segment register for memory accesses involving [EBP] + disp8
and [EBP] + disp32
addressing modes, as well as when ESP
is used as the base register in the SIB byte (remember, you do not need to implement SIB addressing modes using EBP
as the base register).
You are required to implement parts of a virtual memory system as specified below.
The page size for your project is 4KB.
A Translation Lookaside Buffer (TLB) will be used to translate between virtual page numbers and physical frame numbers. Each TLB entry will contain at least the following flags: a valid bit, a present flag, and a read/write flag. Note a translation can be valid without the page being present in main memory, hence the valid and present flags. Depending on your design, you may or may not need a PCD flag (Page-level Cache Disable) for your I/O devices. See I/O Devices below.
A page can be in the “read only” state or in the “read or write state,” as indicated by the read/write flag.
The TLB will hold 8 entries, 6 of which will be hardcoded to values specified by your TA. The other two entries are per your design, e.g., memory mapped I/O or other project specific purposes.
If the processor tries to write a read only page, then a general protection exception is taken. If the processor tries to access a page not present in the TLB or a page not present in physical memory, then a page fault is taken. (Note the abstraction: you are not required to implement the x86 page directory table for this project.)
Note that multiple virtual pages could potentially map to the same physical frame.
You are required to implement at least one simple and one complicated I/O device for your project. See the LC-3B documentation (LC-3B ISA, LC-3B Microarchitecture) for simple examples of memory mapped keyboard and monitor registers. An example of a more complicated I/O device is a DMA controller. Be advised that memory addresses that correspond to memory mapped I/O devices cannot be cached. You can use the TLB to indicate that a page cannot be cached by setting the PCD flag (Page-level Cache Disable) in the TLB. In this case, you will issue the request to main memory directly.
You are required to support at least one external interrupt from one of your I/O devices. The two exceptions that you are required to support are the general protection exception and page fault. Note that both instruction and data accesses may cause these exceptions.
General protection exceptions are caused by writing to a read only page or when computing a memory operand with an effective address outside the CS, DS, ES, FS or GS segment limit. Note that accessing memory outside the stack segment(SS), limit causes a Stack Segment Exception which is not required for this project.
Page faults are caused by accessing a page that is not in the TLB or not present in physical memory.
There will be no nested interrupts/exceptions.
The procedure for transferring control to the interrupt and exception handler is the following:
The IRETD
instruction will appear at the end of the interrupt
service routine and will pop the EIP, CS and EFLAGS registers.
The far pointer pointing to the service routine is found by indexing into the IDT with the interrupt or exception vector.
The IDTR register contains a pointer to the base address of the IDT. The value in the IDTR is a linear address. The IDTR register is actually a 6-byte register, where the first 4 bytes are the base address of the IDT and the final 2 bytes are the limit of the base address. You are not required to implement limit checking on the IDT. Therefore the first 4 bytes are all that you need to worry about for this project. IDTR will be hardwired at initialization time and won't change while the processor is running.
The vector number for the page fault is 14 and the vector number for general protection exception is 13.
If an instruction causes both a General Protection exception and a Page Fault, your machine should handle the General Protection exception and ignore the Page Fault.
Interrupt Descriptor Table Details
Make sure that your design uses the Interrupt Descriptor Table entry format described in Section 5.11, Figure 5-2 of the System Programming Guide.