1 |
2 |
__alexs__ |
# --------------------------------------------------------------------------
|
2 |
|
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
3 |
|
|
# --------------------------------------------------------------------------
|
4 |
|
|
# TITLE: Plasma MEMORY ACCESS SCRIPT
|
5 |
|
|
# AUTHOR: Alex Schoenberger (Alex.Schoenberger@ies.tu-darmstadt.de)
|
6 |
|
|
# COMMENT: This project is based on Plasma CPU core by Steve Rhoads
|
7 |
|
|
|
8 |
|
|
# www.ies.tu-darmstadt.de
|
9 |
|
|
# TU Darmstadt
|
10 |
|
|
# Institute for Integrated Systems
|
11 |
|
|
# Merckstr. 25
|
12 |
|
|
|
13 |
|
|
# 64283 Darmstadt - GERMANY
|
14 |
|
|
# --------------------------------------------------------------------------
|
15 |
|
|
# PROJECT: Plasma CPU core with FPU
|
16 |
|
|
# FILENAME: plasma_memory.tcl
|
17 |
|
|
# --------------------------------------------------------------------------
|
18 |
|
|
# COPYRIGHT:
|
19 |
|
|
# This project is distributed by GPLv2.0
|
20 |
|
|
# Software placed into the public domain by the author.
|
21 |
|
|
# Software 'as is' without warranty. Author liable for nothing.
|
22 |
|
|
# --------------------------------------------------------------------------
|
23 |
|
|
# DESCRIPTION:
|
24 |
|
|
# read and write memory
|
25 |
|
|
#
|
26 |
|
|
# --------------------------------------------------------------------------
|
27 |
|
|
# Revision History
|
28 |
|
|
# --------------------------------------------------------------------------
|
29 |
|
|
# Revision Date Author CHANGES
|
30 |
|
|
# 1.0 4/2014 AS initial
|
31 |
|
|
# --------------------------------------------------------------------------
|
32 |
|
|
# #################################################################################################
|
33 |
|
|
# _ ____ ____ ___ _ _ ____ _ _ ____ ____ _ _
|
34 |
|
|
# | | | |__| | \ |\/| |___ |\/| | | |__/ \_/
|
35 |
|
|
# |___ |__| | | |__/ | | |___ | | |__| | \ |
|
36 |
|
|
#
|
37 |
|
|
# write content of a extern file to memory
|
38 |
|
|
#
|
39 |
|
|
proc load_memory { } {
|
40 |
|
|
#
|
41 |
|
|
# generic memory model
|
42 |
|
|
#
|
43 |
|
|
mem load -infile memory_in.mem -format hex -filltype value -filldata 8'h00 /tb_plasma/u2_memory/ram
|
44 |
|
|
}
|
45 |
|
|
|
46 |
|
|
# #################################################################################################
|
47 |
|
|
# ____ ___ ____ ____ ____ _ _ ____ _ _ ____ ____ _ _
|
48 |
|
|
# [__ | | | |__/ |___ |\/| |___ |\/| | | |__/ \_/
|
49 |
|
|
# ___] | |__| | \ |___ | | |___ | | |__| | \ |
|
50 |
|
|
#
|
51 |
|
|
# write content of memory to extern file
|
52 |
|
|
#
|
53 |
|
|
proc store_memory { } {
|
54 |
|
|
|
55 |
|
|
# 0x8D_0000
|
56 |
|
|
set OUTPUT_START_ADDR 9240576
|
57 |
|
|
# 0x8D_0000 + 0xD_0000 = 0x9A_0000
|
58 |
|
|
set OUTPUT_END_ADDR 10092544
|
59 |
|
|
|
60 |
|
|
#
|
61 |
|
|
# generic memory model
|
62 |
|
|
#
|
63 |
|
|
mem save -format hex -wordsperline 32 -st $OUTPUT_START_ADDR -end $OUTPUT_END_ADDR -outfile memory_out.mem /tb_plasma/u2_memory/ram
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
# #################################################################################################
|
67 |
|
|
# _ _ _ _ ___ _ ____ _ _ ____ ____ ___ _ ____ _ _
|
68 |
|
|
# | |\ | | | | |__| | | [__ |__| | | | | |\ |
|
69 |
|
|
# | | \| | | | | | |___ | ___] | | | | |__| | \|
|
70 |
|
|
#
|
71 |
|
|
# triggered on "init" signal
|
72 |
|
|
#
|
73 |
|
|
when { init = 1 } {
|
74 |
|
|
|
75 |
|
|
echo "Memory initialisation start"
|
76 |
|
|
load_memory
|
77 |
|
|
echo "Memory initialisation done"
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
# #################################################################################################
|
81 |
|
|
# ____ _ _ _ _ _ _ ____ ___ _ ____ _ _ ____ _ _ _ ___
|
82 |
|
|
# [__ | |\/| | | | |__| | | | | |\ | |___ \/ | |
|
83 |
|
|
# ___] | | | |__| |___ | | | | |__| | \| |___ _/\_ | |
|
84 |
|
|
#
|
85 |
|
|
when { sim_finish = 1 } {
|
86 |
|
|
stop
|
87 |
|
|
store_memory
|
88 |
|
|
exit -f
|
89 |
|
|
}
|