.:'
__ :'__
.'` `-' ``.
: :
: :
: :
`.__.-.__.'
I don't like this folder structure but it was imposed on us to keep the project "tidier" and simpler to recognize the hierarchy from. To be honest the constraint is understandable but it's still awful to look at and use.
As can be seen in the block schema of the processor, data and instruction memories are placed outside the CPU.
The data-path is represented in black, the control unit and its signals are blue and the hazard unit is purple.
The ALU features a Pentium 4 adder unit, a UltraSPARC T2 Shifter and Logic units and a behavioural comparator unit.
The shifter unit is based on the SUN UltraSPARC T2 design, with a three-stage shifter implemented using masks shifted by varying amounts and combined to obtain the required operation. The implemented unit is able to perform left and right logical shifts and right arithmetical shifts.
The mask generator generates four masks, that contain the
input A signal shifted by 8, 16, 24 and 32 bits respectively. The shift direction is
dictated by the op signal (00
for logical left shift, 01
for logical right shifts and
10
for arithmetical right shifts). An additional signal, msb, generates a fifth mask
that is used for AMOUNT values greater than 31. The value of msb is 0
when a
logical shift is being performed and is equals to the most-significant bit of A when
an arithmetic shift is selected.
The coarse shift stage selects the coarse mask by considering the 30 most-significant bits of the AMOUNT signal. If AMOUNT is bigger than 31, the coarse shift will select the msb mask.
The fine shift will shift the selected coarse mask by the three least- significant digits of AMOUNT , completing the shift operation
The T2 logic unit is able to perform five logical operations (AND, NAND, OR, NOR and XOR) with just five NAND gates.
- Questa Sim-64 10.7c
- design compiler F-2011.09-SP3
- Bash
- Perl
-
Write an Assembly program using the DLX isa found here
- The size of your program (lines of code), must be so that it could be saved in the instruction memory. If your program exceeds this size the design will not compile, in such case change the value
C_IMEM_ADDR_W
in file./src/000-common.core/000-DLX_PKG.vhd
accordingly. - If you need to address more then the default data-memory space change the variable
C_DMEM_ADDR_W
in file./src/000-common.core/000-DLX_PKG.vhd
accordingly. The compiler can't catch this error, the design will simulate your design but will truncate the data-memory-addresses to comply with its internal address space.
- The size of your program (lines of code), must be so that it could be saved in the instruction memory. If your program exceeds this size the design will not compile, in such case change the value
-
Run the assembler on the assembly program and link the output to the instruction memory ram-file
./scripts/assembler/assembler.sh <path_to_your>.asm ./src/000-common.core/003-IMEM_INIT_FILE.txt
- If you want to initialize the data-memory with a ram-file the link it to
./src/000-common.core/004-DMEM_INIT_FILE.txt
:The file must contain 32 bit, hexadecimal, newline escaped valuesln -s <your_dmem_ram_file>.txt ./src/000-common.core/004-DMEM_INIT_FILE.txt
- If you want to initialize the data-memory with a ram-file the link it to
-
Compile the design (this script assumes vsim is in the system
$PATH
)./scripts/build.sh
-
Run the simulation, it will run for 212us. (this script assumes vcom is in the system
$PATH
)./scripts/build.sh sim
To change the simulation time modify the line
run 212us
in./sim/sim.do
-
The simulation will output the file
./sim/rf_dmemd.dump
. This file contains the content of the Register file (in order 0 to 31) and data memory (in reverse orderDATA_MEM_SIZE-1 downto 0
). Check this file to see if your program is compliant with your behaviour (you obviously need to save the program state either in data memory of in the register file)
The design synthesized is only MELA without memories.
There are 5 available configurations of this design:
- Full behavioural ALU.
- design name:
CFG_CPU_BEHAV
- design name:
- Behavioural ALU but LogicalUnit is UltraSPARK T2 LogicalUnit.
- design name:
CFG_CPU_BEHAV_ALU_T2LOGIC
- design name:
- Behavioural ALU but Shifter is UltraSPARK T2 Shifter.
- design name:
CFG_CPU_BEHAV_ALU_T2SHIFTER
- design name:
- Behavioural ALU but adder is Intel Pentium4 adder.
- design name
CFG_CPU_BEHAV_ALU_P4ADDER
- design name
- ALU made of all the previous components but with behavioural comparators.
- design name:
CFG_CPU_BEHAV_ALU_STRUCT
- design name:
Select the configuration and the desired clock-period in nanoseconds (can be a float value) and run (the script assumes dc_shell-xg-t
(design compiler) is in your systems $PATH
):
./scripts/build.sh syn <design_name> <clock_period_ns>
Synthesis outputs will be in the ./syn
folder, respectively:
./syn/reports
will contain timing, area and power reports./syn/netlists
will contain the synthesized netlist./syn/design_compiler_sdc
will contain thesdc
file generated by design compiler for this synthesis run
Here some nice pictures. No description for this process because we didn't know what we where doing, just following a recipe, but nice pics.
All metal layers | Transistor cells |
---|---|
The pads on the perimeter are Data Memory and Instruction Memory ports |
I don't like this folder structure but it was imposed on us to keep the project "tidier" and simpler to recognize the hierarchy from. To be honest the constraint is understandable but it's still awful to look at and use.
MELA's ALU features a Pentium 4 adder unit, UltraSPARC T2 Shifter and Logic units, and a behavioural comparator. The ALU can be configured to have behavioural implementations of the aforementioned units.
For more info about MELA's architecture, check out the report
Make sure the vim PWD
is the root of the project
# compile the asm file open in the current buffer
:nnoremap <F4> :!./scripts/assembler/assembler.sh % ./src/000-common.core/003-IMEM_INIT_FILE.txt<cr>
# save all buffers and push to remote
:nnoremap <F5> :wa<cr>:! rsync -hh -a --info=stats1,progress2 --partial /home/simone/Documents/00.PoliTO/1.2-MicroElectronic-Systems/DLX/ ms_polito:~/dlx_simone<cr>
# compile on remote
:nnoremap <F6> :! ssh ms_polito "cd ./dlx_simone; ./scripts/build.sh"<cr>