URL
https://opencores.org/ocsvn/atlas_core/atlas_core/trunk
Subversion Repositories atlas_core
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 34 to Rev 35
- ↔ Reverse comparison
Rev 34 → Rev 35
/atlas_core/trunk/rtl/BOOT_MEM.vhd
3,7 → 3,7
-- # **************************************************** # |
-- # 2kB ROM initialized with Atlas-2k bootloader. # |
-- # **************************************************** # |
-- # Last modified: 15.05.2014 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
15,1079 → 15,1076
library work; |
use work.atlas_core_package.all; |
|
entity BOOT_MEM is |
port ( |
-- Host Interface -- |
CLK_I : in std_logic; -- global clock line |
I_ADR_I : in std_logic_vector(15 downto 0); -- instruction adr |
I_EN_I : in std_logic; -- IR update |
I_DAT_O : out std_logic_vector(15 downto 0); -- instruction out |
D_EN_I : in std_logic; -- access enable |
D_RW_I : in std_logic; -- read/write |
D_ADR_I : in std_logic_vector(15 downto 0); -- data adr |
D_DAT_I : in std_logic_vector(15 downto 0); -- data in |
D_DAT_O : out std_logic_vector(15 downto 0) -- data out |
); |
end BOOT_MEM; |
entity boot_mem is |
port ( |
-- host interface -- |
clk_i : in std_logic; -- global clock line |
i_adr_i : in std_logic_vector(15 downto 0); -- instruction adr |
i_dat_o : out std_logic_vector(15 downto 0); -- instruction out |
d_en_i : in std_logic; -- access enable |
d_rw_i : in std_logic; -- read/write |
d_adr_i : in std_logic_vector(15 downto 0); -- data adr |
d_dat_i : in std_logic_vector(15 downto 0); -- data in |
d_dat_o : out std_logic_vector(15 downto 0) -- data out |
); |
end boot_mem; |
|
architecture BOOT_MEM_STRUCTURE of BOOT_MEM is |
architecture boot_mem_structure of boot_mem is |
|
-- Internal constants(configuration -- |
constant mem_size_c : natural := 2048; -- 2kB |
constant log2_mem_size_c : natural := log2(mem_size_c/2); -- address width (word boundary!) |
-- internal constants(configuration -- |
constant mem_size_c : natural := 2048; -- 2kb |
constant log2_mem_size_c : natural := log2(mem_size_c/2); -- address width (word boundary!) |
|
-- Memory Type -- |
type mem_file_t is array (0 to (mem_size_c/2)-1) of std_logic_vector(15 downto 0); -- word mem! |
-- memory type -- |
type mem_file_t is array (0 to (mem_size_c/2)-1) of std_logic_vector(15 downto 0); -- word mem! |
|
-- MEMORY IMAGE (Bootloader Program) -- |
------------------------------------------------------ |
constant BOOT_MEM_FILE_C : mem_file_t := |
-- memory image (bootloader program) -- |
------------------------------------------------------ |
constant boot_mem_file_c : mem_file_t := |
( |
000000 => x"bc0e", -- B |
000001 => x"bc04", -- B |
000002 => x"bc03", -- B |
000003 => x"bc02", -- B |
000004 => x"bc01", -- B |
000005 => x"c000", -- LDIL |
000006 => x"cc00", -- LDIH |
000007 => x"ec8a", -- MCR |
000008 => x"cc19", -- LDIH |
000009 => x"ed0f", -- MCR |
000010 => x"c520", -- LDIL |
000011 => x"c907", -- LDIH |
000012 => x"be73", -- BL |
000013 => x"bc00", -- B |
000014 => x"ec11", -- MRC |
000015 => x"ec88", -- MCR |
000016 => x"ec8a", -- MCR |
000017 => x"c380", -- LDIL |
000018 => x"cff8", -- LDIH |
000019 => x"1c07", -- STSR |
000020 => x"2800", -- CLR |
000021 => x"ec08", -- MCR |
000022 => x"ec0b", -- MCR |
000023 => x"ec0d", -- MCR |
000024 => x"ec00", -- MRC |
000025 => x"ed88", -- MCR |
000026 => x"ed8b", -- MCR |
000027 => x"c064", -- LDIL |
000028 => x"ed8d", -- MCR |
000029 => x"c901", -- LDIH |
000030 => x"ed2f", -- MCR |
000031 => x"ec17", -- MRC |
000032 => x"ec97", -- MRC |
000033 => x"c160", -- LDIL |
000034 => x"c909", -- LDIH |
000035 => x"c18f", -- LDIL |
000036 => x"0923", -- ADD |
000037 => x"29b3", -- CLR |
000038 => x"2a44", -- CLR |
000039 => x"100a", -- SUBS |
000040 => x"149b", -- SBCS |
000041 => x"9003", -- BMI |
000042 => x"0241", -- INC |
000043 => x"bdfc", -- B |
000044 => x"ed49", -- MCR |
000045 => x"ec22", -- MRC |
000046 => x"d406", -- SBR |
000047 => x"ed0a", -- MCR |
000048 => x"c534", -- LDIL |
000049 => x"c905", -- LDIH |
000050 => x"be4d", -- BL |
000051 => x"c12a", -- LDIL |
000052 => x"c906", -- LDIH |
000053 => x"be4a", -- BL |
000054 => x"ee11", -- MRC |
000055 => x"be4c", -- BL |
000056 => x"c13a", -- LDIL |
000057 => x"c906", -- LDIH |
000058 => x"be45", -- BL |
000059 => x"ee97", -- MRC |
000060 => x"ee17", -- MRC |
000061 => x"be46", -- BL |
000062 => x"0250", -- MOV |
000063 => x"be44", -- BL |
000064 => x"be40", -- BL |
000065 => x"ec27", -- MRC |
000066 => x"c083", -- LDIL |
000067 => x"2001", -- AND |
000068 => x"c330", -- LDIL |
000069 => x"0b60", -- ADD |
000070 => x"bc0f", -- B |
000071 => x"c552", -- LDIL |
000072 => x"c906", -- LDIH |
000073 => x"be36", -- BL |
000074 => x"c144", -- LDIL |
000075 => x"c907", -- LDIH |
000076 => x"be33", -- BL |
000077 => x"c50a", -- LDIL |
000078 => x"c907", -- LDIH |
000079 => x"be30", -- BL |
000080 => x"be32", -- BL |
000081 => x"0300", -- MOV |
000082 => x"0080", -- MOV |
000083 => x"be2e", -- BL |
000084 => x"be2c", -- BL |
000085 => x"c0b0", -- LDIL |
000086 => x"181e", -- CMP |
000087 => x"81f0", -- BEQ |
000088 => x"c0b1", -- LDIL |
000089 => x"181e", -- CMP |
000090 => x"8085", -- BEQ |
000091 => x"c0b2", -- LDIL |
000092 => x"181e", -- CMP |
000093 => x"8052", -- BEQ |
000094 => x"c0b3", -- LDIL |
000095 => x"181e", -- CMP |
000096 => x"8019", -- BEQ |
000097 => x"c0b4", -- LDIL |
000098 => x"181e", -- CMP |
000099 => x"8021", -- BEQ |
000100 => x"c296", -- LDIL |
000101 => x"ca83", -- LDIH |
000102 => x"c0f0", -- LDIL |
000103 => x"181e", -- CMP |
000104 => x"f705", -- RBAEQ |
000105 => x"c0e4", -- LDIL |
000106 => x"181e", -- CMP |
000107 => x"80e1", -- BEQ |
000108 => x"c2c8", -- LDIL |
000109 => x"ca85", -- LDIH |
000110 => x"c0f7", -- LDIL |
000111 => x"181e", -- CMP |
000112 => x"f705", -- RBAEQ |
000113 => x"c0f2", -- LDIL |
000114 => x"181e", -- CMP |
000115 => x"85da", -- BNE |
000116 => x"2800", -- CLR |
000117 => x"c080", -- LDIL |
000118 => x"cc80", -- LDIH |
000119 => x"ec99", -- MCR |
000120 => x"3400", -- GT |
000121 => x"c14a", -- LDIL |
000122 => x"c906", -- LDIH |
000123 => x"be04", -- BL |
000124 => x"2800", -- CLR |
000125 => x"2100", -- STUB |
000126 => x"bca0", -- B |
000127 => x"bc95", -- B |
000128 => x"bc95", -- B |
000129 => x"bc95", -- B |
000130 => x"bc95", -- B |
000131 => x"bc98", -- B |
000132 => x"c528", -- LDIL |
000133 => x"c906", -- LDIH |
000134 => x"be8e", -- BL |
000135 => x"be96", -- BL |
000136 => x"edca", -- MCR |
000137 => x"be94", -- BL |
000138 => x"edc9", -- MCR |
000139 => x"c036", -- LDIL |
000140 => x"c805", -- LDIH |
000141 => x"3404", -- GTL |
000142 => x"be87", -- BL |
000143 => x"be8d", -- BL |
000144 => x"c47e", -- LDIL |
000145 => x"cc4a", -- LDIH |
000146 => x"180e", -- CMP |
000147 => x"8486", -- BNE |
000148 => x"be88", -- BL |
000149 => x"3f64", -- SFT |
000150 => x"2066", -- STUB |
000151 => x"be85", -- BL |
000152 => x"20e6", -- STUB |
000153 => x"be83", -- BL |
000154 => x"2166", -- STUB |
000155 => x"be81", -- BL |
000156 => x"21e6", -- STUB |
000157 => x"be7f", -- BL |
000158 => x"2266", -- STUB |
000159 => x"be7d", -- BL |
000160 => x"22e6", -- STUB |
000161 => x"be7b", -- BL |
000162 => x"2366", -- STUB |
000163 => x"c280", -- LDIL |
000164 => x"ecda", -- MCR |
000165 => x"ec5e", -- MCR |
000166 => x"be76", -- BL |
000167 => x"7f5a", -- STR |
000168 => x"ec06", -- MRC |
000169 => x"2806", -- EOR |
000170 => x"ec0e", -- MCR |
000171 => x"2400", -- LDUB |
000172 => x"1858", -- CMP |
000173 => x"85f9", -- BNE |
000174 => x"bc53", -- B |
000175 => x"c100", -- LDIL |
000176 => x"be28", -- BL |
000177 => x"c47e", -- LDIL |
000178 => x"cc4a", -- LDIH |
000179 => x"180d", -- CMP |
000180 => x"8465", -- BNE |
000181 => x"c102", -- LDIL |
000182 => x"be22", -- BL |
000183 => x"2055", -- STUB |
000184 => x"c104", -- LDIL |
000185 => x"be1f", -- BL |
000186 => x"20d5", -- STUB |
000187 => x"c106", -- LDIL |
000188 => x"be1c", -- BL |
000189 => x"2155", -- STUB |
000190 => x"c108", -- LDIL |
000191 => x"be19", -- BL |
000192 => x"21d5", -- STUB |
000193 => x"c10a", -- LDIL |
000194 => x"be16", -- BL |
000195 => x"2255", -- STUB |
000196 => x"c10c", -- LDIL |
000197 => x"be13", -- BL |
000198 => x"22d5", -- STUB |
000199 => x"c10e", -- LDIL |
000200 => x"be10", -- BL |
000201 => x"2355", -- STUB |
000202 => x"c200", -- LDIL |
000203 => x"ecca", -- MCR |
000204 => x"ec4e", -- MCR |
000205 => x"c010", -- LDIL |
000206 => x"0940", -- ADD |
000207 => x"be09", -- BL |
000208 => x"7eca", -- STR |
000209 => x"ec06", -- MRC |
000210 => x"2805", -- EOR |
000211 => x"ec0e", -- MCR |
000212 => x"2400", -- LDUB |
000213 => x"1848", -- CMP |
000214 => x"85f7", -- BNE |
000215 => x"bc2a", -- B |
000216 => x"0370", -- MOV |
000217 => x"be3f", -- BL |
000218 => x"3eb0", -- SFT |
000219 => x"0121", -- INC |
000220 => x"be3c", -- BL |
000221 => x"26d3", -- ORR |
000222 => x"3460", -- RET |
000223 => x"c162", -- LDIL |
000224 => x"c906", -- LDIH |
000225 => x"be33", -- BL |
000226 => x"be2c", -- BL |
000227 => x"c47e", -- LDIL |
000228 => x"cc4a", -- LDIH |
000229 => x"1818", -- CMP |
000230 => x"8433", -- BNE |
000231 => x"be27", -- BL |
000232 => x"3c94", -- SFT |
000233 => x"2011", -- STUB |
000234 => x"be24", -- BL |
000235 => x"2091", -- STUB |
000236 => x"be22", -- BL |
000237 => x"2111", -- STUB |
000238 => x"be20", -- BL |
000239 => x"2191", -- STUB |
000240 => x"be1e", -- BL |
000241 => x"2211", -- STUB |
000242 => x"be1c", -- BL |
000243 => x"2291", -- STUB |
000244 => x"be1a", -- BL |
000245 => x"2311", -- STUB |
000246 => x"2ad5", -- CLR |
000247 => x"ecda", -- MCR |
000248 => x"ec5e", -- MCR |
000249 => x"be15", -- BL |
000250 => x"7cda", -- STR |
000251 => x"ec06", -- MRC |
000252 => x"2801", -- EOR |
000253 => x"ec0e", -- MCR |
000254 => x"2400", -- LDUB |
000255 => x"1858", -- CMP |
000256 => x"85f9", -- BNE |
000257 => x"ec11", -- MRC |
000258 => x"ec8a", -- MCR |
000259 => x"c506", -- LDIL |
000260 => x"c906", -- LDIH |
000261 => x"be0f", -- BL |
000262 => x"ec06", -- MRC |
000263 => x"2491", -- LDUB |
000264 => x"1809", -- CMP |
000265 => x"8015", -- BEQ |
000266 => x"c52e", -- LDIL |
000267 => x"c907", -- LDIH |
000268 => x"be08", -- BL |
000269 => x"bccf", -- B |
000270 => x"0370", -- MOV |
000271 => x"be08", -- BL |
000272 => x"3c80", -- SFT |
000273 => x"be06", -- BL |
000274 => x"2490", -- ORR |
000275 => x"3460", -- RET |
000276 => x"bccb", -- B |
000277 => x"bcd3", -- B |
000278 => x"bcd7", -- B |
000279 => x"bcdb", -- B |
000280 => x"bc71", -- B |
000281 => x"bcc0", -- B |
000282 => x"bd33", -- B |
000283 => x"bc6f", -- B |
000284 => x"bcc2", -- B |
000285 => x"bcda", -- B |
000286 => x"c176", -- LDIL |
000287 => x"c906", -- LDIH |
000288 => x"bebf", -- BL |
000289 => x"24aa", -- LDUBS |
000290 => x"8010", -- BEQ |
000291 => x"c0a2", -- LDIL |
000292 => x"bec9", -- BL |
000293 => x"24a2", -- LDUB |
000294 => x"be20", -- BL |
000295 => x"24b3", -- LDUB |
000296 => x"be1e", -- BL |
000297 => x"24c4", -- LDUB |
000298 => x"be1c", -- BL |
000299 => x"24d5", -- LDUB |
000300 => x"be1a", -- BL |
000301 => x"24e6", -- LDUB |
000302 => x"be18", -- BL |
000303 => x"c0a2", -- LDIL |
000304 => x"bebd", -- BL |
000305 => x"beb7", -- BL |
000306 => x"c546", -- LDIL |
000307 => x"c906", -- LDIH |
000308 => x"beab", -- BL |
000309 => x"ee06", -- MRC |
000310 => x"bee6", -- BL |
000311 => x"beb1", -- BL |
000312 => x"beb0", -- BL |
000313 => x"beaf", -- BL |
000314 => x"beae", -- BL |
000315 => x"c080", -- LDIL |
000316 => x"ccc0", -- LDIH |
000317 => x"1c01", -- STSR |
000318 => x"2800", -- CLR |
000319 => x"ed0f", -- MCR |
000320 => x"ec88", -- MCR |
000321 => x"ec8b", -- MCR |
000322 => x"ec8c", -- MCR |
000323 => x"ec8a", -- MCR |
000324 => x"ec89", -- MCR |
000325 => x"3400", -- GT |
000326 => x"0370", -- MOV |
000327 => x"3c90", -- SFT |
000328 => x"bea5", -- BL |
000329 => x"3c90", -- SFT |
000330 => x"bea3", -- BL |
000331 => x"3460", -- RET |
000332 => x"c51a", -- LDIL |
000333 => x"c906", -- LDIH |
000334 => x"be91", -- BL |
000335 => x"bea8", -- BL |
000336 => x"c136", -- LDIL |
000337 => x"c905", -- LDIH |
000338 => x"3424", -- GTL |
000339 => x"ecca", -- MCR |
000340 => x"be94", -- BL |
000341 => x"c280", -- LDIL |
000342 => x"c00f", -- LDIL |
000343 => x"2058", -- ANDS |
000344 => x"840e", -- BNE |
000345 => x"be8f", -- BL |
000346 => x"c0a4", -- LDIL |
000347 => x"be92", -- BL |
000348 => x"ee12", -- MRC |
000349 => x"bebf", -- BL |
000350 => x"c0ae", -- LDIL |
000351 => x"be8e", -- BL |
000352 => x"0250", -- MOV |
000353 => x"bebb", -- BL |
000354 => x"c0ba", -- LDIL |
000355 => x"be8a", -- BL |
000356 => x"c0a0", -- LDIL |
000357 => x"be88", -- BL |
000358 => x"7a5a", -- LDR |
000359 => x"c0a0", -- LDIL |
000360 => x"be85", -- BL |
000361 => x"beb3", -- BL |
000362 => x"c00f", -- LDIL |
000363 => x"2058", -- ANDS |
000364 => x"8414", -- BNE |
000365 => x"c0a0", -- LDIL |
000366 => x"be7f", -- BL |
000367 => x"be7e", -- BL |
000368 => x"c010", -- LDIL |
000369 => x"1250", -- SUB |
000370 => x"c470", -- LDIL |
000371 => x"2240", -- AND |
000372 => x"c12e", -- LDIL |
000373 => x"78c9", -- LDR |
000374 => x"3c90", -- SFT |
000375 => x"c880", -- LDIH |
000376 => x"c020", -- LDIL |
000377 => x"1818", -- CMP |
000378 => x"f8c2", -- MVHI |
000379 => x"be72", -- BL |
000380 => x"c08f", -- LDIL |
000381 => x"2014", -- AND |
000382 => x"3409", -- TEQ |
000383 => x"85f6", -- BNE |
000384 => x"ec20", -- MRC |
000385 => x"dc0f", -- STB |
000386 => x"b804", -- BTS |
000387 => x"c5fe", -- LDIL |
000388 => x"343d", -- TEQ |
000389 => x"85d1", -- BNE |
000390 => x"be6c", -- BL |
000391 => x"2800", -- CLR |
000392 => x"3400", -- GT |
000393 => x"bc54", -- B |
000394 => x"bc92", -- B |
000395 => x"c001", -- LDIL |
000396 => x"ed0c", -- MCR |
000397 => x"c050", -- LDIL |
000398 => x"c83f", -- LDIH |
000399 => x"ed0a", -- MCR |
000400 => x"c000", -- LDIL |
000401 => x"c801", -- LDIH |
000402 => x"bea8", -- BL |
000403 => x"c154", -- LDIL |
000404 => x"c906", -- LDIH |
000405 => x"be4a", -- BL |
000406 => x"c162", -- LDIL |
000407 => x"c906", -- LDIH |
000408 => x"be47", -- BL |
000409 => x"be59", -- BL |
000410 => x"3c80", -- SFT |
000411 => x"be57", -- BL |
000412 => x"2410", -- ORR |
000413 => x"c4fe", -- LDIL |
000414 => x"ccca", -- LDIH |
000415 => x"1809", -- CMP |
000416 => x"8439", -- BNE |
000417 => x"c100", -- LDIL |
000418 => x"0290", -- MOV |
000419 => x"be2f", -- BL |
000420 => x"be4e", -- BL |
000421 => x"3c80", -- SFT |
000422 => x"be4c", -- BL |
000423 => x"2690", -- ORR |
000424 => x"3ed4", -- SFT |
000425 => x"2055", -- STUB |
000426 => x"c102", -- LDIL |
000427 => x"be27", -- BL |
000428 => x"be46", -- BL |
000429 => x"3c80", -- SFT |
000430 => x"be44", -- BL |
000431 => x"2690", -- ORR |
000432 => x"20d5", -- STUB |
000433 => x"c104", -- LDIL |
000434 => x"be20", -- BL |
000435 => x"c106", -- LDIL |
000436 => x"be3e", -- BL |
000437 => x"0180", -- MOV |
000438 => x"be8a", -- BL |
000439 => x"0121", -- INC |
000440 => x"c010", -- LDIL |
000441 => x"1828", -- CMP |
000442 => x"85fa", -- BNE |
000443 => x"2ad5", -- CLR |
000444 => x"be36", -- BL |
000445 => x"0180", -- MOV |
000446 => x"be82", -- BL |
000447 => x"0121", -- INC |
000448 => x"2400", -- LDUB |
000449 => x"02d1", -- INC |
000450 => x"1858", -- CMP |
000451 => x"85f9", -- BNE |
000452 => x"c001", -- LDIL |
000453 => x"ed0c", -- MCR |
000454 => x"c050", -- LDIL |
000455 => x"c83f", -- LDIH |
000456 => x"ed0a", -- MCR |
000457 => x"c00c", -- LDIL |
000458 => x"c801", -- LDIH |
000459 => x"be6f", -- BL |
000460 => x"c506", -- LDIL |
000461 => x"c906", -- LDIH |
000462 => x"be11", -- BL |
000463 => x"c68e", -- LDIL |
000464 => x"ca80", -- LDIH |
000465 => x"3450", -- GT |
000466 => x"0370", -- MOV |
000467 => x"3dd0", -- SFT |
000468 => x"be6c", -- BL |
000469 => x"0121", -- INC |
000470 => x"01d0", -- MOV |
000471 => x"be69", -- BL |
000472 => x"3460", -- RET |
000473 => x"c512", -- LDIL |
000474 => x"c907", -- LDIH |
000475 => x"be04", -- BL |
000476 => x"bcb9", -- B |
000477 => x"bc93", -- B |
000478 => x"bca4", -- B |
000479 => x"01f0", -- MOV |
000480 => x"78a9", -- LDR |
000481 => x"3c90", -- SFT |
000482 => x"c880", -- LDIH |
000483 => x"3419", -- TEQ |
000484 => x"8003", -- BEQ |
000485 => x"be08", -- BL |
000486 => x"bdfa", -- B |
000487 => x"3430", -- RET |
000488 => x"0170", -- MOV |
000489 => x"c08d", -- LDIL |
000490 => x"be03", -- BL |
000491 => x"c08a", -- LDIL |
000492 => x"03a0", -- MOV |
000493 => x"ec22", -- MRC |
000494 => x"dc05", -- STB |
000495 => x"b9fe", -- BTS |
000496 => x"ed18", -- MCR |
000497 => x"3470", -- RET |
000498 => x"ec20", -- MRC |
000499 => x"dc8f", -- STBI |
000500 => x"b9fe", -- BTS |
000501 => x"c800", -- LDIH |
000502 => x"3470", -- RET |
000503 => x"0170", -- MOV |
000504 => x"c200", -- LDIL |
000505 => x"c184", -- LDIL |
000506 => x"bff8", -- BL |
000507 => x"c0c7", -- LDIL |
000508 => x"1809", -- CMP |
000509 => x"9003", -- BMI |
000510 => x"c0a0", -- LDIL |
000511 => x"1001", -- SUB |
000512 => x"c0b0", -- LDIL |
000513 => x"1809", -- CMP |
000514 => x"91f8", -- BMI |
000515 => x"c0c6", -- LDIL |
000516 => x"1818", -- CMP |
000517 => x"91f5", -- BMI |
000518 => x"c0b9", -- LDIL |
000519 => x"1818", -- CMP |
000520 => x"a404", -- BLS |
000521 => x"c0c1", -- LDIL |
000522 => x"1809", -- CMP |
000523 => x"a1ef", -- BHI |
000524 => x"0080", -- MOV |
000525 => x"bfe0", -- BL |
000526 => x"c030", -- LDIL |
000527 => x"1090", -- SUB |
000528 => x"c009", -- LDIL |
000529 => x"1809", -- CMP |
000530 => x"a402", -- BLS |
000531 => x"0497", -- DEC |
000532 => x"3e42", -- SFT |
000533 => x"3e42", -- SFT |
000534 => x"3e42", -- SFT |
000535 => x"3e42", -- SFT |
000536 => x"2641", -- ORR |
000537 => x"05b9", -- DECS |
000538 => x"85e0", -- BNE |
000539 => x"3420", -- RET |
000540 => x"0370", -- MOV |
000541 => x"3d42", -- SFT |
000542 => x"3d22", -- SFT |
000543 => x"3d22", -- SFT |
000544 => x"3d22", -- SFT |
000545 => x"be0f", -- BL |
000546 => x"bfcb", -- BL |
000547 => x"3d40", -- SFT |
000548 => x"be0c", -- BL |
000549 => x"bfc8", -- BL |
000550 => x"3d45", -- SFT |
000551 => x"3d25", -- SFT |
000552 => x"3d25", -- SFT |
000553 => x"3d25", -- SFT |
000554 => x"be06", -- BL |
000555 => x"bfc2", -- BL |
000556 => x"0140", -- MOV |
000557 => x"be03", -- BL |
000558 => x"bfbf", -- BL |
000559 => x"3460", -- RET |
000560 => x"c08f", -- LDIL |
000561 => x"2121", -- AND |
000562 => x"c089", -- LDIL |
000563 => x"181a", -- CMP |
000564 => x"8803", -- BCS |
000565 => x"c0b0", -- LDIL |
000566 => x"bc02", -- B |
000567 => x"c0b7", -- LDIL |
000568 => x"0892", -- ADD |
000569 => x"3470", -- RET |
000570 => x"ed0b", -- MCR |
000571 => x"ec22", -- MRC |
000572 => x"dc03", -- STB |
000573 => x"b9fe", -- BTS |
000574 => x"ec23", -- MRC |
000575 => x"3470", -- RET |
000576 => x"00f0", -- MOV |
000577 => x"c050", -- LDIL |
000578 => x"c837", -- LDIH |
000579 => x"ed0a", -- MCR |
000580 => x"c001", -- LDIL |
000581 => x"ed0c", -- MCR |
000582 => x"c006", -- LDIL |
000583 => x"bff3", -- BL |
000584 => x"c050", -- LDIL |
000585 => x"c83f", -- LDIH |
000586 => x"ed0a", -- MCR |
000587 => x"c000", -- LDIL |
000588 => x"c805", -- LDIH |
000589 => x"bfed", -- BL |
000590 => x"dc01", -- STB |
000591 => x"b805", -- BTS |
000592 => x"c53e", -- LDIL |
000593 => x"c907", -- LDIH |
000594 => x"bf8d", -- BL |
000595 => x"bc42", -- B |
000596 => x"c040", -- LDIL |
000597 => x"c83f", -- LDIH |
000598 => x"ed0a", -- MCR |
000599 => x"c001", -- LDIL |
000600 => x"ed0c", -- MCR |
000601 => x"3c20", -- SFT |
000602 => x"c802", -- LDIH |
000603 => x"bfdf", -- BL |
000604 => x"03a0", -- MOV |
000605 => x"cb80", -- LDIH |
000606 => x"3ff0", -- SFT |
000607 => x"0030", -- MOV |
000608 => x"c800", -- LDIH |
000609 => x"2407", -- ORR |
000610 => x"bfd8", -- BL |
000611 => x"2800", -- CLR |
000612 => x"ed0c", -- MCR |
000613 => x"c050", -- LDIL |
000614 => x"c83f", -- LDIH |
000615 => x"ed0a", -- MCR |
000616 => x"c001", -- LDIL |
000617 => x"ed0c", -- MCR |
000618 => x"c000", -- LDIL |
000619 => x"c805", -- LDIH |
000620 => x"bfce", -- BL |
000621 => x"dc00", -- STB |
000622 => x"b9fc", -- BTS |
000623 => x"3410", -- RET |
000624 => x"00f0", -- MOV |
000625 => x"c040", -- LDIL |
000626 => x"c83f", -- LDIH |
000627 => x"ed0a", -- MCR |
000628 => x"c001", -- LDIL |
000629 => x"ed0c", -- MCR |
000630 => x"3c20", -- SFT |
000631 => x"c803", -- LDIH |
000632 => x"bfc2", -- BL |
000633 => x"0020", -- MOV |
000634 => x"c800", -- LDIH |
000635 => x"3c00", -- SFT |
000636 => x"bfbe", -- BL |
000637 => x"29b3", -- CLR |
000638 => x"ed3c", -- MCR |
000639 => x"0180", -- MOV |
000640 => x"c980", -- LDIH |
000641 => x"3410", -- RET |
000642 => x"e5b0", -- CDP |
000643 => x"ec30", -- MRC |
000644 => x"dc06", -- STB |
000645 => x"b9fe", -- BTS |
000646 => x"c306", -- LDIL |
000647 => x"200e", -- ANDS |
000648 => x"840a", -- BNE |
000649 => x"ecb1", -- MRC |
000650 => x"ef32", -- MRC |
000651 => x"2800", -- CLR |
000652 => x"009a", -- INCS |
000653 => x"0f60", -- ADC |
000654 => x"ed99", -- MCR |
000655 => x"edea", -- MCR |
000656 => x"ef34", -- MRC |
000657 => x"3470", -- RET |
000658 => x"c550", -- LDIL |
000659 => x"c907", -- LDIH |
000660 => x"bf4b", -- BL |
000661 => x"c55e", -- LDIL |
000662 => x"c907", -- LDIH |
000663 => x"bf48", -- BL |
000664 => x"bf5a", -- BL |
000665 => x"2800", -- CLR |
000666 => x"3400", -- GT |
000667 => x"0170", -- MOV |
000668 => x"bf56", -- BL |
000669 => x"c08d", -- LDIL |
000670 => x"1809", -- CMP |
000671 => x"f702", -- RBAEQ |
000672 => x"c088", -- LDIL |
000673 => x"1809", -- CMP |
000674 => x"8034", -- BEQ |
000675 => x"bdf9", -- B |
000676 => x"c528", -- LDIL |
000677 => x"c906", -- LDIH |
000678 => x"bf39", -- BL |
000679 => x"bf50", -- BL |
000680 => x"edca", -- MCR |
000681 => x"bf4e", -- BL |
000682 => x"edc9", -- MCR |
000683 => x"bff0", -- BL |
000684 => x"bf3c", -- BL |
000685 => x"c536", -- LDIL |
000686 => x"c906", -- LDIH |
000687 => x"bf30", -- BL |
000688 => x"bf47", -- BL |
000689 => x"02c0", -- MOV |
000690 => x"bfe9", -- BL |
000691 => x"bf35", -- BL |
000692 => x"345d", -- TEQ |
000693 => x"8021", -- BEQ |
000694 => x"06d1", -- DEC |
000695 => x"bf31", -- BL |
000696 => x"c0a4", -- LDIL |
000697 => x"bf34", -- BL |
000698 => x"ee32", -- MRC |
000699 => x"bf61", -- BL |
000700 => x"ee31", -- MRC |
000701 => x"bf5f", -- BL |
000702 => x"c0ba", -- LDIL |
000703 => x"bf2e", -- BL |
000704 => x"c0a0", -- LDIL |
000705 => x"bf2c", -- BL |
000706 => x"bfc0", -- BL |
000707 => x"0260", -- MOV |
000708 => x"bf58", -- BL |
000709 => x"c320", -- LDIL |
000710 => x"c1ae", -- LDIL |
000711 => x"00e0", -- MOV |
000712 => x"bf25", -- BL |
000713 => x"3cc0", -- SFT |
000714 => x"c880", -- LDIH |
000715 => x"181e", -- CMP |
000716 => x"f8c3", -- MVHI |
000717 => x"bf20", -- BL |
000718 => x"00c0", -- MOV |
000719 => x"c880", -- LDIH |
000720 => x"181e", -- CMP |
000721 => x"f8c3", -- MVHI |
000722 => x"bf1b", -- BL |
000723 => x"eca0", -- MRC |
000724 => x"dc9f", -- STBI |
000725 => x"b9df", -- BTS |
000726 => x"bf12", -- BL |
000727 => x"c69a", -- LDIL |
000728 => x"ca80", -- LDIH |
000729 => x"3450", -- GT |
000730 => x"0d0a", -- .DW |
000731 => x"0d0a", -- .DW |
000732 => x"4174", -- .DW |
000733 => x"6c61", -- .DW |
000734 => x"732d", -- .DW |
000735 => x"324b", -- .DW |
000736 => x"2042", -- .DW |
000737 => x"6f6f", -- .DW |
000738 => x"746c", -- .DW |
000739 => x"6f61", -- .DW |
000740 => x"6465", -- .DW |
000741 => x"7220", -- .DW |
000742 => x"2d20", -- .DW |
000743 => x"5632", -- .DW |
000744 => x"3031", -- .DW |
000745 => x"3430", -- .DW |
000746 => x"3531", -- .DW |
000747 => x"360d", -- .DW |
000748 => x"0a62", -- .DW |
000749 => x"7920", -- .DW |
000750 => x"5374", -- .DW |
000751 => x"6570", -- .DW |
000752 => x"6861", -- .DW |
000753 => x"6e20", -- .DW |
000754 => x"4e6f", -- .DW |
000755 => x"6c74", -- .DW |
000756 => x"696e", -- .DW |
000757 => x"672c", -- .DW |
000758 => x"2073", -- .DW |
000759 => x"746e", -- .DW |
000760 => x"6f6c", -- .DW |
000761 => x"7469", -- .DW |
000762 => x"6e67", -- .DW |
000763 => x"4067", -- .DW |
000764 => x"6d61", -- .DW |
000765 => x"696c", -- .DW |
000766 => x"2e63", -- .DW |
000767 => x"6f6d", -- .DW |
000768 => x"0d0a", -- .DW |
000769 => x"7777", -- .DW |
000770 => x"772e", -- .DW |
000771 => x"6f70", -- .DW |
000772 => x"656e", -- .DW |
000773 => x"636f", -- .DW |
000774 => x"7265", -- .DW |
000775 => x"732e", -- .DW |
000776 => x"6f72", -- .DW |
000777 => x"672f", -- .DW |
000778 => x"7072", -- .DW |
000779 => x"6f6a", -- .DW |
000780 => x"6563", -- .DW |
000781 => x"742c", -- .DW |
000782 => x"6174", -- .DW |
000783 => x"6c61", -- .DW |
000784 => x"735f", -- .DW |
000785 => x"636f", -- .DW |
000786 => x"7265", -- .DW |
000787 => x"0d0a", -- .DW |
000788 => x"0000", -- .DW |
000789 => x"0d0a", -- .DW |
000790 => x"426f", -- .DW |
000791 => x"6f74", -- .DW |
000792 => x"2070", -- .DW |
000793 => x"6167", -- .DW |
000794 => x"653a", -- .DW |
000795 => x"2030", -- .DW |
000796 => x"7800", -- .DW |
000797 => x"0d0a", -- .DW |
000798 => x"436c", -- .DW |
000799 => x"6f63", -- .DW |
000800 => x"6b28", -- .DW |
000801 => x"487a", -- .DW |
000802 => x"293a", -- .DW |
000803 => x"2030", -- .DW |
000804 => x"7800", -- .DW |
000805 => x"426f", -- .DW |
000806 => x"6f74", -- .DW |
000807 => x"696e", -- .DW |
000808 => x"670d", -- .DW |
000809 => x"0a00", -- .DW |
000810 => x"4275", -- .DW |
000811 => x"726e", -- .DW |
000812 => x"2045", -- .DW |
000813 => x"4550", -- .DW |
000814 => x"524f", -- .DW |
000815 => x"4d0d", -- .DW |
000816 => x"0a00", -- .DW |
000817 => x"4177", -- .DW |
000818 => x"6169", -- .DW |
000819 => x"7469", -- .DW |
000820 => x"6e67", -- .DW |
000821 => x"2069", -- .DW |
000822 => x"6d61", -- .DW |
000823 => x"6765", -- .DW |
000824 => x"2e2e", -- .DW |
000825 => x"2e0d", -- .DW |
000826 => x"0a00", -- .DW |
000827 => x"5374", -- .DW |
000828 => x"6172", -- .DW |
000829 => x"7469", -- .DW |
000830 => x"6e67", -- .DW |
000831 => x"2069", -- .DW |
000832 => x"6d61", -- .DW |
000833 => x"6765", -- .DW |
000834 => x"2000", -- .DW |
000835 => x"446f", -- .DW |
000836 => x"776e", -- .DW |
000837 => x"6c6f", -- .DW |
000838 => x"6164", -- .DW |
000839 => x"2063", -- .DW |
000840 => x"6f6d", -- .DW |
000841 => x"706c", -- .DW |
000842 => x"6574", -- .DW |
000843 => x"650d", -- .DW |
000844 => x"0a00", -- .DW |
000845 => x"5061", -- .DW |
000846 => x"6765", -- .DW |
000847 => x"2028", -- .DW |
000848 => x"3468", -- .DW |
000849 => x"293a", -- .DW |
000850 => x"2024", -- .DW |
000851 => x"0000", -- .DW |
000852 => x"4164", -- .DW |
000853 => x"6472", -- .DW |
000854 => x"2028", -- .DW |
000855 => x"3868", -- .DW |
000856 => x"293a", -- .DW |
000857 => x"2024", -- .DW |
000858 => x"0000", -- .DW |
000859 => x"2377", -- .DW |
000860 => x"6f72", -- .DW |
000861 => x"6473", -- .DW |
000862 => x"2028", -- .DW |
000863 => x"3468", -- .DW |
000864 => x"293a", -- .DW |
000865 => x"2024", -- .DW |
000866 => x"0000", -- .DW |
000867 => x"4368", -- .DW |
000868 => x"6563", -- .DW |
000869 => x"6b73", -- .DW |
000870 => x"756d", -- .DW |
000871 => x"3a20", -- .DW |
000872 => x"2400", -- .DW |
000873 => x"0d0a", -- .DW |
000874 => x"636d", -- .DW |
000875 => x"642f", -- .DW |
000876 => x"626f", -- .DW |
000877 => x"6f74", -- .DW |
000878 => x"2d73", -- .DW |
000879 => x"7769", -- .DW |
000880 => x"7463", -- .DW |
000881 => x"683a", -- .DW |
000882 => x"0d0a", -- .DW |
000883 => x"2030", -- .DW |
000884 => x"2f27", -- .DW |
000885 => x"3030", -- .DW |
000886 => x"273a", -- .DW |
000887 => x"2028", -- .DW |
000888 => x"5265", -- .DW |
000889 => x"2d29", -- .DW |
000890 => x"5374", -- .DW |
000891 => x"6172", -- .DW |
000892 => x"7420", -- .DW |
000893 => x"636f", -- .DW |
000894 => x"6e73", -- .DW |
000895 => x"6f6c", -- .DW |
000896 => x"650d", -- .DW |
000897 => x"0a20", -- .DW |
000898 => x"312f", -- .DW |
000899 => x"2730", -- .DW |
000900 => x"3127", -- .DW |
000901 => x"3a20", -- .DW |
000902 => x"426f", -- .DW |
000903 => x"6f74", -- .DW |
000904 => x"2055", -- .DW |
000905 => x"4152", -- .DW |
000906 => x"540d", -- .DW |
000907 => x"0a20", -- .DW |
000908 => x"322f", -- .DW |
000909 => x"2731", -- .DW |
000910 => x"3027", -- .DW |
000911 => x"3a20", -- .DW |
000912 => x"426f", -- .DW |
000913 => x"6f74", -- .DW |
000914 => x"2045", -- .DW |
000915 => x"4550", -- .DW |
000916 => x"524f", -- .DW |
000917 => x"4d0d", -- .DW |
000918 => x"0a20", -- .DW |
000919 => x"332f", -- .DW |
000920 => x"2731", -- .DW |
000921 => x"3127", -- .DW |
000922 => x"3a20", -- .DW |
000923 => x"426f", -- .DW |
000924 => x"6f74", -- .DW |
000925 => x"206d", -- .DW |
000926 => x"656d", -- .DW |
000927 => x"6f72", -- .DW |
000928 => x"790d", -- .DW |
000929 => x"0a00", -- .DW |
000930 => x"2034", -- .DW |
000931 => x"3a20", -- .DW |
000932 => x"426f", -- .DW |
000933 => x"6f74", -- .DW |
000934 => x"2057", -- .DW |
000935 => x"420d", -- .DW |
000936 => x"0a20", -- .DW |
000937 => x"703a", -- .DW |
000938 => x"2042", -- .DW |
000939 => x"7572", -- .DW |
000940 => x"6e20", -- .DW |
000941 => x"4545", -- .DW |
000942 => x"5052", -- .DW |
000943 => x"4f4d", -- .DW |
000944 => x"0d0a", -- .DW |
000945 => x"2064", -- .DW |
000946 => x"3a20", -- .DW |
000947 => x"5241", -- .DW |
000948 => x"4d20", -- .DW |
000949 => x"6475", -- .DW |
000950 => x"6d70", -- .DW |
000951 => x"0d0a", -- .DW |
000952 => x"2072", -- .DW |
000953 => x"3a20", -- .DW |
000954 => x"5265", -- .DW |
000955 => x"7365", -- .DW |
000956 => x"740d", -- .DW |
000957 => x"0a20", -- .DW |
000958 => x"773a", -- .DW |
000959 => x"2057", -- .DW |
000960 => x"4220", -- .DW |
000961 => x"6475", -- .DW |
000962 => x"6d70", -- .DW |
000963 => x"0d0a", -- .DW |
000964 => x"0000", -- .DW |
000965 => x"636d", -- .DW |
000966 => x"643a", -- .DW |
000967 => x"3e20", -- .DW |
000968 => x"0000", -- .DW |
000969 => x"494d", -- .DW |
000970 => x"4147", -- .DW |
000971 => x"4520", -- .DW |
000972 => x"4552", -- .DW |
000973 => x"5221", -- .DW |
000974 => x"0d0a", -- .DW |
000975 => x"0000", -- .DW |
000976 => x"0d0a", -- .DW |
000977 => x"4952", -- .DW |
000978 => x"5120", -- .DW |
000979 => x"4552", -- .DW |
000980 => x"5221", -- .DW |
000981 => x"0d0a", -- .DW |
000982 => x"0000", -- .DW |
000983 => x"4348", -- .DW |
000984 => x"4543", -- .DW |
000985 => x"4b53", -- .DW |
000986 => x"554d", -- .DW |
000987 => x"2045", -- .DW |
000988 => x"5252", -- .DW |
000989 => x"210d", -- .DW |
000990 => x"0a00", -- .DW |
000991 => x"5350", -- .DW |
000992 => x"492f", -- .DW |
000993 => x"4545", -- .DW |
000994 => x"5052", -- .DW |
000995 => x"4f4d", -- .DW |
000996 => x"2045", -- .DW |
000997 => x"5252", -- .DW |
000998 => x"210d", -- .DW |
000999 => x"0a00", -- .DW |
001000 => x"5742", -- .DW |
001001 => x"2042", -- .DW |
001002 => x"5553", -- .DW |
001003 => x"2045", -- .DW |
001004 => x"5252", -- .DW |
001005 => x"210d", -- .DW |
001006 => x"0a00", -- .DW |
001007 => x"5072", -- .DW |
001008 => x"6573", -- .DW |
001009 => x"7320", -- .DW |
001010 => x"616e", -- .DW |
001011 => x"7920", -- .DW |
001012 => x"6b65", -- .DW |
001013 => x"790d", -- .DW |
001014 => x"0a00", -- .DW |
others => x"0000" -- NOP |
); |
------------------------------------------------------ |
000000 => x"bc0e", -- B |
000001 => x"bc04", -- B |
000002 => x"bc03", -- B |
000003 => x"bc02", -- B |
000004 => x"bc01", -- B |
000005 => x"c000", -- LDIL |
000006 => x"cc00", -- LDIH |
000007 => x"ec8a", -- MCR |
000008 => x"cc19", -- LDIH |
000009 => x"ed0f", -- MCR |
000010 => x"c520", -- LDIL |
000011 => x"c907", -- LDIH |
000012 => x"be73", -- BL |
000013 => x"bc00", -- B |
000014 => x"ec11", -- MRC |
000015 => x"ec88", -- MCR |
000016 => x"ec8a", -- MCR |
000017 => x"c380", -- LDIL |
000018 => x"cff8", -- LDIH |
000019 => x"1c07", -- STSR |
000020 => x"2800", -- CLR |
000021 => x"ec08", -- MCR |
000022 => x"ec0b", -- MCR |
000023 => x"ec0d", -- MCR |
000024 => x"ec00", -- MRC |
000025 => x"ed88", -- MCR |
000026 => x"ed8b", -- MCR |
000027 => x"c064", -- LDIL |
000028 => x"ed8d", -- MCR |
000029 => x"c901", -- LDIH |
000030 => x"ed2f", -- MCR |
000031 => x"ec17", -- MRC |
000032 => x"ec97", -- MRC |
000033 => x"c160", -- LDIL |
000034 => x"c909", -- LDIH |
000035 => x"c18f", -- LDIL |
000036 => x"0923", -- ADD |
000037 => x"29b3", -- CLR |
000038 => x"2a44", -- CLR |
000039 => x"100a", -- SUBS |
000040 => x"149b", -- SBCS |
000041 => x"9003", -- BMI |
000042 => x"0241", -- INC |
000043 => x"bdfc", -- B |
000044 => x"ed49", -- MCR |
000045 => x"ec22", -- MRC |
000046 => x"d406", -- SBR |
000047 => x"ed0a", -- MCR |
000048 => x"c534", -- LDIL |
000049 => x"c905", -- LDIH |
000050 => x"be4d", -- BL |
000051 => x"c12a", -- LDIL |
000052 => x"c906", -- LDIH |
000053 => x"be4a", -- BL |
000054 => x"ee11", -- MRC |
000055 => x"be4c", -- BL |
000056 => x"c13a", -- LDIL |
000057 => x"c906", -- LDIH |
000058 => x"be45", -- BL |
000059 => x"ee97", -- MRC |
000060 => x"ee17", -- MRC |
000061 => x"be46", -- BL |
000062 => x"0250", -- MOV |
000063 => x"be44", -- BL |
000064 => x"be40", -- BL |
000065 => x"ec27", -- MRC |
000066 => x"c083", -- LDIL |
000067 => x"2001", -- AND |
000068 => x"c330", -- LDIL |
000069 => x"0b60", -- ADD |
000070 => x"bc0f", -- B |
000071 => x"c552", -- LDIL |
000072 => x"c906", -- LDIH |
000073 => x"be36", -- BL |
000074 => x"c144", -- LDIL |
000075 => x"c907", -- LDIH |
000076 => x"be33", -- BL |
000077 => x"c50a", -- LDIL |
000078 => x"c907", -- LDIH |
000079 => x"be30", -- BL |
000080 => x"be32", -- BL |
000081 => x"0300", -- MOV |
000082 => x"0080", -- MOV |
000083 => x"be2e", -- BL |
000084 => x"be2c", -- BL |
000085 => x"c0b0", -- LDIL |
000086 => x"181e", -- CMP |
000087 => x"81f0", -- BEQ |
000088 => x"c0b1", -- LDIL |
000089 => x"181e", -- CMP |
000090 => x"8085", -- BEQ |
000091 => x"c0b2", -- LDIL |
000092 => x"181e", -- CMP |
000093 => x"8052", -- BEQ |
000094 => x"c0b3", -- LDIL |
000095 => x"181e", -- CMP |
000096 => x"8019", -- BEQ |
000097 => x"c0b4", -- LDIL |
000098 => x"181e", -- CMP |
000099 => x"8021", -- BEQ |
000100 => x"c296", -- LDIL |
000101 => x"ca83", -- LDIH |
000102 => x"c0f0", -- LDIL |
000103 => x"181e", -- CMP |
000104 => x"f705", -- RBAEQ |
000105 => x"c0e4", -- LDIL |
000106 => x"181e", -- CMP |
000107 => x"80e1", -- BEQ |
000108 => x"c2c8", -- LDIL |
000109 => x"ca85", -- LDIH |
000110 => x"c0f7", -- LDIL |
000111 => x"181e", -- CMP |
000112 => x"f705", -- RBAEQ |
000113 => x"c0f2", -- LDIL |
000114 => x"181e", -- CMP |
000115 => x"85da", -- BNE |
000116 => x"2800", -- CLR |
000117 => x"c080", -- LDIL |
000118 => x"cc80", -- LDIH |
000119 => x"ec99", -- MCR |
000120 => x"3400", -- GT |
000121 => x"c14a", -- LDIL |
000122 => x"c906", -- LDIH |
000123 => x"be04", -- BL |
000124 => x"2800", -- CLR |
000125 => x"2100", -- STUB |
000126 => x"bca0", -- B |
000127 => x"bc95", -- B |
000128 => x"bc95", -- B |
000129 => x"bc95", -- B |
000130 => x"bc95", -- B |
000131 => x"bc98", -- B |
000132 => x"c528", -- LDIL |
000133 => x"c906", -- LDIH |
000134 => x"be8e", -- BL |
000135 => x"be96", -- BL |
000136 => x"edca", -- MCR |
000137 => x"be94", -- BL |
000138 => x"edc9", -- MCR |
000139 => x"c036", -- LDIL |
000140 => x"c805", -- LDIH |
000141 => x"3404", -- GTL |
000142 => x"be87", -- BL |
000143 => x"be8d", -- BL |
000144 => x"c47e", -- LDIL |
000145 => x"cc4a", -- LDIH |
000146 => x"180e", -- CMP |
000147 => x"8486", -- BNE |
000148 => x"be88", -- BL |
000149 => x"3f64", -- SFT |
000150 => x"2066", -- STUB |
000151 => x"be85", -- BL |
000152 => x"20e6", -- STUB |
000153 => x"be83", -- BL |
000154 => x"2166", -- STUB |
000155 => x"be81", -- BL |
000156 => x"21e6", -- STUB |
000157 => x"be7f", -- BL |
000158 => x"2266", -- STUB |
000159 => x"be7d", -- BL |
000160 => x"22e6", -- STUB |
000161 => x"be7b", -- BL |
000162 => x"2366", -- STUB |
000163 => x"c280", -- LDIL |
000164 => x"ecda", -- MCR |
000165 => x"ec5e", -- MCR |
000166 => x"be76", -- BL |
000167 => x"7f5a", -- STR |
000168 => x"ec06", -- MRC |
000169 => x"2806", -- EOR |
000170 => x"ec0e", -- MCR |
000171 => x"2400", -- LDUB |
000172 => x"1858", -- CMP |
000173 => x"85f9", -- BNE |
000174 => x"bc53", -- B |
000175 => x"c100", -- LDIL |
000176 => x"be28", -- BL |
000177 => x"c47e", -- LDIL |
000178 => x"cc4a", -- LDIH |
000179 => x"180d", -- CMP |
000180 => x"8465", -- BNE |
000181 => x"c102", -- LDIL |
000182 => x"be22", -- BL |
000183 => x"2055", -- STUB |
000184 => x"c104", -- LDIL |
000185 => x"be1f", -- BL |
000186 => x"20d5", -- STUB |
000187 => x"c106", -- LDIL |
000188 => x"be1c", -- BL |
000189 => x"2155", -- STUB |
000190 => x"c108", -- LDIL |
000191 => x"be19", -- BL |
000192 => x"21d5", -- STUB |
000193 => x"c10a", -- LDIL |
000194 => x"be16", -- BL |
000195 => x"2255", -- STUB |
000196 => x"c10c", -- LDIL |
000197 => x"be13", -- BL |
000198 => x"22d5", -- STUB |
000199 => x"c10e", -- LDIL |
000200 => x"be10", -- BL |
000201 => x"2355", -- STUB |
000202 => x"c200", -- LDIL |
000203 => x"ecca", -- MCR |
000204 => x"ec4e", -- MCR |
000205 => x"c010", -- LDIL |
000206 => x"0940", -- ADD |
000207 => x"be09", -- BL |
000208 => x"7eca", -- STR |
000209 => x"ec06", -- MRC |
000210 => x"2805", -- EOR |
000211 => x"ec0e", -- MCR |
000212 => x"2400", -- LDUB |
000213 => x"1848", -- CMP |
000214 => x"85f7", -- BNE |
000215 => x"bc2a", -- B |
000216 => x"0370", -- MOV |
000217 => x"be3f", -- BL |
000218 => x"3eb0", -- SFT |
000219 => x"0121", -- INC |
000220 => x"be3c", -- BL |
000221 => x"26d3", -- ORR |
000222 => x"3460", -- RET |
000223 => x"c162", -- LDIL |
000224 => x"c906", -- LDIH |
000225 => x"be33", -- BL |
000226 => x"be2c", -- BL |
000227 => x"c47e", -- LDIL |
000228 => x"cc4a", -- LDIH |
000229 => x"1818", -- CMP |
000230 => x"8433", -- BNE |
000231 => x"be27", -- BL |
000232 => x"3c94", -- SFT |
000233 => x"2011", -- STUB |
000234 => x"be24", -- BL |
000235 => x"2091", -- STUB |
000236 => x"be22", -- BL |
000237 => x"2111", -- STUB |
000238 => x"be20", -- BL |
000239 => x"2191", -- STUB |
000240 => x"be1e", -- BL |
000241 => x"2211", -- STUB |
000242 => x"be1c", -- BL |
000243 => x"2291", -- STUB |
000244 => x"be1a", -- BL |
000245 => x"2311", -- STUB |
000246 => x"2ad5", -- CLR |
000247 => x"ecda", -- MCR |
000248 => x"ec5e", -- MCR |
000249 => x"be15", -- BL |
000250 => x"7cda", -- STR |
000251 => x"ec06", -- MRC |
000252 => x"2801", -- EOR |
000253 => x"ec0e", -- MCR |
000254 => x"2400", -- LDUB |
000255 => x"1858", -- CMP |
000256 => x"85f9", -- BNE |
000257 => x"ec11", -- MRC |
000258 => x"ec8a", -- MCR |
000259 => x"c506", -- LDIL |
000260 => x"c906", -- LDIH |
000261 => x"be0f", -- BL |
000262 => x"ec06", -- MRC |
000263 => x"2491", -- LDUB |
000264 => x"1809", -- CMP |
000265 => x"8015", -- BEQ |
000266 => x"c52e", -- LDIL |
000267 => x"c907", -- LDIH |
000268 => x"be08", -- BL |
000269 => x"bccf", -- B |
000270 => x"0370", -- MOV |
000271 => x"be08", -- BL |
000272 => x"3c80", -- SFT |
000273 => x"be06", -- BL |
000274 => x"2490", -- ORR |
000275 => x"3460", -- RET |
000276 => x"bccb", -- B |
000277 => x"bcd3", -- B |
000278 => x"bcd7", -- B |
000279 => x"bcdb", -- B |
000280 => x"bc71", -- B |
000281 => x"bcc0", -- B |
000282 => x"bd33", -- B |
000283 => x"bc6f", -- B |
000284 => x"bcc2", -- B |
000285 => x"bcda", -- B |
000286 => x"c176", -- LDIL |
000287 => x"c906", -- LDIH |
000288 => x"bebf", -- BL |
000289 => x"24aa", -- LDUBS |
000290 => x"8010", -- BEQ |
000291 => x"c0a2", -- LDIL |
000292 => x"bec9", -- BL |
000293 => x"24a2", -- LDUB |
000294 => x"be20", -- BL |
000295 => x"24b3", -- LDUB |
000296 => x"be1e", -- BL |
000297 => x"24c4", -- LDUB |
000298 => x"be1c", -- BL |
000299 => x"24d5", -- LDUB |
000300 => x"be1a", -- BL |
000301 => x"24e6", -- LDUB |
000302 => x"be18", -- BL |
000303 => x"c0a2", -- LDIL |
000304 => x"bebd", -- BL |
000305 => x"beb7", -- BL |
000306 => x"c546", -- LDIL |
000307 => x"c906", -- LDIH |
000308 => x"beab", -- BL |
000309 => x"ee06", -- MRC |
000310 => x"bee6", -- BL |
000311 => x"beb1", -- BL |
000312 => x"beb0", -- BL |
000313 => x"beaf", -- BL |
000314 => x"beae", -- BL |
000315 => x"c080", -- LDIL |
000316 => x"ccc0", -- LDIH |
000317 => x"1c01", -- STSR |
000318 => x"2800", -- CLR |
000319 => x"ed0f", -- MCR |
000320 => x"ec88", -- MCR |
000321 => x"ec8b", -- MCR |
000322 => x"ec8c", -- MCR |
000323 => x"ec8a", -- MCR |
000324 => x"ec89", -- MCR |
000325 => x"3400", -- GT |
000326 => x"0370", -- MOV |
000327 => x"3c90", -- SFT |
000328 => x"bea5", -- BL |
000329 => x"3c90", -- SFT |
000330 => x"bea3", -- BL |
000331 => x"3460", -- RET |
000332 => x"c51a", -- LDIL |
000333 => x"c906", -- LDIH |
000334 => x"be91", -- BL |
000335 => x"bea8", -- BL |
000336 => x"c136", -- LDIL |
000337 => x"c905", -- LDIH |
000338 => x"3424", -- GTL |
000339 => x"ecca", -- MCR |
000340 => x"be94", -- BL |
000341 => x"c280", -- LDIL |
000342 => x"c00f", -- LDIL |
000343 => x"2058", -- ANDS |
000344 => x"840e", -- BNE |
000345 => x"be8f", -- BL |
000346 => x"c0a4", -- LDIL |
000347 => x"be92", -- BL |
000348 => x"ee12", -- MRC |
000349 => x"bebf", -- BL |
000350 => x"c0ae", -- LDIL |
000351 => x"be8e", -- BL |
000352 => x"0250", -- MOV |
000353 => x"bebb", -- BL |
000354 => x"c0ba", -- LDIL |
000355 => x"be8a", -- BL |
000356 => x"c0a0", -- LDIL |
000357 => x"be88", -- BL |
000358 => x"7a5a", -- LDR |
000359 => x"c0a0", -- LDIL |
000360 => x"be85", -- BL |
000361 => x"beb3", -- BL |
000362 => x"c00f", -- LDIL |
000363 => x"2058", -- ANDS |
000364 => x"8414", -- BNE |
000365 => x"c0a0", -- LDIL |
000366 => x"be7f", -- BL |
000367 => x"be7e", -- BL |
000368 => x"c010", -- LDIL |
000369 => x"1250", -- SUB |
000370 => x"c470", -- LDIL |
000371 => x"2240", -- AND |
000372 => x"c12e", -- LDIL |
000373 => x"78c9", -- LDR |
000374 => x"3c90", -- SFT |
000375 => x"c880", -- LDIH |
000376 => x"c020", -- LDIL |
000377 => x"1818", -- CMP |
000378 => x"f8c2", -- MVHI |
000379 => x"be72", -- BL |
000380 => x"c08f", -- LDIL |
000381 => x"2014", -- AND |
000382 => x"3409", -- TEQ |
000383 => x"85f6", -- BNE |
000384 => x"ec20", -- MRC |
000385 => x"dc0f", -- STB |
000386 => x"b804", -- BTS |
000387 => x"c5fe", -- LDIL |
000388 => x"343d", -- TEQ |
000389 => x"85d1", -- BNE |
000390 => x"be6c", -- BL |
000391 => x"2800", -- CLR |
000392 => x"3400", -- GT |
000393 => x"bc54", -- B |
000394 => x"bc92", -- B |
000395 => x"c001", -- LDIL |
000396 => x"ed0c", -- MCR |
000397 => x"c050", -- LDIL |
000398 => x"c83f", -- LDIH |
000399 => x"ed0a", -- MCR |
000400 => x"c000", -- LDIL |
000401 => x"c801", -- LDIH |
000402 => x"bea8", -- BL |
000403 => x"c154", -- LDIL |
000404 => x"c906", -- LDIH |
000405 => x"be4a", -- BL |
000406 => x"c162", -- LDIL |
000407 => x"c906", -- LDIH |
000408 => x"be47", -- BL |
000409 => x"be59", -- BL |
000410 => x"3c80", -- SFT |
000411 => x"be57", -- BL |
000412 => x"2410", -- ORR |
000413 => x"c4fe", -- LDIL |
000414 => x"ccca", -- LDIH |
000415 => x"1809", -- CMP |
000416 => x"8439", -- BNE |
000417 => x"c100", -- LDIL |
000418 => x"0290", -- MOV |
000419 => x"be2f", -- BL |
000420 => x"be4e", -- BL |
000421 => x"3c80", -- SFT |
000422 => x"be4c", -- BL |
000423 => x"2690", -- ORR |
000424 => x"3ed4", -- SFT |
000425 => x"2055", -- STUB |
000426 => x"c102", -- LDIL |
000427 => x"be27", -- BL |
000428 => x"be46", -- BL |
000429 => x"3c80", -- SFT |
000430 => x"be44", -- BL |
000431 => x"2690", -- ORR |
000432 => x"20d5", -- STUB |
000433 => x"c104", -- LDIL |
000434 => x"be20", -- BL |
000435 => x"c106", -- LDIL |
000436 => x"be3e", -- BL |
000437 => x"0180", -- MOV |
000438 => x"be8a", -- BL |
000439 => x"0121", -- INC |
000440 => x"c010", -- LDIL |
000441 => x"1828", -- CMP |
000442 => x"85fa", -- BNE |
000443 => x"2ad5", -- CLR |
000444 => x"be36", -- BL |
000445 => x"0180", -- MOV |
000446 => x"be82", -- BL |
000447 => x"0121", -- INC |
000448 => x"2400", -- LDUB |
000449 => x"02d1", -- INC |
000450 => x"1858", -- CMP |
000451 => x"85f9", -- BNE |
000452 => x"c001", -- LDIL |
000453 => x"ed0c", -- MCR |
000454 => x"c050", -- LDIL |
000455 => x"c83f", -- LDIH |
000456 => x"ed0a", -- MCR |
000457 => x"c00c", -- LDIL |
000458 => x"c801", -- LDIH |
000459 => x"be6f", -- BL |
000460 => x"c506", -- LDIL |
000461 => x"c906", -- LDIH |
000462 => x"be11", -- BL |
000463 => x"c68e", -- LDIL |
000464 => x"ca80", -- LDIH |
000465 => x"3450", -- GT |
000466 => x"0370", -- MOV |
000467 => x"3dd0", -- SFT |
000468 => x"be6c", -- BL |
000469 => x"0121", -- INC |
000470 => x"01d0", -- MOV |
000471 => x"be69", -- BL |
000472 => x"3460", -- RET |
000473 => x"c512", -- LDIL |
000474 => x"c907", -- LDIH |
000475 => x"be04", -- BL |
000476 => x"bcb9", -- B |
000477 => x"bc93", -- B |
000478 => x"bca4", -- B |
000479 => x"01f0", -- MOV |
000480 => x"78a9", -- LDR |
000481 => x"3c90", -- SFT |
000482 => x"c880", -- LDIH |
000483 => x"3419", -- TEQ |
000484 => x"8003", -- BEQ |
000485 => x"be08", -- BL |
000486 => x"bdfa", -- B |
000487 => x"3430", -- RET |
000488 => x"0170", -- MOV |
000489 => x"c08d", -- LDIL |
000490 => x"be03", -- BL |
000491 => x"c08a", -- LDIL |
000492 => x"03a0", -- MOV |
000493 => x"ec22", -- MRC |
000494 => x"dc05", -- STB |
000495 => x"b9fe", -- BTS |
000496 => x"ed18", -- MCR |
000497 => x"3470", -- RET |
000498 => x"ec20", -- MRC |
000499 => x"dc8f", -- STBI |
000500 => x"b9fe", -- BTS |
000501 => x"c800", -- LDIH |
000502 => x"3470", -- RET |
000503 => x"0170", -- MOV |
000504 => x"c200", -- LDIL |
000505 => x"c184", -- LDIL |
000506 => x"bff8", -- BL |
000507 => x"c0c7", -- LDIL |
000508 => x"1809", -- CMP |
000509 => x"9003", -- BMI |
000510 => x"c0a0", -- LDIL |
000511 => x"1001", -- SUB |
000512 => x"c0b0", -- LDIL |
000513 => x"1809", -- CMP |
000514 => x"91f8", -- BMI |
000515 => x"c0c6", -- LDIL |
000516 => x"1818", -- CMP |
000517 => x"91f5", -- BMI |
000518 => x"c0b9", -- LDIL |
000519 => x"1818", -- CMP |
000520 => x"a404", -- BLS |
000521 => x"c0c1", -- LDIL |
000522 => x"1809", -- CMP |
000523 => x"a1ef", -- BHI |
000524 => x"0080", -- MOV |
000525 => x"bfe0", -- BL |
000526 => x"c030", -- LDIL |
000527 => x"1090", -- SUB |
000528 => x"c009", -- LDIL |
000529 => x"1809", -- CMP |
000530 => x"a402", -- BLS |
000531 => x"0497", -- DEC |
000532 => x"3e42", -- SFT |
000533 => x"3e42", -- SFT |
000534 => x"3e42", -- SFT |
000535 => x"3e42", -- SFT |
000536 => x"2641", -- ORR |
000537 => x"05b9", -- DECS |
000538 => x"85e0", -- BNE |
000539 => x"3420", -- RET |
000540 => x"0370", -- MOV |
000541 => x"3d42", -- SFT |
000542 => x"3d22", -- SFT |
000543 => x"3d22", -- SFT |
000544 => x"3d22", -- SFT |
000545 => x"be0f", -- BL |
000546 => x"bfcb", -- BL |
000547 => x"3d40", -- SFT |
000548 => x"be0c", -- BL |
000549 => x"bfc8", -- BL |
000550 => x"3d45", -- SFT |
000551 => x"3d25", -- SFT |
000552 => x"3d25", -- SFT |
000553 => x"3d25", -- SFT |
000554 => x"be06", -- BL |
000555 => x"bfc2", -- BL |
000556 => x"0140", -- MOV |
000557 => x"be03", -- BL |
000558 => x"bfbf", -- BL |
000559 => x"3460", -- RET |
000560 => x"c08f", -- LDIL |
000561 => x"2121", -- AND |
000562 => x"c089", -- LDIL |
000563 => x"181a", -- CMP |
000564 => x"8803", -- BCS |
000565 => x"c0b0", -- LDIL |
000566 => x"bc02", -- B |
000567 => x"c0b7", -- LDIL |
000568 => x"0892", -- ADD |
000569 => x"3470", -- RET |
000570 => x"ed0b", -- MCR |
000571 => x"ec22", -- MRC |
000572 => x"dc03", -- STB |
000573 => x"b9fe", -- BTS |
000574 => x"ec23", -- MRC |
000575 => x"3470", -- RET |
000576 => x"00f0", -- MOV |
000577 => x"c050", -- LDIL |
000578 => x"c837", -- LDIH |
000579 => x"ed0a", -- MCR |
000580 => x"c001", -- LDIL |
000581 => x"ed0c", -- MCR |
000582 => x"c006", -- LDIL |
000583 => x"bff3", -- BL |
000584 => x"c050", -- LDIL |
000585 => x"c83f", -- LDIH |
000586 => x"ed0a", -- MCR |
000587 => x"c000", -- LDIL |
000588 => x"c805", -- LDIH |
000589 => x"bfed", -- BL |
000590 => x"dc01", -- STB |
000591 => x"b805", -- BTS |
000592 => x"c53e", -- LDIL |
000593 => x"c907", -- LDIH |
000594 => x"bf8d", -- BL |
000595 => x"bc42", -- B |
000596 => x"c040", -- LDIL |
000597 => x"c83f", -- LDIH |
000598 => x"ed0a", -- MCR |
000599 => x"c001", -- LDIL |
000600 => x"ed0c", -- MCR |
000601 => x"3c20", -- SFT |
000602 => x"c802", -- LDIH |
000603 => x"bfdf", -- BL |
000604 => x"03a0", -- MOV |
000605 => x"cb80", -- LDIH |
000606 => x"3ff0", -- SFT |
000607 => x"0030", -- MOV |
000608 => x"c800", -- LDIH |
000609 => x"2407", -- ORR |
000610 => x"bfd8", -- BL |
000611 => x"2800", -- CLR |
000612 => x"ed0c", -- MCR |
000613 => x"c050", -- LDIL |
000614 => x"c83f", -- LDIH |
000615 => x"ed0a", -- MCR |
000616 => x"c001", -- LDIL |
000617 => x"ed0c", -- MCR |
000618 => x"c000", -- LDIL |
000619 => x"c805", -- LDIH |
000620 => x"bfce", -- BL |
000621 => x"dc00", -- STB |
000622 => x"b9fc", -- BTS |
000623 => x"3410", -- RET |
000624 => x"00f0", -- MOV |
000625 => x"c040", -- LDIL |
000626 => x"c83f", -- LDIH |
000627 => x"ed0a", -- MCR |
000628 => x"c001", -- LDIL |
000629 => x"ed0c", -- MCR |
000630 => x"3c20", -- SFT |
000631 => x"c803", -- LDIH |
000632 => x"bfc2", -- BL |
000633 => x"0020", -- MOV |
000634 => x"c800", -- LDIH |
000635 => x"3c00", -- SFT |
000636 => x"bfbe", -- BL |
000637 => x"29b3", -- CLR |
000638 => x"ed3c", -- MCR |
000639 => x"0180", -- MOV |
000640 => x"c980", -- LDIH |
000641 => x"3410", -- RET |
000642 => x"e5b0", -- CDP |
000643 => x"ec30", -- MRC |
000644 => x"dc06", -- STB |
000645 => x"b9fe", -- BTS |
000646 => x"c306", -- LDIL |
000647 => x"200e", -- ANDS |
000648 => x"840a", -- BNE |
000649 => x"ecb1", -- MRC |
000650 => x"ef32", -- MRC |
000651 => x"2800", -- CLR |
000652 => x"009a", -- INCS |
000653 => x"0f60", -- ADC |
000654 => x"ed99", -- MCR |
000655 => x"edea", -- MCR |
000656 => x"ef34", -- MRC |
000657 => x"3470", -- RET |
000658 => x"c550", -- LDIL |
000659 => x"c907", -- LDIH |
000660 => x"bf4b", -- BL |
000661 => x"c55e", -- LDIL |
000662 => x"c907", -- LDIH |
000663 => x"bf48", -- BL |
000664 => x"bf5a", -- BL |
000665 => x"2800", -- CLR |
000666 => x"3400", -- GT |
000667 => x"0170", -- MOV |
000668 => x"bf56", -- BL |
000669 => x"c08d", -- LDIL |
000670 => x"1809", -- CMP |
000671 => x"f702", -- RBAEQ |
000672 => x"c088", -- LDIL |
000673 => x"1809", -- CMP |
000674 => x"8034", -- BEQ |
000675 => x"bdf9", -- B |
000676 => x"c528", -- LDIL |
000677 => x"c906", -- LDIH |
000678 => x"bf39", -- BL |
000679 => x"bf50", -- BL |
000680 => x"edca", -- MCR |
000681 => x"bf4e", -- BL |
000682 => x"edc9", -- MCR |
000683 => x"bff0", -- BL |
000684 => x"bf3c", -- BL |
000685 => x"c536", -- LDIL |
000686 => x"c906", -- LDIH |
000687 => x"bf30", -- BL |
000688 => x"bf47", -- BL |
000689 => x"02c0", -- MOV |
000690 => x"bfe9", -- BL |
000691 => x"bf35", -- BL |
000692 => x"345d", -- TEQ |
000693 => x"8021", -- BEQ |
000694 => x"06d1", -- DEC |
000695 => x"bf31", -- BL |
000696 => x"c0a4", -- LDIL |
000697 => x"bf34", -- BL |
000698 => x"ee32", -- MRC |
000699 => x"bf61", -- BL |
000700 => x"ee31", -- MRC |
000701 => x"bf5f", -- BL |
000702 => x"c0ba", -- LDIL |
000703 => x"bf2e", -- BL |
000704 => x"c0a0", -- LDIL |
000705 => x"bf2c", -- BL |
000706 => x"bfc0", -- BL |
000707 => x"0260", -- MOV |
000708 => x"bf58", -- BL |
000709 => x"c320", -- LDIL |
000710 => x"c1ae", -- LDIL |
000711 => x"00e0", -- MOV |
000712 => x"bf25", -- BL |
000713 => x"3cc0", -- SFT |
000714 => x"c880", -- LDIH |
000715 => x"181e", -- CMP |
000716 => x"f8c3", -- MVHI |
000717 => x"bf20", -- BL |
000718 => x"00c0", -- MOV |
000719 => x"c880", -- LDIH |
000720 => x"181e", -- CMP |
000721 => x"f8c3", -- MVHI |
000722 => x"bf1b", -- BL |
000723 => x"eca0", -- MRC |
000724 => x"dc9f", -- STBI |
000725 => x"b9df", -- BTS |
000726 => x"bf12", -- BL |
000727 => x"c69a", -- LDIL |
000728 => x"ca80", -- LDIH |
000729 => x"3450", -- GT |
000730 => x"0d0a", -- .DW |
000731 => x"0d0a", -- .DW |
000732 => x"4174", -- .DW |
000733 => x"6c61", -- .DW |
000734 => x"732d", -- .DW |
000735 => x"324b", -- .DW |
000736 => x"2042", -- .DW |
000737 => x"6f6f", -- .DW |
000738 => x"746c", -- .DW |
000739 => x"6f61", -- .DW |
000740 => x"6465", -- .DW |
000741 => x"7220", -- .DW |
000742 => x"2d20", -- .DW |
000743 => x"5632", -- .DW |
000744 => x"3031", -- .DW |
000745 => x"3430", -- .DW |
000746 => x"3531", -- .DW |
000747 => x"360d", -- .DW |
000748 => x"0a62", -- .DW |
000749 => x"7920", -- .DW |
000750 => x"5374", -- .DW |
000751 => x"6570", -- .DW |
000752 => x"6861", -- .DW |
000753 => x"6e20", -- .DW |
000754 => x"4e6f", -- .DW |
000755 => x"6c74", -- .DW |
000756 => x"696e", -- .DW |
000757 => x"672c", -- .DW |
000758 => x"2073", -- .DW |
000759 => x"746e", -- .DW |
000760 => x"6f6c", -- .DW |
000761 => x"7469", -- .DW |
000762 => x"6e67", -- .DW |
000763 => x"4067", -- .DW |
000764 => x"6d61", -- .DW |
000765 => x"696c", -- .DW |
000766 => x"2e63", -- .DW |
000767 => x"6f6d", -- .DW |
000768 => x"0d0a", -- .DW |
000769 => x"7777", -- .DW |
000770 => x"772e", -- .DW |
000771 => x"6f70", -- .DW |
000772 => x"656e", -- .DW |
000773 => x"636f", -- .DW |
000774 => x"7265", -- .DW |
000775 => x"732e", -- .DW |
000776 => x"6f72", -- .DW |
000777 => x"672f", -- .DW |
000778 => x"7072", -- .DW |
000779 => x"6f6a", -- .DW |
000780 => x"6563", -- .DW |
000781 => x"742c", -- .DW |
000782 => x"6174", -- .DW |
000783 => x"6c61", -- .DW |
000784 => x"735f", -- .DW |
000785 => x"636f", -- .DW |
000786 => x"7265", -- .DW |
000787 => x"0d0a", -- .DW |
000788 => x"0000", -- .DW |
000789 => x"0d0a", -- .DW |
000790 => x"426f", -- .DW |
000791 => x"6f74", -- .DW |
000792 => x"2070", -- .DW |
000793 => x"6167", -- .DW |
000794 => x"653a", -- .DW |
000795 => x"2030", -- .DW |
000796 => x"7800", -- .DW |
000797 => x"0d0a", -- .DW |
000798 => x"436c", -- .DW |
000799 => x"6f63", -- .DW |
000800 => x"6b28", -- .DW |
000801 => x"487a", -- .DW |
000802 => x"293a", -- .DW |
000803 => x"2030", -- .DW |
000804 => x"7800", -- .DW |
000805 => x"426f", -- .DW |
000806 => x"6f74", -- .DW |
000807 => x"696e", -- .DW |
000808 => x"670d", -- .DW |
000809 => x"0a00", -- .DW |
000810 => x"4275", -- .DW |
000811 => x"726e", -- .DW |
000812 => x"2045", -- .DW |
000813 => x"4550", -- .DW |
000814 => x"524f", -- .DW |
000815 => x"4d0d", -- .DW |
000816 => x"0a00", -- .DW |
000817 => x"4177", -- .DW |
000818 => x"6169", -- .DW |
000819 => x"7469", -- .DW |
000820 => x"6e67", -- .DW |
000821 => x"2069", -- .DW |
000822 => x"6d61", -- .DW |
000823 => x"6765", -- .DW |
000824 => x"2e2e", -- .DW |
000825 => x"2e0d", -- .DW |
000826 => x"0a00", -- .DW |
000827 => x"5374", -- .DW |
000828 => x"6172", -- .DW |
000829 => x"7469", -- .DW |
000830 => x"6e67", -- .DW |
000831 => x"2069", -- .DW |
000832 => x"6d61", -- .DW |
000833 => x"6765", -- .DW |
000834 => x"2000", -- .DW |
000835 => x"446f", -- .DW |
000836 => x"776e", -- .DW |
000837 => x"6c6f", -- .DW |
000838 => x"6164", -- .DW |
000839 => x"2063", -- .DW |
000840 => x"6f6d", -- .DW |
000841 => x"706c", -- .DW |
000842 => x"6574", -- .DW |
000843 => x"650d", -- .DW |
000844 => x"0a00", -- .DW |
000845 => x"5061", -- .DW |
000846 => x"6765", -- .DW |
000847 => x"2028", -- .DW |
000848 => x"3468", -- .DW |
000849 => x"293a", -- .DW |
000850 => x"2024", -- .DW |
000851 => x"0000", -- .DW |
000852 => x"4164", -- .DW |
000853 => x"6472", -- .DW |
000854 => x"2028", -- .DW |
000855 => x"3868", -- .DW |
000856 => x"293a", -- .DW |
000857 => x"2024", -- .DW |
000858 => x"0000", -- .DW |
000859 => x"2377", -- .DW |
000860 => x"6f72", -- .DW |
000861 => x"6473", -- .DW |
000862 => x"2028", -- .DW |
000863 => x"3468", -- .DW |
000864 => x"293a", -- .DW |
000865 => x"2024", -- .DW |
000866 => x"0000", -- .DW |
000867 => x"4368", -- .DW |
000868 => x"6563", -- .DW |
000869 => x"6b73", -- .DW |
000870 => x"756d", -- .DW |
000871 => x"3a20", -- .DW |
000872 => x"2400", -- .DW |
000873 => x"0d0a", -- .DW |
000874 => x"636d", -- .DW |
000875 => x"642f", -- .DW |
000876 => x"626f", -- .DW |
000877 => x"6f74", -- .DW |
000878 => x"2d73", -- .DW |
000879 => x"7769", -- .DW |
000880 => x"7463", -- .DW |
000881 => x"683a", -- .DW |
000882 => x"0d0a", -- .DW |
000883 => x"2030", -- .DW |
000884 => x"2f27", -- .DW |
000885 => x"3030", -- .DW |
000886 => x"273a", -- .DW |
000887 => x"2028", -- .DW |
000888 => x"5265", -- .DW |
000889 => x"2d29", -- .DW |
000890 => x"5374", -- .DW |
000891 => x"6172", -- .DW |
000892 => x"7420", -- .DW |
000893 => x"636f", -- .DW |
000894 => x"6e73", -- .DW |
000895 => x"6f6c", -- .DW |
000896 => x"650d", -- .DW |
000897 => x"0a20", -- .DW |
000898 => x"312f", -- .DW |
000899 => x"2730", -- .DW |
000900 => x"3127", -- .DW |
000901 => x"3a20", -- .DW |
000902 => x"426f", -- .DW |
000903 => x"6f74", -- .DW |
000904 => x"2055", -- .DW |
000905 => x"4152", -- .DW |
000906 => x"540d", -- .DW |
000907 => x"0a20", -- .DW |
000908 => x"322f", -- .DW |
000909 => x"2731", -- .DW |
000910 => x"3027", -- .DW |
000911 => x"3a20", -- .DW |
000912 => x"426f", -- .DW |
000913 => x"6f74", -- .DW |
000914 => x"2045", -- .DW |
000915 => x"4550", -- .DW |
000916 => x"524f", -- .DW |
000917 => x"4d0d", -- .DW |
000918 => x"0a20", -- .DW |
000919 => x"332f", -- .DW |
000920 => x"2731", -- .DW |
000921 => x"3127", -- .DW |
000922 => x"3a20", -- .DW |
000923 => x"426f", -- .DW |
000924 => x"6f74", -- .DW |
000925 => x"206d", -- .DW |
000926 => x"656d", -- .DW |
000927 => x"6f72", -- .DW |
000928 => x"790d", -- .DW |
000929 => x"0a00", -- .DW |
000930 => x"2034", -- .DW |
000931 => x"3a20", -- .DW |
000932 => x"426f", -- .DW |
000933 => x"6f74", -- .DW |
000934 => x"2057", -- .DW |
000935 => x"420d", -- .DW |
000936 => x"0a20", -- .DW |
000937 => x"703a", -- .DW |
000938 => x"2042", -- .DW |
000939 => x"7572", -- .DW |
000940 => x"6e20", -- .DW |
000941 => x"4545", -- .DW |
000942 => x"5052", -- .DW |
000943 => x"4f4d", -- .DW |
000944 => x"0d0a", -- .DW |
000945 => x"2064", -- .DW |
000946 => x"3a20", -- .DW |
000947 => x"5241", -- .DW |
000948 => x"4d20", -- .DW |
000949 => x"6475", -- .DW |
000950 => x"6d70", -- .DW |
000951 => x"0d0a", -- .DW |
000952 => x"2072", -- .DW |
000953 => x"3a20", -- .DW |
000954 => x"5265", -- .DW |
000955 => x"7365", -- .DW |
000956 => x"740d", -- .DW |
000957 => x"0a20", -- .DW |
000958 => x"773a", -- .DW |
000959 => x"2057", -- .DW |
000960 => x"4220", -- .DW |
000961 => x"6475", -- .DW |
000962 => x"6d70", -- .DW |
000963 => x"0d0a", -- .DW |
000964 => x"0000", -- .DW |
000965 => x"636d", -- .DW |
000966 => x"643a", -- .DW |
000967 => x"3e20", -- .DW |
000968 => x"0000", -- .DW |
000969 => x"494d", -- .DW |
000970 => x"4147", -- .DW |
000971 => x"4520", -- .DW |
000972 => x"4552", -- .DW |
000973 => x"5221", -- .DW |
000974 => x"0d0a", -- .DW |
000975 => x"0000", -- .DW |
000976 => x"0d0a", -- .DW |
000977 => x"4952", -- .DW |
000978 => x"5120", -- .DW |
000979 => x"4552", -- .DW |
000980 => x"5221", -- .DW |
000981 => x"0d0a", -- .DW |
000982 => x"0000", -- .DW |
000983 => x"4348", -- .DW |
000984 => x"4543", -- .DW |
000985 => x"4b53", -- .DW |
000986 => x"554d", -- .DW |
000987 => x"2045", -- .DW |
000988 => x"5252", -- .DW |
000989 => x"210d", -- .DW |
000990 => x"0a00", -- .DW |
000991 => x"5350", -- .DW |
000992 => x"492f", -- .DW |
000993 => x"4545", -- .DW |
000994 => x"5052", -- .DW |
000995 => x"4f4d", -- .DW |
000996 => x"2045", -- .DW |
000997 => x"5252", -- .DW |
000998 => x"210d", -- .DW |
000999 => x"0a00", -- .DW |
001000 => x"5742", -- .DW |
001001 => x"2042", -- .DW |
001002 => x"5553", -- .DW |
001003 => x"2045", -- .DW |
001004 => x"5252", -- .DW |
001005 => x"210d", -- .DW |
001006 => x"0a00", -- .DW |
001007 => x"5072", -- .DW |
001008 => x"6573", -- .DW |
001009 => x"7320", -- .DW |
001010 => x"616e", -- .DW |
001011 => x"7920", -- .DW |
001012 => x"6b65", -- .DW |
001013 => x"790d", -- .DW |
001014 => x"0a00", -- .DW |
others => x"0000" -- NOP |
); |
------------------------------------------------------ |
|
begin |
|
-- Memory Access --------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
MEM_FILE_ACCESS: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
-- Data Read -- |
if (D_EN_I = '1') then -- valid access |
if (word_mode_en_c = true) then -- read data access |
D_DAT_O <= BOOT_MEM_FILE_C(to_integer(unsigned(D_ADR_I(log2_mem_size_c-1 downto 0)))); |
else |
D_DAT_O <= BOOT_MEM_FILE_C(to_integer(unsigned(D_ADR_I(log2_mem_size_c downto 1)))); |
end if; |
end if; |
-- Instruction Read -- |
if (I_EN_I = '1') then |
if (word_mode_en_c = true) then |
I_DAT_O <= BOOT_MEM_FILE_C(to_integer(unsigned(I_ADR_I(log2_mem_size_c-1 downto 0)))); |
else |
I_DAT_O <= BOOT_MEM_FILE_C(to_integer(unsigned(I_ADR_I(log2_mem_size_c downto 1)))); |
end if; |
end if; |
end if; |
end process MEM_FILE_ACCESS; |
-- Memory Access --------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
mem_file_access: process(clk_i) |
begin |
if rising_edge(clk_i) then |
-- data read -- |
if (d_en_i = '1') then -- valid access |
if (word_mode_en_c = true) then -- read data access |
d_dat_o <= boot_mem_file_c(to_integer(unsigned(d_adr_i(log2_mem_size_c-1 downto 0)))); |
else |
d_dat_o <= boot_mem_file_c(to_integer(unsigned(d_adr_i(log2_mem_size_c downto 1)))); |
end if; |
end if; |
-- instruction read -- |
if (word_mode_en_c = true) then |
i_dat_o <= boot_mem_file_c(to_integer(unsigned(i_adr_i(log2_mem_size_c-1 downto 0)))); |
else |
i_dat_o <= boot_mem_file_c(to_integer(unsigned(i_adr_i(log2_mem_size_c downto 1)))); |
end if; |
end if; |
end process mem_file_access; |
|
|
|
end BOOT_MEM_STRUCTURE; |
end boot_mem_structure; |
/atlas_core/trunk/rtl/CTRL.vhd
4,7 → 4,7
-- # Main control system, generating control signals # |
-- # for each pipeline stage. # |
-- # **************************************************** # |
-- # Last modified: 23.03.2014 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
16,277 → 16,284
library work; |
use work.atlas_core_package.all; |
|
entity CTRL is |
port ( |
entity ctrl is |
port ( |
-- ############################################################################################### |
-- ## Global Control ## |
-- ############################################################################################### |
|
CLK_I : in std_logic; -- global clock line |
CE_I : in std_logic; -- clock enable |
RST_I : in std_logic; -- global reset line, sync, high-active |
clk_i : in std_logic; -- global clock line |
ce_i : in std_logic; -- clock enable |
rst_i : in std_logic; -- global reset line, sync, high-active |
|
-- ############################################################################################### |
-- ## Decoder Interface ## |
-- ############################################################################################### |
|
OP_DEC_CTRL_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- decoder ctrl lines |
MULTI_CYC_O : out std_logic; -- multi-cycle indicator |
MULTI_CYC_REQ_I : in std_logic; -- multi-cycle request |
INSTR_I : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
INSTR_REG_O : out std_logic_vector(data_width_c-1 downto 0); -- instruction register |
op_dec_ctrl_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- decoder ctrl lines |
multi_cyc_o : out std_logic; -- multi-cycle indicator |
multi_cyc_req_i : in std_logic; -- multi-cycle request |
instr_i : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
instr_reg_o : out std_logic_vector(data_width_c-1 downto 0); -- instruction register |
|
-- ############################################################################################### |
-- ## Control Lines ## |
-- ############################################################################################### |
|
OF_CTRL_BUS_O : out std_logic_vector(ctrl_width_c-1 downto 0); -- of stage control |
EX_CTRL_BUS_O : out std_logic_vector(ctrl_width_c-1 downto 0); -- ex stage control |
MA_CTRL_BUS_O : out std_logic_vector(ctrl_width_c-1 downto 0); -- ma stage control |
WB_CTRL_BUS_O : out std_logic_vector(ctrl_width_c-1 downto 0); -- wb stage control |
of_ctrl_bus_o : out std_logic_vector(ctrl_width_c-1 downto 0); -- of stage control |
ex_ctrl_bus_o : out std_logic_vector(ctrl_width_c-1 downto 0); -- ex stage control |
ma_ctrl_bus_o : out std_logic_vector(ctrl_width_c-1 downto 0); -- ma stage control |
wb_ctrl_bus_o : out std_logic_vector(ctrl_width_c-1 downto 0); -- wb stage control |
|
-- ############################################################################################### |
-- ## Function Control ## |
-- ############################################################################################### |
|
COND_TRUE_I : in std_logic; -- condition is true |
VALID_BRANCH_I : in std_logic; -- valid branch detected |
EXC_TAKEN_I : in std_logic; -- exception taken |
WAKE_UP_I : in std_logic; -- wake up from sleep |
EXC_POS_O : out std_logic; -- exception would be possible |
STOP_PC_O : out std_logic; -- freeze program counter |
IR_UPDATE_EN_O : out std_logic -- enable instruction reg update |
); |
end CTRL; |
cond_true_i : in std_logic; -- condition is true |
valid_branch_i : in std_logic; -- valid branch detected |
exc_taken_i : in std_logic; -- exception taken |
wake_up_i : in std_logic; -- wake up from sleep |
exc_pos_o : out std_logic; -- exception would be possible |
stop_pc_o : out std_logic -- freeze program counter |
); |
end ctrl; |
|
architecture CTRL_STRUCTURE of CTRL is |
architecture ctrl_structure of ctrl is |
|
-- Pipeline register -- |
signal EX_CTRL_FF : std_logic_vector(ctrl_width_c-1 downto 0); |
signal EX_CTRL_BUF : std_logic_vector(ctrl_width_c-1 downto 0); |
signal MA_CTRL_FF : std_logic_vector(ctrl_width_c-1 downto 0); |
signal WB_CTRL_FF : std_logic_vector(ctrl_width_c-1 downto 0); |
-- pipeline register -- |
signal ex_ctrl_ff : std_logic_vector(ctrl_width_c-1 downto 0); |
signal ex_ctrl_buf : std_logic_vector(ctrl_width_c-1 downto 0); |
signal ma_ctrl_ff : std_logic_vector(ctrl_width_c-1 downto 0); |
signal wb_ctrl_ff : std_logic_vector(ctrl_width_c-1 downto 0); |
|
-- Branch arbiter -- |
signal DIS_CYCLE_FF : std_logic; |
signal DIS_CYCLE : std_logic; |
-- branch arbiter -- |
signal dis_cycle_ff : std_logic; |
signal dis_cycle : std_logic; |
|
-- Instruction Fetch Arbiter -- |
signal DIS_IF : std_logic; |
signal MEM_DEPENDECY : std_logic; |
signal MULTI_CYC_FF : std_logic; |
-- instruction fetch arbiter -- |
signal dis_if : std_logic; |
signal mem_dependecy : std_logic; |
signal multi_cyc_ff : std_logic; |
signal ir_backup_reg : std_logic_vector(data_width_c-1 downto 0); |
signal ir_backup_ctrl : std_logic; |
|
-- System enable/Start-up control -- |
signal SYS_ENABLE : std_logic; |
signal START_FF : std_logic; |
signal SLEEP_FLAG : std_logic; |
-- system enable/start-up control -- |
signal sys_enable : std_logic; |
signal start_ff : std_logic; |
signal sleep_flag : std_logic; |
|
-- EX LDDD -- |
-- signal EX_A_MA_FWD : std_logic; |
-- signal EX_A_WB_FWD : std_logic; |
-- signal EX_B_MA_FWD : std_logic; |
-- signal EX_B_WB_FWD : std_logic; |
-- signal EX_C_WB_FWD : std_logic; |
-- ex lddd -- |
-- signal ex_a_ma_fwd : std_logic; |
-- signal ex_a_wb_fwd : std_logic; |
-- signal ex_b_ma_fwd : std_logic; |
-- signal ex_b_wb_fwd : std_logic; |
-- signal ex_c_wb_fwd : std_logic; |
|
begin |
|
-- System Enable-FF ------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
SYSTEM_ENABLE: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
START_FF <= '0'; |
SLEEP_FLAG <= '0'; |
elsif (CE_I = '1') then |
START_FF <= '1'; -- pretty amazing, huh? ;) |
if (OP_DEC_CTRL_I(ctrl_sleep_c) = '1') then |
SLEEP_FLAG <= '1'; -- go to sleep |
elsif (WAKE_UP_I = '1') then |
SLEEP_FLAG <= '0'; -- wake up |
end if; |
end if; |
end if; |
end process SYSTEM_ENABLE; |
-- System Enable-FF ------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
system_enable: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
start_ff <= '0'; |
sleep_flag <= '0'; |
elsif (ce_i = '1') then |
start_ff <= '1'; -- pretty amazing, huh? ;) |
if (op_dec_ctrl_i(ctrl_sleep_c) = '1') then |
sleep_flag <= '1'; -- go to sleep |
elsif (wake_up_i = '1') then |
sleep_flag <= '0'; -- wake up |
end if; |
end if; |
end if; |
end process system_enable; |
|
-- Enable control -- |
SYS_ENABLE <= (not SLEEP_FLAG) and START_FF; |
-- enable control -- |
sys_enable <= (not sleep_flag) and start_ff; |
|
|
|
-- Stage 0: Pipeline Flow Arbiter ---------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
FLOW_ARBITER: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
MULTI_CYC_FF <= '0'; |
DIS_CYCLE_FF <= '0'; |
elsif (CE_I = '1') then |
MULTI_CYC_FF <= MULTI_CYC_REQ_I; |
if (VALID_BRANCH_I = '1') then |
DIS_CYCLE_FF <= '1'; -- one additional cycle for branches and system / ext interrupts |
elsif (DIS_CYCLE_FF = '1') and (MULTI_CYC_REQ_I = '0') then -- hold when multi-cycle op required |
DIS_CYCLE_FF <= '0'; |
end if; |
end if; |
end if; |
end process FLOW_ARBITER; |
-- Stage 0: Pipeline Flow Arbiter ---------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
flow_arbiter: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
multi_cyc_ff <= '0'; |
dis_cycle_ff <= '0'; |
elsif (ce_i = '1') then |
multi_cyc_ff <= multi_cyc_req_i; |
if (valid_branch_i = '1') then |
dis_cycle_ff <= '1'; -- one additional cycle for branches and system / ext interrupts |
elsif (dis_cycle_ff = '1') and (multi_cyc_req_i = '0') then -- hold when multi-cycle op required |
dis_cycle_ff <= '0'; |
end if; |
end if; |
end if; |
end process flow_arbiter; |
|
-- Multi cycle outut -- |
MULTI_CYC_O <= MULTI_CYC_FF; |
-- multi cycle outut -- |
multi_cyc_o <= multi_cyc_ff; |
|
|
-- Instruction Register -- |
-------------------------- |
I_REG: process(CLK_I, INSTR_I) |
begin |
--if rising_edge(CLK_I) then |
-- if (RST_I = '1') then |
-- INSTR_REG_O <= (others => '0'); |
-- elsif (CE_I = '1') and (((not DIS_IF) and (not MEM_DEPENDECY)) = '1') then |
INSTR_REG_O <= INSTR_I; |
-- end if; |
--end if; |
end process I_REG; |
-- temporal data dependency detector for memory-load operations -- |
--------------------------------------------------------------------- |
t_ddd: process(op_dec_ctrl_i, ex_ctrl_ff) |
variable a_match_v, b_match_v : std_logic; |
begin |
-- operand a dependency? -- |
a_match_v := '0'; |
if ((op_dec_ctrl_i(ctrl_ra_3_c downto ctrl_ra_0_c) = ex_ctrl_ff(ctrl_rd_3_c downto ctrl_rd_0_c)) and (op_dec_ctrl_i(ctrl_ra_is_pc_c) = '0')) then |
a_match_v := '1'; |
end if; |
|
-- operand b dependency? -- |
b_match_v := '0'; |
if ((op_dec_ctrl_i(ctrl_rb_3_c downto ctrl_rb_0_c) = ex_ctrl_ff(ctrl_rd_3_c downto ctrl_rd_0_c)) and (op_dec_ctrl_i(ctrl_rb_is_imm_c) = '0')) then |
b_match_v := '1'; |
end if; |
|
-- Temporal Data Dependency Detector for Memory-Load Operations -- |
--------------------------------------------------------------------- |
T_DDD: process(OP_DEC_CTRL_I, EX_CTRL_FF) |
variable a_match_v, b_match_v : std_logic; |
begin |
-- Operand A dependency? -- |
a_match_v := '0'; |
if ((OP_DEC_CTRL_I(ctrl_ra_3_c downto ctrl_ra_0_c) = EX_CTRL_FF(ctrl_rd_3_c downto ctrl_rd_0_c)) and (OP_DEC_CTRL_I(ctrl_ra_is_pc_c) = '0')) then |
a_match_v := '1'; |
end if; |
-- memory load dependency? -- |
mem_dependecy <= ex_ctrl_ff(ctrl_en_c) and ex_ctrl_ff(ctrl_rd_wb_c) and ex_ctrl_ff(ctrl_mem_acc_c) and (not ex_ctrl_ff(ctrl_mem_wr_c)) and (a_match_v or b_match_v); |
end process t_ddd; |
|
-- Operand B dependency? -- |
b_match_v := '0'; |
if ((OP_DEC_CTRL_I(ctrl_rb_3_c downto ctrl_rb_0_c) = EX_CTRL_FF(ctrl_rd_3_c downto ctrl_rd_0_c)) and (OP_DEC_CTRL_I(ctrl_rb_is_imm_c) = '0')) then |
b_match_v := '1'; |
end if; |
|
-- Memory load dependency? -- |
MEM_DEPENDECY <= EX_CTRL_FF(ctrl_en_c) and EX_CTRL_FF(ctrl_rd_wb_c) and EX_CTRL_FF(ctrl_mem_acc_c) and (not EX_CTRL_FF(ctrl_mem_wr_c)) and (a_match_v or b_match_v); |
end process T_DDD; |
-- disable control -- |
-- branch / exception: disable next 2 cycles |
-- mem-load dependency: insert 1 dummy cycle |
branch_slots: -- highly experimental!!! |
if (branch_slots_en_c = true) generate |
dis_cycle <= '1' when (mem_dependecy = '1') or (sys_enable = '0') else '0'; |
end generate branch_slots; |
no_branch_slots: |
if (branch_slots_en_c = false) generate |
dis_cycle <= '1' when (dis_cycle_ff = '1') or (valid_branch_i = '1') or (mem_dependecy = '1') or (sys_enable = '0') else '0'; |
end generate no_branch_slots; |
dis_if <= multi_cyc_req_i or sleep_flag; |
stop_pc_o <= dis_if or mem_dependecy; |
|
|
-- Disable Control -- |
-- Branch / Exception: Disable next 2 cycles |
-- Mem-load dependency: Insert 1 dummy cycle |
branch_slots: -- highly experimental!!! |
if (branch_slots_en_c = true) generate |
DIS_CYCLE <= '1' when (MEM_DEPENDECY = '1') or (SYS_ENABLE = '0') else '0'; |
end generate branch_slots; |
no_branch_slots: |
if (branch_slots_en_c = false) generate |
DIS_CYCLE <= '1' when (DIS_CYCLE_FF = '1') or (VALID_BRANCH_I = '1') or (MEM_DEPENDECY = '1') or (SYS_ENABLE = '0') else '0'; |
end generate no_branch_slots; |
DIS_IF <= MULTI_CYC_REQ_I or SLEEP_FLAG; |
STOP_PC_O <= DIS_IF or MEM_DEPENDECY; |
IR_UPDATE_EN_O <= (not DIS_IF) and (not MEM_DEPENDECY); |
-- instruction backup register -- |
--------------------------------- |
i_reg: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
ir_backup_ctrl <= '0'; |
ir_backup_reg <= (others => '0'); |
elsif (ce_i = '1') then |
ir_backup_ctrl <= dis_if or mem_dependecy; -- = stop_pc_o |
if (ir_backup_ctrl = '0') then |
ir_backup_reg <= instr_i; |
end if; |
end if; |
end if; |
end process i_reg; |
|
-- instruction selection -- |
instr_reg_o <= instr_i when (ir_backup_ctrl = '0') else ir_backup_reg; |
|
|
-- Stage 1: Operand Fetch ------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
OF_CTRL_BUS_O <= OP_DEC_CTRL_I; |
|
-- stage 1: operand fetch ------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
of_ctrl_bus_o <= op_dec_ctrl_i; |
|
-- -- Local Data Dependency Detector for EX Stage (pre-processed in OF-Stage) -- |
-- EX_A_MA_FWD <= '1' when ((OP_DEC_CTRL_I(ctrl_ra_3_c downto ctrl_ra_0_c) = EX_CTRL_BUF(ctrl_rd_3_c downto ctrl_rd_0_c)) and (OP_DEC_CTRL_I(ctrl_ra_is_pc_c) = '0')) else '0'; |
-- EX_A_WB_FWD <= '1' when ((OP_DEC_CTRL_I(ctrl_ra_3_c downto ctrl_ra_0_c) = MA_CTRL_FF(ctrl_rd_3_c downto ctrl_rd_0_c)) and (OP_DEC_CTRL_I(ctrl_ra_is_pc_c) = '0')) else '0'; |
-- EX_B_MA_FWD <= '1' when ((OP_DEC_CTRL_I(ctrl_rb_3_c downto ctrl_rb_0_c) = EX_CTRL_BUF(ctrl_rd_3_c downto ctrl_rd_0_c)) and (OP_DEC_CTRL_I(ctrl_rb_is_imm_c) = '0')) else '0'; |
-- EX_B_WB_FWD <= '1' when ((OP_DEC_CTRL_I(ctrl_rb_3_c downto ctrl_rb_0_c) = MA_CTRL_FF(ctrl_rd_3_c downto ctrl_rd_0_c)) and (OP_DEC_CTRL_I(ctrl_rb_is_imm_c) = '0')) else '0'; |
-- EX_C_WB_FWD <= '1' when ((OP_DEC_CTRL_I(ctrl_rb_3_c downto ctrl_rb_0_c) = MA_CTRL_FF(ctrl_rd_3_c downto ctrl_rd_0_c))) else '0'; |
|
-- -- local data dependency detector for ex stage (pre-processed in of-stage) -- |
-- ex_a_ma_fwd <= '1' when ((op_dec_ctrl_i(ctrl_ra_3_c downto ctrl_ra_0_c) = ex_ctrl_buf(ctrl_rd_3_c downto ctrl_rd_0_c)) and (op_dec_ctrl_i(ctrl_ra_is_pc_c) = '0')) else '0'; |
-- ex_a_wb_fwd <= '1' when ((op_dec_ctrl_i(ctrl_ra_3_c downto ctrl_ra_0_c) = ma_ctrl_ff(ctrl_rd_3_c downto ctrl_rd_0_c)) and (op_dec_ctrl_i(ctrl_ra_is_pc_c) = '0')) else '0'; |
-- ex_b_ma_fwd <= '1' when ((op_dec_ctrl_i(ctrl_rb_3_c downto ctrl_rb_0_c) = ex_ctrl_buf(ctrl_rd_3_c downto ctrl_rd_0_c)) and (op_dec_ctrl_i(ctrl_rb_is_imm_c) = '0')) else '0'; |
-- ex_b_wb_fwd <= '1' when ((op_dec_ctrl_i(ctrl_rb_3_c downto ctrl_rb_0_c) = ma_ctrl_ff(ctrl_rd_3_c downto ctrl_rd_0_c)) and (op_dec_ctrl_i(ctrl_rb_is_imm_c) = '0')) else '0'; |
-- ex_c_wb_fwd <= '1' when ((op_dec_ctrl_i(ctrl_rb_3_c downto ctrl_rb_0_c) = ma_ctrl_ff(ctrl_rd_3_c downto ctrl_rd_0_c))) else '0'; |
|
|
-- Stage 2: Execution ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
EX_STAGE: process (CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
EX_CTRL_FF <= (others => '0'); |
elsif (CE_I = '1') then |
EX_CTRL_FF <= OP_DEC_CTRL_I; |
EX_CTRL_FF(ctrl_en_c) <= OP_DEC_CTRL_I(ctrl_en_c) and (not DIS_CYCLE); |
EX_CTRL_FF(ctrl_mcyc_c) <= MULTI_CYC_FF; -- un-interruptable multi-cycle operation? |
-- EX_CTRL_FF(ctrl_a_ex_ma_fw_c) <= EX_A_MA_FWD; |
-- EX_CTRL_FF(ctrl_a_ex_wb_fw_c) <= EX_A_WB_FWD; |
-- EX_CTRL_FF(ctrl_b_ex_ma_fw_c) <= EX_B_MA_FWD; |
-- EX_CTRL_FF(ctrl_b_ex_wb_fw_c) <= EX_B_WB_FWD; |
-- EX_CTRL_FF(ctrl_c_ex_wb_fw_c) <= EX_C_WB_FWD; |
end if; |
end if; |
end process EX_STAGE; |
|
-- Stage 2: Execution ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
ex_stage: process (clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
ex_ctrl_ff <= (others => '0'); |
elsif (ce_i = '1') then |
ex_ctrl_ff <= op_dec_ctrl_i; |
ex_ctrl_ff(ctrl_en_c) <= op_dec_ctrl_i(ctrl_en_c) and (not dis_cycle); |
ex_ctrl_ff(ctrl_mcyc_c) <= multi_cyc_ff; -- un-interruptable multi-cycle operation? |
-- ex_ctrl_ff(ctrl_a_ex_ma_fw_c) <= ex_a_ma_fwd; |
-- ex_ctrl_ff(ctrl_a_ex_wb_fw_c) <= ex_a_wb_fwd; |
-- ex_ctrl_ff(ctrl_b_ex_ma_fw_c) <= ex_b_ma_fwd; |
-- ex_ctrl_ff(ctrl_b_ex_wb_fw_c) <= ex_b_wb_fwd; |
-- ex_ctrl_ff(ctrl_c_ex_wb_fw_c) <= ex_c_wb_fwd; |
end if; |
end if; |
end process ex_stage; |
|
-- Exception insertion system -- |
EXC_INSERTION: process (EX_CTRL_FF, EXC_TAKEN_I) |
begin |
EX_CTRL_BUF <= EX_CTRL_FF; |
if (EXC_TAKEN_I = '1') then -- is exception? - insert link register and invalidate current operation |
EX_CTRL_BUF(ctrl_rd_3_c downto ctrl_rd_0_c) <= system_mode_c & link_reg_adr_c; -- save to sys link reg |
EX_CTRL_BUF(ctrl_en_c) <= '0'; -- disable it all |
EX_CTRL_BUF(ctrl_link_c) <= '1'; -- link return address |
end if; |
end process EXC_INSERTION; |
|
-- Output -- |
EX_CTRL_BUS_O <= EX_CTRL_BUF; |
EXC_POS_O <= EX_CTRL_FF(ctrl_en_c) and (not EX_CTRL_FF(ctrl_mcyc_c)); -- exception would be possible and no in-interuptable OP |
-- exception insertion system -- |
exc_insertion: process (ex_ctrl_ff, exc_taken_i) |
begin |
ex_ctrl_buf <= ex_ctrl_ff; |
if (exc_taken_i = '1') then -- is exception? - insert link register and invalidate current operation |
ex_ctrl_buf(ctrl_rd_3_c downto ctrl_rd_0_c) <= system_mode_c & link_reg_adr_c; -- save to sys link reg |
ex_ctrl_buf(ctrl_en_c) <= '0'; -- disable it all |
ex_ctrl_buf(ctrl_link_c) <= '1'; -- link return address |
end if; |
end process exc_insertion; |
|
-- output -- |
ex_ctrl_bus_o <= ex_ctrl_buf; |
exc_pos_o <= ex_ctrl_ff(ctrl_en_c) and (not ex_ctrl_ff(ctrl_mcyc_c)); -- exception would be possible and no in-interuptable op |
|
|
-- Stage 3: Memory Access ------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
MA_STAGE: process (CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
MA_CTRL_FF <= (others => '0'); |
elsif (CE_I = '1') then |
MA_CTRL_FF <= EX_CTRL_BUF; |
-- some pre-processing to shorten critical path -- |
if (VALID_BRANCH_I = '0') and (EX_CTRL_BUF(ctrl_branch_c) = '1') then -- unfullfilled branch |
MA_CTRL_FF(ctrl_wb_en_c) <= EXC_TAKEN_I; -- IRQs may process anyway |
else -- valid reg data write-back and true condition for cond- write back or Exception taken |
MA_CTRL_FF(ctrl_wb_en_c) <= (EX_CTRL_BUF(ctrl_en_c) and EX_CTRL_BUF(ctrl_rd_wb_c) and (EX_CTRL_BUF(ctrl_cond_wb_c) nand (not COND_TRUE_I))) or EXC_TAKEN_I; |
end if; |
MA_CTRL_FF(ctrl_rd_cp_acc_c) <= EX_CTRL_BUF(ctrl_cp_acc_c) and (not EX_CTRL_BUF(ctrl_cp_wr_c)); -- cp read-back |
MA_CTRL_FF(ctrl_cp_msr_rd_c) <= (EX_CTRL_BUF(ctrl_cp_acc_c) and (not EX_CTRL_BUF(ctrl_cp_wr_c))) or (EX_CTRL_BUF(ctrl_msr_rd_c)); -- cp or msr read access |
end if; |
end if; |
end process MA_STAGE; |
|
-- Output -- |
MA_CTRL_BUS_O <= MA_CTRL_FF; |
-- Stage 3: Memory Access ------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
ma_stage: process (clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
ma_ctrl_ff <= (others => '0'); |
elsif (ce_i = '1') then |
ma_ctrl_ff <= ex_ctrl_buf; |
-- some pre-processing to shorten critical path -- |
if (valid_branch_i = '0') and (ex_ctrl_buf(ctrl_branch_c) = '1') then -- unfullfilled branch |
ma_ctrl_ff(ctrl_wb_en_c) <= exc_taken_i; -- irqs may process anyway |
else -- valid reg data write-back and true condition for cond- write back or exception taken |
ma_ctrl_ff(ctrl_wb_en_c) <= (ex_ctrl_buf(ctrl_en_c) and ex_ctrl_buf(ctrl_rd_wb_c) and (ex_ctrl_buf(ctrl_cond_wb_c) nand (not cond_true_i))) or exc_taken_i; |
end if; |
ma_ctrl_ff(ctrl_rd_cp_acc_c) <= ex_ctrl_buf(ctrl_cp_acc_c) and (not ex_ctrl_buf(ctrl_cp_wr_c)); -- cp read-back |
ma_ctrl_ff(ctrl_cp_msr_rd_c) <= (ex_ctrl_buf(ctrl_cp_acc_c) and (not ex_ctrl_buf(ctrl_cp_wr_c))) or (ex_ctrl_buf(ctrl_msr_rd_c)); -- cp or msr read access |
end if; |
end if; |
end process ma_stage; |
|
-- output -- |
ma_ctrl_bus_o <= ma_ctrl_ff; |
|
|
-- Stage 4: Write Back --------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
WB_STAGE: process (CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
WB_CTRL_FF <= (others => '0'); |
elsif (CE_I = '1') then |
WB_CTRL_FF <= MA_CTRL_FF; |
-- some pre-processing to shorten critical path -- |
WB_CTRL_FF(ctrl_rd_mem_acc_c) <= MA_CTRL_FF(ctrl_mem_acc_c) and (not MA_CTRL_FF(ctrl_mem_wr_c)); -- valid memory read-back |
end if; |
end if; |
end process WB_STAGE; |
|
-- Output -- |
WB_CTRL_BUS_O <= WB_CTRL_FF; |
-- Stage 4: Write Back --------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
wb_stage: process (clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
wb_ctrl_ff <= (others => '0'); |
elsif (ce_i = '1') then |
wb_ctrl_ff <= ma_ctrl_ff; |
-- some pre-processing to shorten critical path -- |
wb_ctrl_ff(ctrl_rd_mem_acc_c) <= ma_ctrl_ff(ctrl_mem_acc_c) and (not ma_ctrl_ff(ctrl_mem_wr_c)); -- valid memory read-back |
end if; |
end if; |
end process wb_stage; |
|
-- output -- |
wb_ctrl_bus_o <= wb_ctrl_ff; |
|
|
|
end CTRL_STRUCTURE; |
|
end ctrl_structure; |
/atlas_core/trunk/rtl/ATLAS_pkg.vhd
4,7 → 4,7
-- # All architecture configurations, options, signal # |
-- # definitions and components are listed here. # |
-- # **************************************************** # |
-- # Last modified: 08.05.2014 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
17,176 → 17,176
|
-- Architecture Configuration for Application --------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
constant big_endian_c : boolean := true; -- use little/big endian memory system |
constant build_mul_c : boolean := true; -- build a dedicated MUL unit |
constant build_mul32_c : boolean := true; -- build 32-bit multiplier |
constant word_mode_en_c : boolean := false; -- use word-addressed memory system instead of byte-addressed |
constant signed_mul_c : boolean := true; -- synthesize signed or unsigned multiplier core |
constant wb_fifo_size_c : natural := 32; -- Wishbone fifo size in words (power of 2!) |
constant big_endian_c : boolean := true; -- use little/big endian memory system |
constant build_mul_c : boolean := true; -- build a dedicated MUL unit |
constant build_mul32_c : boolean := true; -- build 32-bit multiplier |
constant word_mode_en_c : boolean := false; -- use word-addressed memory system instead of byte-addressed |
constant signed_mul_c : boolean := true; -- synthesize signed or unsigned multiplier core |
constant wb_fifo_size_c : natural := 32; -- Wishbone fifo size in words (power of 2!) |
|
---- DO NOT CHANGE ANYTHING BELOW UNLESS YOU REALLY KNOW WHAT YOU ARE DOING! ---- |
---- DO NOT CHANGE ANYTHING BELOW UNLESS YOU REALLY KNOW WHAT YOU ARE DOING! ---- |
|
-- Architecture Constants ----------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
constant data_width_c : natural := 16; -- processing data width |
constant data_bytes_c : natural := data_width_c/8; -- processing data width in bytes |
constant align_lsb_c : natural := data_bytes_c/2; -- lsb of adr word boundary |
constant link_reg_adr_c : std_logic_vector(02 downto 0) := "111"; -- link reg for calls |
constant stack_pnt_adr_c : std_logic_vector(02 downto 0) := "110"; -- stack pointer |
constant boot_page_c : std_logic_vector(15 downto 0) := x"8000"; -- boot pages begin |
constant boot_adr_c : std_logic_vector(15 downto 0) := x"0000"; -- boot address |
constant start_page_c : std_logic_vector(15 downto 0) := boot_page_c; -- start page |
constant start_adr_c : std_logic_vector(15 downto 0) := boot_adr_c; -- start address |
constant user_mode_c : std_logic := '0'; -- user mode indicator |
constant system_mode_c : std_logic := '1'; -- system mode indicator |
constant branch_slots_en_c : boolean := false; -- use branch delay slots (highly experimental!!!) |
constant ldil_sign_ext_c : boolean := true; -- use sign extension when loading low byte |
constant reg_branches_en_c : boolean := true; -- synthesize register-based branches |
constant cond_moves_en_c : boolean := true; -- synthesize conditional moves |
constant data_width_c : natural := 16; -- processing data width |
constant data_bytes_c : natural := data_width_c/8; -- processing data width in bytes |
constant align_lsb_c : natural := data_bytes_c/2; -- lsb of adr word boundary |
constant link_reg_adr_c : std_logic_vector(02 downto 0) := "111"; -- link reg for calls |
constant stack_pnt_adr_c : std_logic_vector(02 downto 0) := "110"; -- stack pointer |
constant boot_page_c : std_logic_vector(15 downto 0) := x"8000"; -- boot pages begin |
constant boot_adr_c : std_logic_vector(15 downto 0) := x"0000"; -- boot address |
constant start_page_c : std_logic_vector(15 downto 0) := boot_page_c; -- start page |
constant start_adr_c : std_logic_vector(15 downto 0) := boot_adr_c; -- start address |
constant user_mode_c : std_logic := '0'; -- user mode indicator |
constant system_mode_c : std_logic := '1'; -- system mode indicator |
constant branch_slots_en_c : boolean := false; -- use branch delay slots (highly experimental!!!) |
constant ldil_sign_ext_c : boolean := true; -- use sign extension when loading low byte |
constant reg_branches_en_c : boolean := true; -- synthesize register-based branches |
constant cond_moves_en_c : boolean := true; -- synthesize conditional moves |
|
|
-- Interrupt/Exception Vectors (word-address) --------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
constant res_int_vec_c : std_logic_vector(15 downto 0) := x"0000"; -- use boot address instead! |
constant irq0_int_vec_c : std_logic_vector(15 downto 0) := x"0001"; -- external int line 0 IRQ |
constant irq1_int_vec_c : std_logic_vector(15 downto 0) := x"0002"; -- external int line 1 IRQ |
constant cmd_err_int_vec_c : std_logic_vector(15 downto 0) := x"0003"; -- instruction/access error |
constant swi_int_vec_c : std_logic_vector(15 downto 0) := x"0004"; -- software IRQ |
constant res_int_vec_c : std_logic_vector(15 downto 0) := x"0000"; -- use boot address instead! |
constant irq0_int_vec_c : std_logic_vector(15 downto 0) := x"0001"; -- external int line 0 IRQ |
constant irq1_int_vec_c : std_logic_vector(15 downto 0) := x"0002"; -- external int line 1 IRQ |
constant cmd_err_int_vec_c : std_logic_vector(15 downto 0) := x"0003"; -- instruction/access error |
constant swi_int_vec_c : std_logic_vector(15 downto 0) := x"0004"; -- software IRQ |
|
|
-- Wishbone Bus Constants ----------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
constant wb_classic_cyc_c : std_logic_vector(2 downto 0) := "000"; -- classic cycle |
constant wb_con_bst_cyc_c : std_logic_vector(2 downto 0) := "001"; -- constant address burst |
constant wb_inc_bst_cyc_c : std_logic_vector(2 downto 0) := "010"; -- incrementing address burst |
constant wb_end_bst_cyc_c : std_logic_vector(2 downto 0) := "111"; -- burst end |
constant wb_classic_cyc_c : std_logic_vector(2 downto 0) := "000"; -- classic cycle |
constant wb_con_bst_cyc_c : std_logic_vector(2 downto 0) := "001"; -- constant address burst |
constant wb_inc_bst_cyc_c : std_logic_vector(2 downto 0) := "010"; -- incrementing address burst |
constant wb_end_bst_cyc_c : std_logic_vector(2 downto 0) := "111"; -- burst end |
|
|
-- Machine Status Register ---------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
constant msr_usr_z_flag_c : natural := 0; -- user mode zero flag |
constant msr_usr_c_flag_c : natural := 1; -- user mode carry flag |
constant msr_usr_o_flag_c : natural := 2; -- user mode overflow flag |
constant msr_usr_n_flag_c : natural := 3; -- user mode negative flag |
constant msr_usr_t_flag_c : natural := 4; -- user mode transfer flag |
constant msr_sys_z_flag_c : natural := 5; -- system mode zero flag |
constant msr_sys_c_flag_c : natural := 6; -- system mode carry flag |
constant msr_sys_o_flag_c : natural := 7; -- system mode overflow flag |
constant msr_sys_n_flag_c : natural := 8; -- system mode negative flag |
constant msr_sys_t_flag_c : natural := 9; -- system mode transfer flag |
constant msr_usr_cp_ptc_c : natural := 10; -- user coprocessor protection |
constant msr_xint_en_c : natural := 11; -- enable external interrupts (global) |
constant msr_xint0_en_c : natural := 12; -- enable external interrupt 0 |
constant msr_xint1_en_c : natural := 13; -- enable external interrupt 1 |
constant msr_svd_mode_c : natural := 14; -- saved operating mode |
constant msr_mode_flag_c : natural := 15; -- system ('1') / user ('0') mode |
constant msr_usr_z_flag_c : natural := 0; -- user mode zero flag |
constant msr_usr_c_flag_c : natural := 1; -- user mode carry flag |
constant msr_usr_o_flag_c : natural := 2; -- user mode overflow flag |
constant msr_usr_n_flag_c : natural := 3; -- user mode negative flag |
constant msr_usr_t_flag_c : natural := 4; -- user mode transfer flag |
constant msr_sys_z_flag_c : natural := 5; -- system mode zero flag |
constant msr_sys_c_flag_c : natural := 6; -- system mode carry flag |
constant msr_sys_o_flag_c : natural := 7; -- system mode overflow flag |
constant msr_sys_n_flag_c : natural := 8; -- system mode negative flag |
constant msr_sys_t_flag_c : natural := 9; -- system mode transfer flag |
constant msr_usr_cp_ptc_c : natural := 10; -- user coprocessor protection |
constant msr_xint_en_c : natural := 11; -- enable external interrupts (global) |
constant msr_xint0_en_c : natural := 12; -- enable external interrupt 0 |
constant msr_xint1_en_c : natural := 13; -- enable external interrupt 1 |
constant msr_svd_mode_c : natural := 14; -- saved operating mode |
constant msr_mode_flag_c : natural := 15; -- system ('1') / user ('0') mode |
|
|
-- Forwarding Bus ------------------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
constant fwd_en_c : natural := 0; -- valid register signal |
constant fwd_adr_0_c : natural := 1; -- address bit 0 |
constant fwd_adr_1_c : natural := 2; -- address bit 1 |
constant fwd_adr_2_c : natural := 3; -- address bit 2 |
constant fwd_adr_3_c : natural := 4; -- address bit 3 (bank select) |
constant fwd_dat_lsb_c : natural := 5; -- forwarding data lsb |
constant fwd_dat_msb_c : natural := 5+data_width_c-1; -- forwarding data msb |
constant fwd_width_c : natural := 5+data_width_c; -- size of forwarding bus |
constant fwd_en_c : natural := 0; -- valid register signal |
constant fwd_adr_0_c : natural := 1; -- address bit 0 |
constant fwd_adr_1_c : natural := 2; -- address bit 1 |
constant fwd_adr_2_c : natural := 3; -- address bit 2 |
constant fwd_adr_3_c : natural := 4; -- address bit 3 (bank select) |
constant fwd_dat_lsb_c : natural := 5; -- forwarding data lsb |
constant fwd_dat_msb_c : natural := 5+data_width_c-1; -- forwarding data msb |
constant fwd_width_c : natural := 5+data_width_c; -- size of forwarding bus |
|
|
-- Flag Bus ------------------------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
constant flag_z_c : natural := 0; -- user mode zero flag |
constant flag_c_c : natural := 1; -- user mode carry flag |
constant flag_o_c : natural := 2; -- user mode overflow flag |
constant flag_n_c : natural := 3; -- user mode negative flag |
constant flag_t_c : natural := 4; -- user mode transfer flag |
constant flag_bus_width_c : natural := 5; -- size of flag bus |
constant flag_z_c : natural := 0; -- user mode zero flag |
constant flag_c_c : natural := 1; -- user mode carry flag |
constant flag_o_c : natural := 2; -- user mode overflow flag |
constant flag_n_c : natural := 3; -- user mode negative flag |
constant flag_t_c : natural := 4; -- user mode transfer flag |
constant flag_bus_width_c : natural := 5; -- size of flag bus |
|
|
-- Main Control Bus ----------------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
-- Global Control -- |
constant ctrl_en_c : natural := 0; -- valid cycle |
constant ctrl_mcyc_c : natural := 1; -- un-interruptable/atomic operation |
-- Global Control -- |
constant ctrl_en_c : natural := 0; -- valid cycle |
constant ctrl_mcyc_c : natural := 1; -- un-interruptable/atomic operation |
|
-- Operand A Register -- |
constant ctrl_ra_is_pc_c : natural := 2; -- operand register A is the PC |
constant ctrl_clr_ha_c : natural := 3; -- set higher half word of A to 0 (@ 16 bit) |
constant ctrl_clr_la_c : natural := 4; -- set lower half word of A to 0 (@ 16 bit) |
constant ctrl_ra_0_c : natural := 5; -- operand register A adr bit 0 |
constant ctrl_ra_1_c : natural := 6; -- operand register A adr bit 1 |
constant ctrl_ra_2_c : natural := 7; -- operand register A adr bit 2 |
constant ctrl_ra_3_c : natural := 8; -- operand register A adr bit 3 (bank select) |
-- Operand A Register -- |
constant ctrl_ra_is_pc_c : natural := 2; -- operand register A is the PC |
constant ctrl_clr_ha_c : natural := 3; -- set higher half word of A to 0 (@ 16 bit) |
constant ctrl_clr_la_c : natural := 4; -- set lower half word of A to 0 (@ 16 bit) |
constant ctrl_ra_0_c : natural := 5; -- operand register A adr bit 0 |
constant ctrl_ra_1_c : natural := 6; -- operand register A adr bit 1 |
constant ctrl_ra_2_c : natural := 7; -- operand register A adr bit 2 |
constant ctrl_ra_3_c : natural := 8; -- operand register A adr bit 3 (bank select) |
|
-- Operand B Register -- |
constant ctrl_rb_is_imm_c : natural := 9; -- operand register B is an immediate |
constant ctrl_rb_0_c : natural := 10; -- operand register B adr bit 0 |
constant ctrl_rb_1_c : natural := 11; -- operand register B adr bit 1 |
constant ctrl_rb_2_c : natural := 12; -- operand register B adr bit 2 |
constant ctrl_rb_3_c : natural := 13; -- operand register B adr bit 3 (bank select) |
-- Operand B Register -- |
constant ctrl_rb_is_imm_c : natural := 9; -- operand register B is an immediate |
constant ctrl_rb_0_c : natural := 10; -- operand register B adr bit 0 |
constant ctrl_rb_1_c : natural := 11; -- operand register B adr bit 1 |
constant ctrl_rb_2_c : natural := 12; -- operand register B adr bit 2 |
constant ctrl_rb_3_c : natural := 13; -- operand register B adr bit 3 (bank select) |
|
-- Destiantion Register -- |
constant ctrl_rd_wb_c : natural := 14; -- register write back request |
constant ctrl_rd_0_c : natural := 15; -- register destination adr bit 0 |
constant ctrl_rd_1_c : natural := 16; -- register destination adr bit 1 |
constant ctrl_rd_2_c : natural := 17; -- register destination adr bit 2 |
constant ctrl_rd_3_c : natural := 18; -- register destination adr bit 3 (bank select) |
-- Destiantion Register -- |
constant ctrl_rd_wb_c : natural := 14; -- register write back request |
constant ctrl_rd_0_c : natural := 15; -- register destination adr bit 0 |
constant ctrl_rd_1_c : natural := 16; -- register destination adr bit 1 |
constant ctrl_rd_2_c : natural := 17; -- register destination adr bit 2 |
constant ctrl_rd_3_c : natural := 18; -- register destination adr bit 3 (bank select) |
|
-- ALU Control -- |
constant ctrl_alu_fs_0_c : natural := 19; -- alu function set bit 0 |
constant ctrl_alu_fs_1_c : natural := 20; -- alu function set bit 1 |
constant ctrl_alu_fs_2_c : natural := 21; -- alu function set bit 2 |
constant ctrl_alu_usec_c : natural := 22; -- alu use MSR(carry_flag) |
constant ctrl_alu_usez_c : natural := 23; -- alu use MSR(zero_flag) |
constant ctrl_fupdate_c : natural := 24; -- msr flag update enable |
constant ctrl_alu_cf_opt_c : natural := 25; -- option for carry in (normal/invert) |
constant ctrl_alu_zf_opt_c : natural := 26; -- option for zero in (AND/OR) |
-- ALU Control -- |
constant ctrl_alu_fs_0_c : natural := 19; -- alu function set bit 0 |
constant ctrl_alu_fs_1_c : natural := 20; -- alu function set bit 1 |
constant ctrl_alu_fs_2_c : natural := 21; -- alu function set bit 2 |
constant ctrl_alu_usec_c : natural := 22; -- alu use MSR(carry_flag) |
constant ctrl_alu_usez_c : natural := 23; -- alu use MSR(zero_flag) |
constant ctrl_fupdate_c : natural := 24; -- msr flag update enable |
constant ctrl_alu_cf_opt_c : natural := 25; -- option for carry in (normal/invert) |
constant ctrl_alu_zf_opt_c : natural := 26; -- option for zero in (AND/OR) |
|
-- Bit Manipulation -- |
constant ctrl_tf_store_c : natural := 27; -- store bit to t-flag |
constant ctrl_tf_inv_c : natural := 28; -- invert bit to be store in t-flag |
constant ctrl_get_par_c : natural := 29; -- get parity bit |
-- Bit Manipulation -- |
constant ctrl_tf_store_c : natural := 27; -- store bit to t-flag |
constant ctrl_tf_inv_c : natural := 28; -- invert bit to be store in t-flag |
constant ctrl_get_par_c : natural := 29; -- get parity bit |
|
-- Coprocessor Access -- |
constant ctrl_cp_acc_c : natural := 30; -- coprocessor operation |
constant ctrl_cp_trans_c : natural := 31; -- coprocessor data transfer |
constant ctrl_cp_wr_c : natural := 32; -- write to coprocessor |
constant ctrl_cp_id_c : natural := 33; -- coprocessor id bit |
-- Coprocessor Access -- |
constant ctrl_cp_acc_c : natural := 30; -- coprocessor operation |
constant ctrl_cp_trans_c : natural := 31; -- coprocessor data transfer |
constant ctrl_cp_wr_c : natural := 32; -- write to coprocessor |
constant ctrl_cp_id_c : natural := 33; -- coprocessor id bit |
|
-- System Register Access -- |
constant ctrl_msr_wr_c : natural := 34; -- write to mcr |
constant ctrl_msr_rd_c : natural := 35; -- read from mcr |
constant ctrl_pc_wr_c : natural := 36; -- write pc |
-- System Register Access -- |
constant ctrl_msr_wr_c : natural := 34; -- write to mcr |
constant ctrl_msr_rd_c : natural := 35; -- read from mcr |
constant ctrl_pc_wr_c : natural := 36; -- write pc |
|
-- Branch/Context Control -- |
constant ctrl_cond_0_c : natural := 37; -- condition code bit 0 |
constant ctrl_cond_1_c : natural := 38; -- condition code bit 1 |
constant ctrl_cond_2_c : natural := 39; -- condition code bit 2 |
constant ctrl_cond_3_c : natural := 40; -- condition code bit 3 |
constant ctrl_branch_c : natural := 41; -- is branch operation |
constant ctrl_link_c : natural := 42; -- store old pc to lr |
constant ctrl_syscall_c : natural := 43; -- is a system call |
constant ctrl_cmd_err_c : natural := 44; -- invalid/unauthorized operation |
constant ctrl_ctx_down_c : natural := 45; -- go to user mode |
constant ctrl_restsm_c : natural := 46; -- restore saved mode |
-- Branch/Context Control -- |
constant ctrl_cond_0_c : natural := 37; -- condition code bit 0 |
constant ctrl_cond_1_c : natural := 38; -- condition code bit 1 |
constant ctrl_cond_2_c : natural := 39; -- condition code bit 2 |
constant ctrl_cond_3_c : natural := 40; -- condition code bit 3 |
constant ctrl_branch_c : natural := 41; -- is branch operation |
constant ctrl_link_c : natural := 42; -- store old pc to lr |
constant ctrl_syscall_c : natural := 43; -- is a system call |
constant ctrl_cmd_err_c : natural := 44; -- invalid/unauthorized operation |
constant ctrl_ctx_down_c : natural := 45; -- go to user mode |
constant ctrl_restsm_c : natural := 46; -- restore saved mode |
|
-- Memory Access -- |
constant ctrl_mem_acc_c : natural := 47; -- request d-mem access |
constant ctrl_mem_wr_c : natural := 48; -- write to d-mem |
constant ctrl_mem_bpba_c : natural := 49; -- use bypassed base address |
constant ctrl_mem_daa_c : natural := 50; -- use delayed address |
-- Memory Access -- |
constant ctrl_mem_acc_c : natural := 47; -- request d-mem access |
constant ctrl_mem_wr_c : natural := 48; -- write to d-mem |
constant ctrl_mem_bpba_c : natural := 49; -- use bypassed base address |
constant ctrl_mem_daa_c : natural := 50; -- use delayed address |
|
-- Multiply Unit -- |
constant ctrl_use_mul_c : natural := 51; -- use MUL unit |
constant ctrl_ext_mul_c : natural := 52; -- get high mul result |
constant ctrl_use_offs_c : natural := 53; -- use loaded offset |
-- Multiply Unit -- |
constant ctrl_use_mul_c : natural := 51; -- use MUL unit |
constant ctrl_ext_mul_c : natural := 52; -- get high mul result |
constant ctrl_use_offs_c : natural := 53; -- use loaded offset |
|
-- Sleep command -- |
constant ctrl_sleep_c : natural := 54; -- go to sleep |
-- Sleep command -- |
constant ctrl_sleep_c : natural := 54; -- go to sleep |
|
-- Conditional write back -- |
constant ctrl_cond_wb_c : natural := 55; -- is cond write back? |
-- Conditional write back -- |
constant ctrl_cond_wb_c : natural := 55; -- is cond write back? |
|
-- -- EX Forwarding -- |
-- constant ctrl_a_ex_ma_fw_c : natural := 56; -- obsolete |
195,613 → 195,613
-- constant ctrl_b_ex_wb_fw_c : natural := 59; -- obsolete |
-- constant ctrl_c_ex_wb_fw_c : natural := 60; -- obsolete |
|
-- Bus Size -- |
constant ctrl_width_c : natural := 56; -- control bus size |
-- Bus Size -- |
constant ctrl_width_c : natural := 56; -- control bus size |
-- constant ctrl_width_c : natural := 61; -- obsolete |
|
-- Progress Redefinitions -- |
constant ctrl_wb_en_c : natural := ctrl_rd_wb_c; -- valid write back |
constant ctrl_rd_mem_acc_c : natural := ctrl_mem_acc_c; -- true mem_read |
constant ctrl_rd_cp_acc_c : natural := ctrl_cp_acc_c; -- true cp_read |
constant ctrl_cp_msr_rd_c : natural := ctrl_msr_rd_c; -- true cp or msr read access |
constant ctrl_cp_cmd_0_c : natural := ctrl_rb_0_c; -- coprocessor cmd bit 0 |
constant ctrl_cp_cmd_1_c : natural := ctrl_rb_1_c; -- coprocessor cmd bit 1 |
constant ctrl_cp_cmd_2_c : natural := ctrl_rb_2_c; -- coprocessor cmd bit 2 |
constant ctrl_cp_ra_0_c : natural := ctrl_ra_0_c; -- coprocessor op A bit 0 |
constant ctrl_cp_ra_1_c : natural := ctrl_ra_1_c; -- coprocessor op A bit 1 |
constant ctrl_cp_ra_2_c : natural := ctrl_ra_2_c; -- coprocessor op A bit 2 |
constant ctrl_cp_rd_0_c : natural := ctrl_rd_0_c; -- coprocessor op B / dest bit 0 |
constant ctrl_cp_rd_1_c : natural := ctrl_rd_1_c; -- coprocessor op B / dest bit 1 |
constant ctrl_cp_rd_2_c : natural := ctrl_rd_2_c; -- coprocessor op B / dest bit 2 |
constant ctrl_re_xint_c : natural := ctrl_rb_1_c; -- re-enable ext interrupts (global) |
constant ctrl_msr_am_0_c : natural := ctrl_ra_1_c; -- MSR access mode bit 0 |
constant ctrl_msr_am_1_c : natural := ctrl_ra_2_c; -- MSR access mode bit 1 |
-- Progress Redefinitions -- |
constant ctrl_wb_en_c : natural := ctrl_rd_wb_c; -- valid write back |
constant ctrl_rd_mem_acc_c : natural := ctrl_mem_acc_c; -- true mem_read |
constant ctrl_rd_cp_acc_c : natural := ctrl_cp_acc_c; -- true cp_read |
constant ctrl_cp_msr_rd_c : natural := ctrl_msr_rd_c; -- true cp or msr read access |
constant ctrl_cp_cmd_0_c : natural := ctrl_rb_0_c; -- coprocessor cmd bit 0 |
constant ctrl_cp_cmd_1_c : natural := ctrl_rb_1_c; -- coprocessor cmd bit 1 |
constant ctrl_cp_cmd_2_c : natural := ctrl_rb_2_c; -- coprocessor cmd bit 2 |
constant ctrl_cp_ra_0_c : natural := ctrl_ra_0_c; -- coprocessor op A bit 0 |
constant ctrl_cp_ra_1_c : natural := ctrl_ra_1_c; -- coprocessor op A bit 1 |
constant ctrl_cp_ra_2_c : natural := ctrl_ra_2_c; -- coprocessor op A bit 2 |
constant ctrl_cp_rd_0_c : natural := ctrl_rd_0_c; -- coprocessor op B / dest bit 0 |
constant ctrl_cp_rd_1_c : natural := ctrl_rd_1_c; -- coprocessor op B / dest bit 1 |
constant ctrl_cp_rd_2_c : natural := ctrl_rd_2_c; -- coprocessor op B / dest bit 2 |
constant ctrl_re_xint_c : natural := ctrl_rb_1_c; -- re-enable ext interrupts (global) |
constant ctrl_msr_am_0_c : natural := ctrl_ra_1_c; -- MSR access mode bit 0 |
constant ctrl_msr_am_1_c : natural := ctrl_ra_2_c; -- MSR access mode bit 1 |
|
|
-- Coprocessor Control Bus ---------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
constant cp_cmd_lsb_c : natural := 0; -- command word lsb |
constant cp_cmd_msb_c : natural := 2; -- command word msb |
constant cp_op_b_lsb_c : natural := 3; -- operand B address lsb |
constant cp_op_b_msb_c : natural := 5; -- operand B address msb |
constant cp_op_a_lsb_c : natural := 6; -- operand A / destination address lsb |
constant cp_op_a_msb_c : natural := 8; -- operand A / destination address msb |
constant cp_cmd_width_c : natural := 9; -- bus size |
constant cp_cmd_lsb_c : natural := 0; -- command word lsb |
constant cp_cmd_msb_c : natural := 2; -- command word msb |
constant cp_op_b_lsb_c : natural := 3; -- operand B address lsb |
constant cp_op_b_msb_c : natural := 5; -- operand B address msb |
constant cp_op_a_lsb_c : natural := 6; -- operand A / destination address lsb |
constant cp_op_a_msb_c : natural := 8; -- operand A / destination address msb |
constant cp_cmd_width_c : natural := 9; -- bus size |
|
|
-- Condition Codes ------------------------------------------------------------------------ |
-- ------------------------------------------------------------------------------------------- |
constant cond_eq_c : std_logic_vector(3 downto 0) := "0000"; -- equal |
constant cond_ne_c : std_logic_vector(3 downto 0) := "0001"; -- not equal |
constant cond_cs_c : std_logic_vector(3 downto 0) := "0010"; -- unsigned higher or same |
constant cond_cc_c : std_logic_vector(3 downto 0) := "0011"; -- unsigned lower |
constant cond_mi_c : std_logic_vector(3 downto 0) := "0100"; -- negative |
constant cond_pl_c : std_logic_vector(3 downto 0) := "0101"; -- positive or zero |
constant cond_os_c : std_logic_vector(3 downto 0) := "0110"; -- overflow |
constant cond_oc_c : std_logic_vector(3 downto 0) := "0111"; -- no overflow |
constant cond_hi_c : std_logic_vector(3 downto 0) := "1000"; -- unsigned higher |
constant cond_ls_c : std_logic_vector(3 downto 0) := "1001"; -- unsigned lower or same |
constant cond_ge_c : std_logic_vector(3 downto 0) := "1010"; -- greater than or equal |
constant cond_lt_c : std_logic_vector(3 downto 0) := "1011"; -- less than |
constant cond_gt_c : std_logic_vector(3 downto 0) := "1100"; -- greater than |
constant cond_le_c : std_logic_vector(3 downto 0) := "1101"; -- less than or equal |
constant cond_ts_c : std_logic_vector(3 downto 0) := "1110"; -- transfer flag set |
constant cond_al_c : std_logic_vector(3 downto 0) := "1111"; -- always |
constant cond_eq_c : std_logic_vector(3 downto 0) := "0000"; -- equal |
constant cond_ne_c : std_logic_vector(3 downto 0) := "0001"; -- not equal |
constant cond_cs_c : std_logic_vector(3 downto 0) := "0010"; -- unsigned higher or same |
constant cond_cc_c : std_logic_vector(3 downto 0) := "0011"; -- unsigned lower |
constant cond_mi_c : std_logic_vector(3 downto 0) := "0100"; -- negative |
constant cond_pl_c : std_logic_vector(3 downto 0) := "0101"; -- positive or zero |
constant cond_os_c : std_logic_vector(3 downto 0) := "0110"; -- overflow |
constant cond_oc_c : std_logic_vector(3 downto 0) := "0111"; -- no overflow |
constant cond_hi_c : std_logic_vector(3 downto 0) := "1000"; -- unsigned higher |
constant cond_ls_c : std_logic_vector(3 downto 0) := "1001"; -- unsigned lower or same |
constant cond_ge_c : std_logic_vector(3 downto 0) := "1010"; -- greater than or equal |
constant cond_lt_c : std_logic_vector(3 downto 0) := "1011"; -- less than |
constant cond_gt_c : std_logic_vector(3 downto 0) := "1100"; -- greater than |
constant cond_le_c : std_logic_vector(3 downto 0) := "1101"; -- less than or equal |
constant cond_ts_c : std_logic_vector(3 downto 0) := "1110"; -- transfer flag set |
constant cond_al_c : std_logic_vector(3 downto 0) := "1111"; -- always |
|
|
-- ALU Function Select -------------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
constant fs_inc_c : std_logic_vector(3 downto 0) := "0000"; -- add immediate |
constant fs_dec_c : std_logic_vector(3 downto 0) := "0001"; -- subtract immediate |
constant fs_add_c : std_logic_vector(3 downto 0) := "0010"; -- add |
constant fs_adc_c : std_logic_vector(3 downto 0) := "0011"; -- add with carry |
constant fs_sub_c : std_logic_vector(3 downto 0) := "0100"; -- subtract |
constant fs_sbc_c : std_logic_vector(3 downto 0) := "0101"; -- subtract with carry |
constant fs_cmp_c : std_logic_vector(3 downto 0) := "0110"; -- compare (sub) |
constant fs_cpx_c : std_logic_vector(3 downto 0) := "0111"; -- extende compare with flags (sbc) |
constant fs_and_c : std_logic_vector(3 downto 0) := "1000"; -- logical and |
constant fs_orr_c : std_logic_vector(3 downto 0) := "1001"; -- logical or |
constant fs_eor_c : std_logic_vector(3 downto 0) := "1010"; -- logical xor |
constant fs_nand_c : std_logic_vector(3 downto 0) := "1011"; -- logical nand |
constant fs_bic_c : std_logic_vector(3 downto 0) := "1100"; -- bit clear |
constant fs_teq_c : std_logic_vector(3 downto 0) := "1101"; -- compare by logical and |
constant fs_tst_c : std_logic_vector(3 downto 0) := "1110"; -- compare by logical xor |
constant fs_sft_c : std_logic_vector(3 downto 0) := "1111"; -- shift operation |
constant fs_inc_c : std_logic_vector(3 downto 0) := "0000"; -- add immediate |
constant fs_dec_c : std_logic_vector(3 downto 0) := "0001"; -- subtract immediate |
constant fs_add_c : std_logic_vector(3 downto 0) := "0010"; -- add |
constant fs_adc_c : std_logic_vector(3 downto 0) := "0011"; -- add with carry |
constant fs_sub_c : std_logic_vector(3 downto 0) := "0100"; -- subtract |
constant fs_sbc_c : std_logic_vector(3 downto 0) := "0101"; -- subtract with carry |
constant fs_cmp_c : std_logic_vector(3 downto 0) := "0110"; -- compare (sub) |
constant fs_cpx_c : std_logic_vector(3 downto 0) := "0111"; -- extende compare with flags (sbc) |
constant fs_and_c : std_logic_vector(3 downto 0) := "1000"; -- logical and |
constant fs_orr_c : std_logic_vector(3 downto 0) := "1001"; -- logical or |
constant fs_eor_c : std_logic_vector(3 downto 0) := "1010"; -- logical xor |
constant fs_nand_c : std_logic_vector(3 downto 0) := "1011"; -- logical nand |
constant fs_bic_c : std_logic_vector(3 downto 0) := "1100"; -- bit clear |
constant fs_teq_c : std_logic_vector(3 downto 0) := "1101"; -- compare by logical and |
constant fs_tst_c : std_logic_vector(3 downto 0) := "1110"; -- compare by logical xor |
constant fs_sft_c : std_logic_vector(3 downto 0) := "1111"; -- shift operation |
|
-- Pseudo Intructions -- |
constant fs_ld_user_c : std_logic_vector(3 downto 0) := fs_orr_c; -- load from user bank |
constant fs_st_user_c : std_logic_vector(3 downto 0) := fs_and_c; -- store to user bank |
constant fs_ld_msr_c : std_logic_vector(3 downto 0) := fs_cmp_c; -- load from msr |
constant fs_st_msr_c : std_logic_vector(3 downto 0) := fs_cpx_c; -- store to msr |
constant fs_ld_pc_c : std_logic_vector(3 downto 0) := fs_tst_c; -- load from pc |
constant fs_st_pc_c : std_logic_vector(3 downto 0) := fs_teq_c; -- store to pc |
-- Pseudo Intructions -- |
constant fs_ld_user_c : std_logic_vector(3 downto 0) := fs_orr_c; -- load from user bank |
constant fs_st_user_c : std_logic_vector(3 downto 0) := fs_and_c; -- store to user bank |
constant fs_ld_msr_c : std_logic_vector(3 downto 0) := fs_cmp_c; -- load from msr |
constant fs_st_msr_c : std_logic_vector(3 downto 0) := fs_cpx_c; -- store to msr |
constant fs_ld_pc_c : std_logic_vector(3 downto 0) := fs_tst_c; -- load from pc |
constant fs_st_pc_c : std_logic_vector(3 downto 0) := fs_teq_c; -- store to pc |
|
-- Elementary ALU Operations -- |
constant alu_adc_c : std_logic_vector(2 downto 0) := "000"; -- add with carry |
constant alu_sbc_c : std_logic_vector(2 downto 0) := "001"; -- subtract with carry |
constant alu_bic_c : std_logic_vector(2 downto 0) := "010"; -- bit clear |
constant alu_sft_c : std_logic_vector(2 downto 0) := "011"; -- shift operation |
constant alu_and_c : std_logic_vector(2 downto 0) := "100"; -- logical and |
constant alu_orr_c : std_logic_vector(2 downto 0) := "101"; -- logical or |
constant alu_eor_c : std_logic_vector(2 downto 0) := "110"; -- logical xor |
constant alu_nand_c : std_logic_vector(2 downto 0) := "111"; -- logical nand |
-- Elementary ALU Operations -- |
constant alu_adc_c : std_logic_vector(2 downto 0) := "000"; -- add with carry |
constant alu_sbc_c : std_logic_vector(2 downto 0) := "001"; -- subtract with carry |
constant alu_bic_c : std_logic_vector(2 downto 0) := "010"; -- bit clear |
constant alu_sft_c : std_logic_vector(2 downto 0) := "011"; -- shift operation |
constant alu_and_c : std_logic_vector(2 downto 0) := "100"; -- logical and |
constant alu_orr_c : std_logic_vector(2 downto 0) := "101"; -- logical or |
constant alu_eor_c : std_logic_vector(2 downto 0) := "110"; -- logical xor |
constant alu_nand_c : std_logic_vector(2 downto 0) := "111"; -- logical nand |
|
|
-- Shifter Control ------------------------------------------------------------------------ |
-- ------------------------------------------------------------------------------------------- |
constant sft_swp_c : std_logic_vector(2 downto 0) := "000"; -- swap halfwords |
constant sft_asr_c : std_logic_vector(2 downto 0) := "001"; -- arithemtical right shift |
constant sft_rol_c : std_logic_vector(2 downto 0) := "010"; -- rotate left |
constant sft_ror_c : std_logic_vector(2 downto 0) := "011"; -- rotate right |
constant sft_lsl_c : std_logic_vector(2 downto 0) := "100"; -- logical shift left |
constant sft_lsr_c : std_logic_vector(2 downto 0) := "101"; -- logical shift right |
constant sft_rlc_c : std_logic_vector(2 downto 0) := "110"; -- rotate left through carry |
constant sft_rrc_c : std_logic_vector(2 downto 0) := "111"; -- rotate right through carry |
constant sft_swp_c : std_logic_vector(2 downto 0) := "000"; -- swap halfwords |
constant sft_asr_c : std_logic_vector(2 downto 0) := "001"; -- arithemtical right shift |
constant sft_rol_c : std_logic_vector(2 downto 0) := "010"; -- rotate left |
constant sft_ror_c : std_logic_vector(2 downto 0) := "011"; -- rotate right |
constant sft_lsl_c : std_logic_vector(2 downto 0) := "100"; -- logical shift left |
constant sft_lsr_c : std_logic_vector(2 downto 0) := "101"; -- logical shift right |
constant sft_rlc_c : std_logic_vector(2 downto 0) := "110"; -- rotate left through carry |
constant sft_rrc_c : std_logic_vector(2 downto 0) := "111"; -- rotate right through carry |
|
|
-- Cool Stuff ----------------------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
-- S: Carrie Underwood - Thank God For The Hometowns |
-- M: Precious - Das Leben ist kostbar |
-- M: Mean Creek |
-- S: Mumford & Sons - Lover of the Light |
-- M: 127 Hours |
-- M: Hart of Dixie |
-- M: Nick und Norah - Soundtrack einer Nacht |
-- M: Joyride - S**drive |
-- S: David Nail - Whatever She's Got |
-- M: Brantley Gilbert - Bottoms Up |
-- S: Carrie Underwood - Thank God For The Hometowns |
-- M: Precious - Das Leben ist kostbar |
-- M: Mean Creek |
-- S: Mumford & Sons - Lover of the Light |
-- M: 127 Hours |
-- M: Hart of Dixie |
-- M: Nick und Norah - Soundtrack einer Nacht |
-- M: Joyride - S**drive |
-- S: David Nail - Whatever She's Got |
-- M: Brantley Gilbert - Bottoms Up |
|
|
-- Functions ------------------------------------------------------------------------------ |
-- ------------------------------------------------------------------------------------------- |
function log2(temp : natural) return natural; -- logarithm base 2 |
function log2(temp : natural) return natural; -- logarithm base 2 |
|
|
-- Component: Data Register File ---------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component REG_FILE |
port ( |
-- Global Control -- |
CLK_I : in std_logic; -- global clock line |
CE_I : in std_logic; -- clock enable |
RST_I : in std_logic; -- global reset line, sync, high-active |
component reg_file |
port ( |
-- global control -- |
clk_i : in std_logic; -- global clock line |
ce_i : in std_logic; -- clock enable |
rst_i : in std_logic; -- global reset line, sync, high-active |
|
-- Function Control -- |
WB_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- wb stage control |
OF_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- of stage control |
-- function control -- |
wb_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- wb stage control |
of_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- of stage control |
|
-- Data Input -- |
WB_DATA_I : in std_logic_vector(data_width_c-1 downto 0); -- write back data |
IMMEDIATE_I : in std_logic_vector(data_width_c-1 downto 0); -- immediates |
PC_1D_I : in std_logic_vector(data_width_c-1 downto 0); -- pc 1x delayed |
WB_FWD_I : in std_logic_vector(fwd_width_c-1 downto 0); -- WB stage forwarding path |
-- data input -- |
wb_data_i : in std_logic_vector(data_width_c-1 downto 0); -- write back data |
immediate_i : in std_logic_vector(data_width_c-1 downto 0); -- immediates |
pc_1d_i : in std_logic_vector(data_width_c-1 downto 0); -- pc 1x delayed |
wb_fwd_i : in std_logic_vector(fwd_width_c-1 downto 0); -- wb stage forwarding path |
|
-- Data Output -- |
OP_A_DATA_O : out std_logic_vector(data_width_c-1 downto 0); -- operand A output |
OP_B_DATA_O : out std_logic_vector(data_width_c-1 downto 0); -- operand B output |
OP_C_DATA_O : out std_logic_vector(data_width_c-1 downto 0) -- operand C output |
); |
-- data output -- |
op_a_data_o : out std_logic_vector(data_width_c-1 downto 0); -- operand a output |
op_b_data_o : out std_logic_vector(data_width_c-1 downto 0); -- operand b output |
op_c_data_o : out std_logic_vector(data_width_c-1 downto 0) -- operand c output |
); |
end component; |
|
|
-- Component: Arithmetic/Logic Unit ------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component ALU |
port ( |
-- Global Control -- |
CLK_I : in std_logic; -- global clock line |
CE_I : in std_logic; -- clock enable |
RST_I : in std_logic; -- global reset line, sync, high-active |
component alu |
port ( |
-- global control -- |
clk_i : in std_logic; -- global clock line |
ce_i : in std_logic; -- clock enable |
rst_i : in std_logic; -- global reset line, sync, high-active |
|
-- Function Control -- |
EX_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- stage control |
FLAG_BUS_I : in std_logic_vector(flag_bus_width_c-1 downto 0); -- flag input |
-- function control -- |
ex_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- stage control |
flag_bus_i : in std_logic_vector(flag_bus_width_c-1 downto 0); -- flag input |
|
-- Data Input -- |
OP_A_I : in std_logic_vector(data_width_c-1 downto 0); -- operand A input |
OP_B_I : in std_logic_vector(data_width_c-1 downto 0); -- operand B input |
OP_C_I : in std_logic_vector(data_width_c-1 downto 0); -- operand C input |
PC_1D_I : in std_logic_vector(data_width_c-1 downto 0); -- 1x delayed PC |
MA_FWD_I : in std_logic_vector(fwd_width_c-1 downto 0); -- MA stage forwarding path |
WB_FWD_I : in std_logic_vector(fwd_width_c-1 downto 0); -- WB stage forwarding path |
-- data input -- |
op_a_i : in std_logic_vector(data_width_c-1 downto 0); -- operand a input |
op_b_i : in std_logic_vector(data_width_c-1 downto 0); -- operand b input |
op_c_i : in std_logic_vector(data_width_c-1 downto 0); -- operand c input |
pc_1d_i : in std_logic_vector(data_width_c-1 downto 0); -- 1x delayed pc |
ma_fwd_i : in std_logic_vector(fwd_width_c-1 downto 0); -- ma stage forwarding path |
wb_fwd_i : in std_logic_vector(fwd_width_c-1 downto 0); -- wb stage forwarding path |
|
-- Data Output -- |
FLAG_BUS_O : out std_logic_vector(flag_bus_width_c-1 downto 0); -- flag output |
MASK_T_FLAG_O : out std_logic; -- T-Flag for mask generation |
MSR_DATA_O : out std_logic_vector(data_width_c-1 downto 0); -- MSR write data |
ALU_RES_O : out std_logic_vector(data_width_c-1 downto 0); -- ALU result |
MUL_RES_O : out std_logic_vector(2*data_width_c-1 downto 0); -- MUL result |
BP_OPA_O : out std_logic_vector(data_width_c-1 downto 0); -- operand A bypass |
BP_OPC_O : out std_logic_vector(data_width_c-1 downto 0); -- operand C bypass |
CP_CP0_EN_O : out std_logic; -- access to cp0 |
CP_CP1_EN_O : out std_logic; -- access to cp1 |
CP_OP_O : out std_logic; -- data transfer/operation |
CP_RW_O : out std_logic; -- read/write access |
CP_CMD_O : out std_logic_vector(cp_cmd_width_c-1 downto 0); -- register addresses / cmd |
CP_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- write data |
MEM_REQ_O : out std_logic -- data memory access request for next cycle |
); |
-- data output -- |
flag_bus_o : out std_logic_vector(flag_bus_width_c-1 downto 0); -- flag output |
mask_t_flag_o : out std_logic; -- t-flag for mask generation |
msr_data_o : out std_logic_vector(data_width_c-1 downto 0); -- msr write data |
alu_res_o : out std_logic_vector(data_width_c-1 downto 0); -- alu result |
mul_res_o : out std_logic_vector(2*data_width_c-1 downto 0); -- mul result |
bp_opa_o : out std_logic_vector(data_width_c-1 downto 0); -- operand a bypass |
bp_opc_o : out std_logic_vector(data_width_c-1 downto 0); -- operand c bypass |
cp_cp0_en_o : out std_logic; -- access to cp0 |
cp_cp1_en_o : out std_logic; -- access to cp1 |
cp_op_o : out std_logic; -- data transfer/operation |
cp_rw_o : out std_logic; -- read/write access |
cp_cmd_o : out std_logic_vector(cp_cmd_width_c-1 downto 0); -- register addresses / cmd |
cp_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- write data |
mem_req_o : out std_logic -- data memory access request for next cycle |
); |
end component; |
|
|
-- Component: Machine Status System ------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component SYS_REG |
port ( |
-- Global Control -- |
CLK_I : in std_logic; -- global clock line |
CE_I : in std_logic; -- clock enable |
RST_I : in std_logic; -- global reset line, asyc |
component sys_reg |
port ( |
-- global control -- |
clk_i : in std_logic; -- global clock line |
ce_i : in std_logic; -- clock enable |
rst_i : in std_logic; -- global reset line, asyc |
|
-- Function Control -- |
EX_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- ex stage control |
MA_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- ma stage control |
EXT_INT_REQ0_I : in std_logic; -- external interrupt request 0 |
EXT_INT_REQ1_I : in std_logic; -- external interrupt request 1 |
-- function control -- |
ex_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- ex stage control |
ma_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- ma stage control |
ext_int_req0_i : in std_logic; -- external interrupt request 0 |
ext_int_req1_i : in std_logic; -- external interrupt request 1 |
|
-- Data Input -- |
FLAG_BUS_I : in std_logic_vector(flag_bus_width_c-1 downto 0); -- flag input |
EXC_POS_I : in std_logic; -- external interrupt would be possible |
STOP_PC : in std_logic; -- freeze pc |
PC_DATA_I : in std_logic_vector(data_width_c-1 downto 0); -- PC write data |
MSR_DATA_I : in std_logic_vector(data_width_c-1 downto 0); -- MSR write data |
-- data input -- |
flag_bus_i : in std_logic_vector(flag_bus_width_c-1 downto 0); -- flag input |
exc_pos_i : in std_logic; -- external interrupt would be possible |
stop_pc : in std_logic; -- freeze pc |
pc_data_i : in std_logic_vector(data_width_c-1 downto 0); -- pc write data |
msr_data_i : in std_logic_vector(data_width_c-1 downto 0); -- msr write data |
|
-- Data Output -- |
FLAG_BUS_O : out std_logic_vector(flag_bus_width_c-1 downto 0); -- flag output |
VALID_BRANCH_O : out std_logic; -- valid branch detected |
EXC_EXECUTED_O : out std_logic; -- executed exception |
WAKE_UP_O : out std_logic; -- wake-up signal |
RD_MSR_O : out std_logic_vector(data_width_c-1 downto 0); -- read data msr |
PC_O : out std_logic_vector(data_width_c-1 downto 0); -- pc output |
PC_1D_O : out std_logic_vector(data_width_c-1 downto 0); -- pc 1x delayed |
CP_PTC_O : out std_logic; -- user coprocessor protection |
COND_TRUE_O : out std_logic; -- condition is true |
MODE_O : out std_logic; -- current operating mode |
MODE_FF_O : out std_logic -- delayed current mode |
); |
-- data output -- |
flag_bus_o : out std_logic_vector(flag_bus_width_c-1 downto 0); -- flag output |
valid_branch_o : out std_logic; -- valid branch detected |
exc_executed_o : out std_logic; -- executed exception |
wake_up_o : out std_logic; -- wake-up signal |
rd_msr_o : out std_logic_vector(data_width_c-1 downto 0); -- read data msr |
pc_o : out std_logic_vector(data_width_c-1 downto 0); -- pc output |
pc_1d_o : out std_logic_vector(data_width_c-1 downto 0); -- pc 1x delayed |
cp_ptc_o : out std_logic; -- user coprocessor protection |
cond_true_o : out std_logic; -- condition is true |
mode_o : out std_logic; -- current operating mode |
mode_ff_o : out std_logic -- delayed current mode |
); |
end component; |
|
|
-- Component: Memory Access Control ------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component MEM_ACC |
port ( |
-- Global Control -- |
CLK_I : in std_logic; -- global clock line |
CE_I : in std_logic; -- clock enable |
RST_I : in std_logic; -- global reset line, asyc |
component mem_acc |
port ( |
-- global control -- |
clk_i : in std_logic; -- global clock line |
ce_i : in std_logic; -- clock enable |
rst_i : in std_logic; -- global reset line, asyc |
|
-- Function Control -- |
MA_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- ma stage control |
-- function control -- |
ma_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- ma stage control |
|
-- Data Input -- |
ALU_RES_I : in std_logic_vector(data_width_c-1 downto 0); -- alu result |
MUL_RES_I : in std_logic_vector(2*data_width_c-1 downto 0); -- mul result |
ADR_BASE_I : in std_logic_vector(data_width_c-1 downto 0); -- op_a bypass |
DATA_BP_I : in std_logic_vector(data_width_c-1 downto 0); -- op_b bypass |
CP_DATA_I : in std_logic_vector(data_width_c-1 downto 0); -- coprocessor rd data |
RD_MSR_I : in std_logic_vector(data_width_c-1 downto 0); -- read data msr |
WB_FWD_I : in std_logic_vector(fwd_width_c-1 downto 0); -- WB stage forwarding path |
-- data input -- |
alu_res_i : in std_logic_vector(data_width_c-1 downto 0); -- alu result |
mul_res_i : in std_logic_vector(2*data_width_c-1 downto 0); -- mul result |
adr_base_i : in std_logic_vector(data_width_c-1 downto 0); -- op_a bypass |
data_bp_i : in std_logic_vector(data_width_c-1 downto 0); -- op_b bypass |
cp_data_i : in std_logic_vector(data_width_c-1 downto 0); -- coprocessor rd data |
rd_msr_i : in std_logic_vector(data_width_c-1 downto 0); -- read data msr |
wb_fwd_i : in std_logic_vector(fwd_width_c-1 downto 0); -- wb stage forwarding path |
|
-- Data Output -- |
DATA_O : out std_logic_vector(data_width_c-1 downto 0); -- data output |
MEM_ADR_FB_O : out std_logic_vector(data_width_c-1 downto 0); -- memory address feedback |
MA_FWD_O : out std_logic_vector(fwd_width_c-1 downto 0); -- MA stage forwarding path |
-- data output -- |
data_o : out std_logic_vector(data_width_c-1 downto 0); -- data output |
mem_adr_fb_o : out std_logic_vector(data_width_c-1 downto 0); -- memory address feedback |
ma_fwd_o : out std_logic_vector(fwd_width_c-1 downto 0); -- ma stage forwarding path |
|
-- Memory (w) Interface -- |
MEM_ADR_O : out std_logic_vector(data_width_c-1 downto 0); -- address output |
MEM_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- write data output |
MEM_RW_O : out std_logic -- read write |
); |
-- memory (w) interface -- |
mem_adr_o : out std_logic_vector(data_width_c-1 downto 0); -- address output |
mem_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- write data output |
mem_rw_o : out std_logic -- read write |
); |
end component; |
|
|
-- Component: Data Write Back Unit -------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component WB_UNIT |
port ( |
-- Global Control -- |
CLK_I : in std_logic; -- global clock line |
CE_I : in std_logic; -- clock enable |
RST_I : in std_logic; -- global reset line, sync, high-active |
component wb_unit |
port ( |
-- global control -- |
clk_i : in std_logic; -- global clock line |
ce_i : in std_logic; -- clock enable |
rst_i : in std_logic; -- global reset line, sync, high-active |
|
-- Function Control -- |
WB_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- wb stage control |
-- function control -- |
wb_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- wb stage control |
|
-- Data Input -- |
MEM_WB_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- memory read data |
ALU_WB_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- alu read data |
MEM_ADR_FB_I : in std_logic_vector(data_width_c-1 downto 0); -- memory address feedback |
-- data input -- |
mem_wb_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- memory read data |
alu_wb_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- alu read data |
mem_adr_fb_i : in std_logic_vector(data_width_c-1 downto 0); -- memory address feedback |
|
-- Data Output -- |
WB_DATA_O : out std_logic_vector(data_width_c-1 downto 0); -- write back data |
WB_FWD_O : out std_logic_vector(fwd_width_c-1 downto 0) -- WB stage forwarding path |
); |
-- data output -- |
wb_data_o : out std_logic_vector(data_width_c-1 downto 0); -- write back data |
wb_fwd_o : out std_logic_vector(fwd_width_c-1 downto 0) -- wb stage forwarding path |
); |
end component; |
|
|
-- Component: Control System -------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component CTRL |
port ( |
-- Global Control -- |
CLK_I : in std_logic; -- global clock line |
CE_I : in std_logic; -- clock enable |
RST_I : in std_logic; -- global reset line, sync, high-active |
component ctrl |
port ( |
-- global control -- |
clk_i : in std_logic; -- global clock line |
ce_i : in std_logic; -- clock enable |
rst_i : in std_logic; -- global reset line, sync, high-active |
|
-- Decoder Interface -- |
OP_DEC_CTRL_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- decoder ctrl lines |
MULTI_CYC_O : out std_logic; -- multi-cycle indicator |
MULTI_CYC_REQ_I : in std_logic; -- multi-cycle request |
INSTR_I : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
INSTR_REG_O : out std_logic_vector(data_width_c-1 downto 0); -- instruction register |
-- decoder interface -- |
op_dec_ctrl_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- decoder ctrl lines |
multi_cyc_o : out std_logic; -- multi-cycle indicator |
multi_cyc_req_i : in std_logic; -- multi-cycle request |
instr_i : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
instr_reg_o : out std_logic_vector(data_width_c-1 downto 0); -- instruction register |
|
-- Control Lines -- |
OF_CTRL_BUS_O : out std_logic_vector(ctrl_width_c-1 downto 0); -- of stage control |
EX_CTRL_BUS_O : out std_logic_vector(ctrl_width_c-1 downto 0); -- ex stage control |
MA_CTRL_BUS_O : out std_logic_vector(ctrl_width_c-1 downto 0); -- ma stage control |
WB_CTRL_BUS_O : out std_logic_vector(ctrl_width_c-1 downto 0); -- wb stage control |
-- control lines -- |
of_ctrl_bus_o : out std_logic_vector(ctrl_width_c-1 downto 0); -- of stage control |
ex_ctrl_bus_o : out std_logic_vector(ctrl_width_c-1 downto 0); -- ex stage control |
ma_ctrl_bus_o : out std_logic_vector(ctrl_width_c-1 downto 0); -- ma stage control |
wb_ctrl_bus_o : out std_logic_vector(ctrl_width_c-1 downto 0); -- wb stage control |
|
-- Function Control -- |
COND_TRUE_I : in std_logic; -- condition is true |
VALID_BRANCH_I : in std_logic; -- valid branch detected |
EXC_TAKEN_I : in std_logic; -- exception taken |
WAKE_UP_I : in std_logic; -- wake up from sleep |
EXC_POS_O : out std_logic; -- exception would be possible |
STOP_PC_O : out std_logic; -- freeze program counter |
IR_UPDATE_EN_O : out std_logic -- enable instruction reg update |
); |
-- function control -- |
cond_true_i : in std_logic; -- condition is true |
valid_branch_i : in std_logic; -- valid branch detected |
exc_taken_i : in std_logic; -- exception taken |
wake_up_i : in std_logic; -- wake up from sleep |
exc_pos_o : out std_logic; -- exception would be possible |
stop_pc_o : out std_logic -- freeze program counter |
); |
end component; |
|
|
-- Component: Opcode Decoder -------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component OP_DEC |
port ( |
-- Decoder Interface Input -- |
INSTR_I : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
INSTR_ADR_I : in std_logic_vector(data_width_c-1 downto 0); -- corresponding address |
T_FLAG_I : in std_logic; -- T-Flag input |
M_FLAG_I : in std_logic; -- Mode flag input |
MULTI_CYC_I : in std_logic; -- multi-cycle indicator |
CP_PTC_I : in std_logic; -- user coprocessor protection |
component op_dec |
port ( |
-- decoder interface input -- |
instr_i : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
instr_adr_i : in std_logic_vector(data_width_c-1 downto 0); -- corresponding address |
t_flag_i : in std_logic; -- t-flag input |
m_flag_i : in std_logic; -- mode flag input |
multi_cyc_i : in std_logic; -- multi-cycle indicator |
cp_ptc_i : in std_logic; -- user coprocessor protection |
|
-- Decoder Interface Output -- |
MULTI_CYC_REQ_O : out std_logic; -- multi-cycle reqest |
CTRL_O : out std_logic_vector(ctrl_width_c-1 downto 0); -- decoder ctrl lines |
IMM_O : out std_logic_vector(data_width_c-1 downto 0) -- immediate |
); |
-- decoder interface output -- |
multi_cyc_req_o : out std_logic; -- multi-cycle reqest |
ctrl_o : out std_logic_vector(ctrl_width_c-1 downto 0); -- decoder ctrl lines |
imm_o : out std_logic_vector(data_width_c-1 downto 0) -- immediate |
); |
end component; |
|
|
-- Component: Atlas CPU Core -------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component ATLAS_CPU |
port ( |
-- Global Control -- |
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
CE_I : in std_logic; -- global clock enable, high-active |
component atlas_cpu |
port ( |
-- global control -- |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
ce_i : in std_logic; -- global clock enable, high-active |
|
-- Instruction Interface -- |
INSTR_ADR_O : out std_logic_vector(data_width_c-1 downto 0); -- instruction byte adr |
INSTR_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
INSTR_EN_O : out std_logic; -- allow IR update |
-- instruction interface -- |
instr_adr_o : out std_logic_vector(data_width_c-1 downto 0); -- instruction byte adr |
instr_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
|
-- Memory Arbitration -- |
SYS_MODE_O : out std_logic; -- current operating mode |
SYS_INT_O : out std_logic; -- interrupt processing |
-- memory arbitration -- |
sys_mode_o : out std_logic; -- current operating mode |
sys_int_o : out std_logic; -- interrupt processing |
|
-- Memory System -- |
MEM_REQ_O : out std_logic; -- mem access in next cycle |
MEM_RW_O : out std_logic; -- read write |
MEM_ADR_O : out std_logic_vector(data_width_c-1 downto 0); -- data byte adr |
MEM_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- write data |
MEM_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- read data |
-- memory system -- |
mem_req_o : out std_logic; -- mem access in next cycle |
mem_rw_o : out std_logic; -- read write |
mem_adr_o : out std_logic_vector(data_width_c-1 downto 0); -- data byte adr |
mem_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- write data |
mem_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- read data |
|
-- Coprocessor Interface -- |
USR_CP_EN_O : out std_logic; -- access to cp0 |
SYS_CP_EN_O : out std_logic; -- access to cp1 |
CP_OP_O : out std_logic; -- data transfer/processing |
CP_RW_O : out std_logic; -- read/write access |
CP_CMD_O : out std_logic_vector(cp_cmd_width_c-1 downto 0); -- register addresses / cmd |
CP_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- write data |
CP_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- read data cp0 OR cp1 |
-- coprocessor interface -- |
usr_cp_en_o : out std_logic; -- access to cp0 |
sys_cp_en_o : out std_logic; -- access to cp1 |
cp_op_o : out std_logic; -- data transfer/processing |
cp_rw_o : out std_logic; -- read/write access |
cp_cmd_o : out std_logic_vector(cp_cmd_width_c-1 downto 0); -- register addresses / cmd |
cp_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- write data |
cp_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- read data cp0 or cp1 |
|
-- External Interrupt Lines -- |
EXT_INT_0_I : in std_logic; -- external interrupt request 0 |
EXT_INT_1_I : in std_logic -- external interrupt request 1 |
); |
-- external interrupt lines -- |
ext_int_0_i : in std_logic; -- external interrupt request 0 |
ext_int_1_i : in std_logic -- external interrupt request 1 |
); |
end component; |
|
|
-- Component: System Controller Core 0 ---------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component SYS_0_CORE |
port ( |
-- Host Interface -- |
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
ICE_I : in std_logic; -- interface clock enable, high-active |
W_EN_I : in std_logic; -- write enable |
R_EN_I : in std_logic; -- read enable |
ADR_I : in std_logic_vector(02 downto 0); -- access address |
DAT_I : in std_logic_vector(15 downto 0); -- write data |
DAT_O : out std_logic_vector(15 downto 0); -- read data |
component sys_0_core |
port ( |
-- host interface -- |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
ice_i : in std_logic; -- interface clock enable, high-active |
w_en_i : in std_logic; -- write enable |
r_en_i : in std_logic; -- read enable |
adr_i : in std_logic_vector(02 downto 0); -- access address |
dat_i : in std_logic_vector(15 downto 0); -- write data |
dat_o : out std_logic_vector(15 downto 0); -- read data |
|
-- Interrupt Lines -- |
TIMER_IRQ_O : out std_logic; -- timer irq |
IRQ_I : in std_logic_vector(07 downto 0); -- irq input |
IRQ_O : out std_logic -- interrupt request |
); |
-- interrupt lines -- |
timer_irq_o : out std_logic; -- timer irq |
irq_i : in std_logic_vector(07 downto 0); -- irq input |
irq_o : out std_logic -- interrupt request |
); |
end component; |
|
|
-- Component: System Controller Core 1 ---------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component SYS_1_CORE |
generic ( |
-- Clock Speed Configuration -- |
CLK_SPEED_G : std_logic_vector(31 downto 0) := (others => '0') -- clock speed (in Hz) |
); |
port ( |
-- Host Interface -- |
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
ICE_I : in std_logic; -- interface clock enable, high-active |
W_EN_I : in std_logic; -- write enable |
R_EN_I : in std_logic; -- read enable |
ADR_I : in std_logic_vector(02 downto 0); -- access address |
DAT_I : in std_logic_vector(15 downto 0); -- write data |
DAT_O : out std_logic_vector(15 downto 0); -- read data |
SYS_MODE_I : in std_logic; -- current operating mode |
INT_EXE_I : in std_logic; -- interrupt beeing executed |
component sys_1_core |
generic ( |
-- clock speed configuration -- |
clk_speed_g : std_logic_vector(31 downto 0) := (others => '0') -- clock speed (in hz) |
); |
port ( |
-- host interface -- |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
ice_i : in std_logic; -- interface clock enable, high-active |
w_en_i : in std_logic; -- write enable |
r_en_i : in std_logic; -- read enable |
adr_i : in std_logic_vector(02 downto 0); -- access address |
dat_i : in std_logic_vector(15 downto 0); -- write data |
dat_o : out std_logic_vector(15 downto 0); -- read data |
sys_mode_i : in std_logic; -- current operating mode |
int_exe_i : in std_logic; -- interrupt beeing executed |
|
-- Memory Interface -- |
MEM_IP_ADR_O : out std_logic_vector(15 downto 0); -- instruction page |
MEM_DP_ADR_O : out std_logic_vector(15 downto 0) -- data page |
); |
-- memory interface -- |
mem_ip_adr_o : out std_logic_vector(15 downto 0); -- instruction page |
mem_dp_adr_o : out std_logic_vector(15 downto 0) -- data page |
); |
end component; |
|
|
-- Component: Communication Controller Core 0 --------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component COM_0_CORE |
port ( |
-- Host Interface -- |
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
ICE_I : in std_logic; -- interface clock enable, high-active |
W_EN_I : in std_logic; -- write enable |
R_EN_I : in std_logic; -- read enable |
ADR_I : in std_logic_vector(02 downto 0); -- access address |
DAT_I : in std_logic_vector(15 downto 0); -- write data |
DAT_O : out std_logic_vector(15 downto 0); -- read data |
component com_0_core |
port ( |
-- host interface -- |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
ice_i : in std_logic; -- interface clock enable, high-active |
w_en_i : in std_logic; -- write enable |
r_en_i : in std_logic; -- read enable |
adr_i : in std_logic_vector(02 downto 0); -- access address |
dat_i : in std_logic_vector(15 downto 0); -- write data |
dat_o : out std_logic_vector(15 downto 0); -- read data |
|
-- Memory Interface -- |
UART_RX_IRQ_O : out std_logic; -- UART IRQ "data available" |
UART_TX_IRQ_O : out std_logic; -- UART IRQ "sending done" |
SPI_IRQ_O : out std_logic; -- SPI IRQ "transfer done" |
PIO_IRQ_O : out std_logic; -- PIO input pin change irq |
-- memory interface -- |
uart_rx_irq_o : out std_logic; -- uart irq "data available" |
uart_tx_irq_o : out std_logic; -- uart irq "sending done" |
spi_irq_o : out std_logic; -- spi irq "transfer done" |
pio_irq_o : out std_logic; -- pio input pin change irq |
|
-- IO Interface -- |
UART_TXD_O : out std_logic; -- UART serial output |
UART_RXD_I : in std_logic; -- UART serial input |
SPI_MOSI_O : out std_logic_vector(07 downto 0); -- serial data out |
SPI_MISO_I : in std_logic_vector(07 downto 0); -- serial data in |
SPI_SCK_O : out std_logic_vector(07 downto 0); -- serial clock out |
SPI_CS_O : out std_logic_vector(07 downto 0); -- chip select (low active) |
PIO_IN_I : in std_logic_vector(15 downto 0); -- parallel input |
PIO_OUT_O : out std_logic_vector(15 downto 0); -- parallel output |
SYS_IO_I : in std_logic_vector(07 downto 0); -- system input |
SYS_IO_O : out std_logic_vector(07 downto 0) -- system output |
); |
-- io interface -- |
uart_txd_o : out std_logic; -- uart serial output |
uart_rxd_i : in std_logic; -- uart serial input |
spi_mosi_o : out std_logic_vector(07 downto 0); -- serial data out |
spi_miso_i : in std_logic_vector(07 downto 0); -- serial data in |
spi_sck_o : out std_logic_vector(07 downto 0); -- serial clock out |
spi_cs_o : out std_logic_vector(07 downto 0); -- chip select (low active) |
pio_in_i : in std_logic_vector(15 downto 0); -- parallel input |
pio_out_o : out std_logic_vector(15 downto 0); -- parallel output |
sys_io_i : in std_logic_vector(07 downto 0); -- system input |
sys_io_o : out std_logic_vector(07 downto 0) -- system output |
); |
end component; |
|
|
-- Component: Communication Controller Core 1 --------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component COM_1_CORE |
port ( |
-- Host Interface -- |
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
ICE_I : in std_logic; -- interface clock enable, high-active |
W_EN_I : in std_logic; -- write enable |
R_EN_I : in std_logic; -- read enable |
CMD_EXE_I : in std_logic; -- execute command |
ADR_I : in std_logic_vector(02 downto 0); -- access address/command |
DAT_I : in std_logic_vector(15 downto 0); -- write data |
DAT_O : out std_logic_vector(15 downto 0); -- read data |
IRQ_O : out std_logic; -- interrupt request |
component com_1_core |
port ( |
-- host interface -- |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
ice_i : in std_logic; -- interface clock enable, high-active |
w_en_i : in std_logic; -- write enable |
r_en_i : in std_logic; -- read enable |
cmd_exe_i : in std_logic; -- execute command |
adr_i : in std_logic_vector(02 downto 0); -- access address/command |
dat_i : in std_logic_vector(15 downto 0); -- write data |
dat_o : out std_logic_vector(15 downto 0); -- read data |
irq_o : out std_logic; -- interrupt request |
|
-- Wishbone Bus -- |
WB_CLK_O : out std_logic; -- bus clock |
WB_RST_O : out std_logic; -- bus reset, sync, high active |
WB_ADR_O : out std_logic_vector(31 downto 0); -- address |
WB_SEL_O : out std_logic_vector(01 downto 0); -- byte select |
WB_DATA_O : out std_logic_vector(15 downto 0); -- data out |
WB_DATA_I : in std_logic_vector(15 downto 0); -- data in |
WB_WE_O : out std_logic; -- read/write |
WB_CYC_O : out std_logic; -- cycle enable |
WB_STB_O : out std_logic; -- strobe |
WB_ACK_I : in std_logic; -- acknowledge |
WB_ERR_I : in std_logic -- bus error |
); |
-- wishbone bus -- |
wb_clk_o : out std_logic; -- bus clock |
wb_rst_o : out std_logic; -- bus reset, sync, high active |
wb_adr_o : out std_logic_vector(31 downto 0); -- address |
wb_sel_o : out std_logic_vector(01 downto 0); -- byte select |
wb_data_o : out std_logic_vector(15 downto 0); -- data out |
wb_data_i : in std_logic_vector(15 downto 0); -- data in |
wb_we_o : out std_logic; -- read/write |
wb_cyc_o : out std_logic; -- cycle enable |
wb_stb_o : out std_logic; -- strobe |
wb_ack_i : in std_logic; -- acknowledge |
wb_err_i : in std_logic -- bus error |
); |
end component; |
|
|
-- Component: System Coprocessor ---------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component SYSTEM_CP |
generic ( |
-- Configuration -- |
CLOCK_SPEED_G : std_logic_vector(31 downto 0) -- clock speed in Hz |
); |
port ( |
-- Global Control -- |
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
ICE_I : in std_logic; -- interface clock enable, high-active |
component system_cp |
generic ( |
-- configuration -- |
clock_speed_g : std_logic_vector(31 downto 0) -- clock speed in hz |
); |
port ( |
-- global control -- |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
ice_i : in std_logic; -- interface clock enable, high-active |
|
-- Processor Interface -- |
CP_EN_I : in std_logic; -- access coprocessor |
CP_OP_I : in std_logic; -- data transfer/processing |
CP_RW_I : in std_logic; -- read/write access |
CP_CMD_I : in std_logic_vector(cp_cmd_width_c-1 downto 0); -- register addresses / cmd |
CP_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- write data |
CP_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- read data |
CP_IRQ_O : out std_logic; -- unit interrupt request |
SYS_MODE_I : in std_logic; -- current operating mode |
INT_EXE_I : in std_logic; -- interrupt beeing executed |
-- processor interface -- |
cp_en_i : in std_logic; -- access coprocessor |
cp_op_i : in std_logic; -- data transfer/processing |
cp_rw_i : in std_logic; -- read/write access |
cp_cmd_i : in std_logic_vector(cp_cmd_width_c-1 downto 0); -- register addresses / cmd |
cp_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- write data |
cp_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- read data |
cp_irq_o : out std_logic; -- unit interrupt request |
sys_mode_i : in std_logic; -- current operating mode |
int_exe_i : in std_logic; -- interrupt beeing executed |
|
-- Memory Interface -- |
MEM_IP_ADR_O : out std_logic_vector(15 downto 0); -- instruction page |
MEM_DP_ADR_O : out std_logic_vector(15 downto 0); -- data page |
-- memory interface -- |
mem_ip_adr_o : out std_logic_vector(15 downto 0); -- instruction page |
mem_dp_adr_o : out std_logic_vector(15 downto 0); -- data page |
|
-- IO Interface -- |
UART_RXD_I : in std_logic; -- receiver input |
UART_TXD_O : out std_logic; -- UART transmitter output |
SPI_MOSI_O : out std_logic_vector(07 downto 0); -- serial data out |
SPI_MISO_I : in std_logic_vector(07 downto 0); -- serial data in |
SPI_SCK_O : out std_logic_vector(07 downto 0); -- serial clock out |
SPI_CS_O : out std_logic_vector(07 downto 0); -- chip select (low active) |
PIO_OUT_O : out std_logic_vector(15 downto 0); -- parallel output |
PIO_IN_I : in std_logic_vector(15 downto 0); -- parallel input |
SYS_OUT_O : out std_logic_vector(07 downto 0); -- system output |
SYS_IN_I : in std_logic_vector(07 downto 0); -- system input |
IRQ_I : in std_logic; -- IRQ |
-- io interface -- |
uart_rxd_i : in std_logic; -- receiver input |
uart_txd_o : out std_logic; -- uart transmitter output |
spi_mosi_o : out std_logic_vector(07 downto 0); -- serial data out |
spi_miso_i : in std_logic_vector(07 downto 0); -- serial data in |
spi_sck_o : out std_logic_vector(07 downto 0); -- serial clock out |
spi_cs_o : out std_logic_vector(07 downto 0); -- chip select (low active) |
pio_out_o : out std_logic_vector(15 downto 0); -- parallel output |
pio_in_i : in std_logic_vector(15 downto 0); -- parallel input |
sys_out_o : out std_logic_vector(07 downto 0); -- system output |
sys_in_i : in std_logic_vector(07 downto 0); -- system input |
irq_i : in std_logic; -- irq |
|
-- Wishbone Bus -- |
WB_CLK_O : out std_logic; -- bus clock |
WB_RST_O : out std_logic; -- bus reset, sync, high active |
WB_ADR_O : out std_logic_vector(31 downto 0); -- address |
WB_SEL_O : out std_logic_vector(01 downto 0); -- byte select |
WB_DATA_O : out std_logic_vector(15 downto 0); -- data out |
WB_DATA_I : in std_logic_vector(15 downto 0); -- data in |
WB_WE_O : out std_logic; -- read/write |
WB_CYC_O : out std_logic; -- cycle enable |
WB_STB_O : out std_logic; -- strobe |
WB_ACK_I : in std_logic; -- acknowledge |
WB_ERR_I : in std_logic -- bus error |
); |
-- wishbone bus -- |
wb_clk_o : out std_logic; -- bus clock |
wb_rst_o : out std_logic; -- bus reset, sync, high active |
wb_adr_o : out std_logic_vector(31 downto 0); -- address |
wb_sel_o : out std_logic_vector(01 downto 0); -- byte select |
wb_data_o : out std_logic_vector(15 downto 0); -- data out |
wb_data_i : in std_logic_vector(15 downto 0); -- data in |
wb_we_o : out std_logic; -- read/write |
wb_cyc_o : out std_logic; -- cycle enable |
wb_stb_o : out std_logic; -- strobe |
wb_ack_i : in std_logic; -- acknowledge |
wb_err_i : in std_logic -- bus error |
); |
end component; |
|
-- Component: Memory Gateway -------------------------------------------------------------- |
|
-- Component: memory gateway -------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component MEM_GATE |
port ( |
-- Host Interface -- |
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
component mem_gate |
port ( |
-- host interface -- |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
|
I_ADR_I : in std_logic_vector(15 downto 0); -- instruction adr |
I_EN_I : in std_logic; -- IR update |
I_DAT_O : out std_logic_vector(15 downto 0); -- instruction out |
D_REQ_I : in std_logic; -- request access in next cycle |
D_RW_I : in std_logic; -- read/write |
D_ADR_I : in std_logic_vector(15 downto 0); -- data adr |
D_DAT_I : in std_logic_vector(15 downto 0); -- data in |
D_DAT_O : out std_logic_vector(15 downto 0); -- data out |
MEM_IP_ADR_I : in std_logic_vector(15 downto 0); -- instruction page |
MEM_DP_ADR_I : in std_logic_vector(15 downto 0); -- data page |
i_adr_i : in std_logic_vector(15 downto 0); -- instruction adr |
i_dat_o : out std_logic_vector(15 downto 0); -- instruction out |
d_req_i : in std_logic; -- request access in next cycle |
d_rw_i : in std_logic; -- read/write |
d_adr_i : in std_logic_vector(15 downto 0); -- data adr |
d_dat_i : in std_logic_vector(15 downto 0); -- data in |
d_dat_o : out std_logic_vector(15 downto 0); -- data out |
mem_ip_adr_i : in std_logic_vector(15 downto 0); -- instruction page |
mem_dp_adr_i : in std_logic_vector(15 downto 0); -- data page |
|
-- Boot ROM Interface -- |
BOOT_I_ADR_O : out std_logic_vector(15 downto 0); -- instruction adr |
BOOT_I_EN_O : out std_logic; -- IR update |
BOOT_I_DAT_I : in std_logic_vector(15 downto 0); -- instruction out |
BOOT_D_EN_O : out std_logic; -- access enable |
BOOT_D_RW_O : out std_logic; -- read/write |
BOOT_D_ADR_O : out std_logic_vector(15 downto 0); -- data adr |
BOOT_D_DAT_O : out std_logic_vector(15 downto 0); -- data in |
BOOT_D_DAT_I : in std_logic_vector(15 downto 0); -- data out |
-- boot rom interface -- |
boot_i_adr_o : out std_logic_vector(15 downto 0); -- instruction adr |
boot_i_dat_i : in std_logic_vector(15 downto 0); -- instruction out |
boot_d_en_o : out std_logic; -- access enable |
boot_d_rw_o : out std_logic; -- read/write |
boot_d_adr_o : out std_logic_vector(15 downto 0); -- data adr |
boot_d_dat_o : out std_logic_vector(15 downto 0); -- data in |
boot_d_dat_i : in std_logic_vector(15 downto 0); -- data out |
|
-- Memory Interface -- |
MEM_I_PAGE_O : out std_logic_vector(15 downto 0); -- instruction page |
MEM_I_ADR_O : out std_logic_vector(15 downto 0); -- instruction adr |
MEM_I_EN_O : out std_logic; -- IR update |
MEM_I_DAT_I : in std_logic_vector(15 downto 0); -- instruction out |
MEM_D_EN_O : out std_logic; -- access enable |
MEM_D_RW_O : out std_logic; -- read/write |
MEM_D_PAGE_O : out std_logic_vector(15 downto 0); -- data page |
MEM_D_ADR_O : out std_logic_vector(15 downto 0); -- data adr |
MEM_D_DAT_O : out std_logic_vector(15 downto 0); -- data in |
MEM_D_DAT_I : in std_logic_vector(15 downto 0) -- data out |
); |
-- memory interface -- |
mem_i_page_o : out std_logic_vector(15 downto 0); -- instruction page |
mem_i_adr_o : out std_logic_vector(15 downto 0); -- instruction adr |
mem_i_dat_i : in std_logic_vector(15 downto 0); -- instruction out |
mem_d_en_o : out std_logic; -- access enable |
mem_d_rw_o : out std_logic; -- read/write |
mem_d_page_o : out std_logic_vector(15 downto 0); -- data page |
mem_d_adr_o : out std_logic_vector(15 downto 0); -- data adr |
mem_d_dat_o : out std_logic_vector(15 downto 0); -- data in |
mem_d_dat_i : in std_logic_vector(15 downto 0) -- data out |
); |
end component; |
|
|
-- Component: Bootloader Memory ----------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component BOOT_MEM |
port ( |
-- Host Interface -- |
CLK_I : in std_logic; -- global clock line |
I_ADR_I : in std_logic_vector(15 downto 0); -- instruction adr |
I_EN_I : in std_logic; -- IR update |
I_DAT_O : out std_logic_vector(15 downto 0); -- instruction out |
D_EN_I : in std_logic; -- access enable |
D_RW_I : in std_logic; -- read/write |
D_ADR_I : in std_logic_vector(15 downto 0); -- data adr |
D_DAT_I : in std_logic_vector(15 downto 0); -- data in |
D_DAT_O : out std_logic_vector(15 downto 0) -- data out |
); |
component boot_mem |
port ( |
-- host interface -- |
clk_i : in std_logic; -- global clock line |
i_adr_i : in std_logic_vector(15 downto 0); -- instruction adr |
i_dat_o : out std_logic_vector(15 downto 0); -- instruction out |
d_en_i : in std_logic; -- access enable |
d_rw_i : in std_logic; -- read/write |
d_adr_i : in std_logic_vector(15 downto 0); -- data adr |
d_dat_i : in std_logic_vector(15 downto 0); -- data in |
d_dat_o : out std_logic_vector(15 downto 0) -- data out |
); |
end component; |
|
end atlas_core_package; |
810,16 → 810,16
|
-- Function: Logarithm Base 2 ------------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
function log2(temp : natural) return natural is |
variable result : natural; |
begin |
for i in 0 to integer'high loop |
if (2**i >= temp) then |
return i; |
end if; |
end loop; |
return 0; |
end function log2; |
function log2(temp : natural) return natural is |
variable result : natural; |
begin |
for i in 0 to integer'high loop |
if (2**i >= temp) then |
return i; |
end if; |
end loop; |
return 0; |
end function log2; |
|
|
end atlas_core_package; |
/atlas_core/trunk/rtl/COM_0_CORE.vhd
6,7 → 6,7
-- # -> Parallel IO (16 in, 16 out) # |
-- # -> System IO (8 in, 8 out) # |
-- # ***************************************************** # |
-- # Last modified: 11.05.2014 # |
-- # Last modified: 28.11.2014 # |
-- # ***************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################### |
18,476 → 18,476
library work; |
use work.atlas_core_package.all; |
|
entity COM_0_CORE is |
port ( |
entity com_0_core is |
port ( |
-- ############################################################################################### |
-- ## Host Interface ## |
-- ############################################################################################### |
|
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
ICE_I : in std_logic; -- interface clock enable, high-active |
W_EN_I : in std_logic; -- write enable |
R_EN_I : in std_logic; -- read enable |
ADR_I : in std_logic_vector(02 downto 0); -- access address |
DAT_I : in std_logic_vector(15 downto 0); -- write data |
DAT_O : out std_logic_vector(15 downto 0); -- read data |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
ice_i : in std_logic; -- interface clock enable, high-active |
w_en_i : in std_logic; -- write enable |
r_en_i : in std_logic; -- read enable |
adr_i : in std_logic_vector(02 downto 0); -- access address |
dat_i : in std_logic_vector(15 downto 0); -- write data |
dat_o : out std_logic_vector(15 downto 0); -- read data |
|
-- ############################################################################################### |
-- ## Interrupt Lines ## |
-- ############################################################################################### |
|
UART_RX_IRQ_O : out std_logic; -- UART IRQ "data available" |
UART_TX_IRQ_O : out std_logic; -- UART IRQ "sending done" |
SPI_IRQ_O : out std_logic; -- SPI IRQ "transfer done" |
PIO_IRQ_O : out std_logic; -- PIO input pin change irq |
uart_rx_irq_o : out std_logic; -- uart irq "data available" |
uart_tx_irq_o : out std_logic; -- uart irq "sending done" |
spi_irq_o : out std_logic; -- spi irq "transfer done" |
pio_irq_o : out std_logic; -- pio input pin change irq |
|
-- ############################################################################################### |
-- ## Communication Lines ## |
-- ############################################################################################### |
|
UART_TXD_O : out std_logic; -- UART serial output |
UART_RXD_I : in std_logic; -- UART serial input |
SPI_MOSI_O : out std_logic_vector(07 downto 0); -- serial data out |
SPI_MISO_I : in std_logic_vector(07 downto 0); -- serial data in |
SPI_SCK_O : out std_logic_vector(07 downto 0); -- serial clock out |
SPI_CS_O : out std_logic_vector(07 downto 0); -- chip select (low active) |
PIO_IN_I : in std_logic_vector(15 downto 0); -- parallel input |
PIO_OUT_O : out std_logic_vector(15 downto 0); -- parallel output |
SYS_IO_I : in std_logic_vector(07 downto 0); -- system input |
SYS_IO_O : out std_logic_vector(07 downto 0) -- system output |
); |
end COM_0_CORE; |
uart_txd_o : out std_logic; -- uart serial output |
uart_rxd_i : in std_logic; -- uart serial input |
spi_mosi_o : out std_logic_vector(07 downto 0); -- serial data out |
spi_miso_i : in std_logic_vector(07 downto 0); -- serial data in |
spi_sck_o : out std_logic_vector(07 downto 0); -- serial clock out |
spi_cs_o : out std_logic_vector(07 downto 0); -- chip select (low active) |
pio_in_i : in std_logic_vector(15 downto 0); -- parallel input |
pio_out_o : out std_logic_vector(15 downto 0); -- parallel output |
sys_io_i : in std_logic_vector(07 downto 0); -- system input |
sys_io_o : out std_logic_vector(07 downto 0) -- system output |
); |
end com_0_core; |
|
architecture COM_0_CORE_BEHAV of COM_0_CORE is |
architecture com_0_core_behav of com_0_core is |
|
-- Module Addresses -- |
constant uart_rtx_sd_reg_c : std_logic_vector(02 downto 0) := "000"; -- R/W: UART RTX data + status flags |
constant uart_prsc_reg_c : std_logic_vector(02 downto 0) := "001"; -- R/W: UART prescaler register |
constant com_ctrl_reg_c : std_logic_vector(02 downto 0) := "010"; -- R/W: COM control register |
constant spi_data_reg_c : std_logic_vector(02 downto 0) := "011"; -- R/W: SPI RTX data register |
constant spi_cs_reg_c : std_logic_vector(02 downto 0) := "100"; -- R/W: SPI chip select register |
constant pio_in_reg_c : std_logic_vector(02 downto 0) := "101"; -- R: PIO input register |
constant pio_out_reg_c : std_logic_vector(02 downto 0) := "110"; -- R/W: PIO output register |
constant sys_io_reg_c : std_logic_vector(02 downto 0) := "111"; -- R/W: System parallel in/out |
-- Module Addresses -- |
constant uart_rtx_sd_reg_c : std_logic_vector(02 downto 0) := "000"; -- R/W: UART RTX data + status flags |
constant uart_prsc_reg_c : std_logic_vector(02 downto 0) := "001"; -- R/W: UART prescaler register |
constant com_ctrl_reg_c : std_logic_vector(02 downto 0) := "010"; -- R/W: COM control register |
constant spi_data_reg_c : std_logic_vector(02 downto 0) := "011"; -- R/W: SPI RTX data register |
constant spi_cs_reg_c : std_logic_vector(02 downto 0) := "100"; -- R/W: SPI chip select register |
constant pio_in_reg_c : std_logic_vector(02 downto 0) := "101"; -- R: PIO input register |
constant pio_out_reg_c : std_logic_vector(02 downto 0) := "110"; -- R/W: PIO output register |
constant sys_io_reg_c : std_logic_vector(02 downto 0) := "111"; -- R/W: System parallel in/out |
|
-- CTRL Register -- |
constant spi_cr_dir_flag_c : natural := 0; -- R/W: 0: MSB first, 1: LSB first |
constant spi_cr_cpol_c : natural := 1; -- R/W: clock polarity, 1: idle '1' clock, 0: idle '0' clock |
constant spi_cr_cpha_c : natural := 2; -- R/W: edge offset: 0: first edge, 1: second edge |
constant spi_cr_bsy_c : natural := 3; -- R: transceiver is busy when '1' |
constant spi_cr_auto_cs_c : natural := 4; -- R/W: Auto apply CS when '1' |
constant uart_tx_busy_c : natural := 5; -- R: UART transmitter is busy |
constant uart_en_c : natural := 6; -- R/W: UART enable |
constant uart_ry_ovf_c : natural := 7; -- R: UART Rx overflow corruption |
constant spi_cr_ln_lsb_c : natural := 8; -- R/W: data length lsb |
constant spi_cr_ln_msb_c : natural := 11; -- R/W: data length msb |
constant spi_cr_prsc_lsb_c : natural := 12; -- R/W: SPI clock prescaler lsb |
constant spi_cr_prsc_msb_c : natural := 15; -- R/W: SPI clock prescaler msb |
-- CTRL Register -- |
constant spi_cr_dir_flag_c : natural := 0; -- R/W: 0: MSB first, 1: LSB first |
constant spi_cr_cpol_c : natural := 1; -- R/W: clock polarity, 1: idle '1' clock, 0: idle '0' clock |
constant spi_cr_cpha_c : natural := 2; -- R/W: edge offset: 0: first edge, 1: second edge |
constant spi_cr_bsy_c : natural := 3; -- R: transceiver is busy when '1' |
constant spi_cr_auto_cs_c : natural := 4; -- R/W: Auto apply CS when '1' |
constant uart_tx_busy_c : natural := 5; -- R: UART transmitter is busy |
constant uart_en_c : natural := 6; -- R/W: UART enable |
constant uart_ry_ovf_c : natural := 7; -- R: UART Rx overflow corruption |
constant spi_cr_ln_lsb_c : natural := 8; -- R/W: data length lsb |
constant spi_cr_ln_msb_c : natural := 11; -- R/W: data length msb |
constant spi_cr_prsc_lsb_c : natural := 12; -- R/W: SPI clock prescaler lsb |
constant spi_cr_prsc_msb_c : natural := 15; -- R/W: SPI clock prescaler msb |
|
-- UART Control Flags (UART RTX REG) -- |
constant uart_rx_ready_c : natural := 15; -- R: Data received |
-- UART Control Flags (UART RTX REG) -- |
constant uart_rx_ready_c : natural := 15; -- R: Data received |
|
-- UART Registers -- |
signal UART_RX_REG : std_logic_vector(07 downto 0); |
signal UART_PRSC_REG : std_logic_vector(15 downto 0); |
-- uart registers -- |
signal uart_rx_reg : std_logic_vector(07 downto 0); |
signal uart_prsc_reg : std_logic_vector(15 downto 0); |
|
-- UART Transceiver -- |
signal UART_RX_SYNC : std_logic_vector(03 downto 0); |
signal UART_TX_BSY_FLAG : std_logic; |
signal UART_DCOR_FLAG : std_logic; |
signal UART_RX_BSY_FLAG : std_logic; |
signal UART_TX_SREG : std_logic_vector(09 downto 0); |
signal UART_RX_SREG : std_logic_vector(09 downto 0); |
signal UART_TX_BIT_CNT : std_logic_vector(03 downto 0); |
signal UART_RX_BIT_CNT : std_logic_vector(03 downto 0); |
signal UART_TX_BAUD_CNT : std_logic_vector(15 downto 0); |
signal UART_RX_BAUD_CNT : std_logic_vector(15 downto 0); |
signal UART_RX_READY : std_logic; |
signal UART_RX_READY_SYNC : std_logic; |
-- uart transceiver -- |
signal uart_rx_sync : std_logic_vector(03 downto 0); |
signal uart_tx_bsy_flag : std_logic; |
signal uart_dcor_flag : std_logic; |
signal uart_rx_bsy_flag : std_logic; |
signal uart_tx_sreg : std_logic_vector(09 downto 0); |
signal uart_rx_sreg : std_logic_vector(09 downto 0); |
signal uart_tx_bit_cnt : std_logic_vector(03 downto 0); |
signal uart_rx_bit_cnt : std_logic_vector(03 downto 0); |
signal uart_tx_baud_cnt : std_logic_vector(15 downto 0); |
signal uart_rx_baud_cnt : std_logic_vector(15 downto 0); |
signal uart_rx_ready : std_logic; |
signal uart_rx_ready_sync : std_logic; |
|
-- SPI Registers -- |
signal SPI_TX_REG : std_logic_vector(15 downto 0); |
signal SPI_RX_REG : std_logic_vector(15 downto 0); |
signal SPI_RX_REG_NXT : std_logic_vector(15 downto 0); |
signal SPI_CS_REG : std_logic_vector(07 downto 0); |
signal COM_CONFIG_REG : std_logic_vector(15 downto 0); |
-- spi registers -- |
signal spi_tx_reg : std_logic_vector(15 downto 0); |
signal spi_rx_reg : std_logic_vector(15 downto 0); |
signal spi_rx_reg_nxt : std_logic_vector(15 downto 0); |
signal spi_cs_reg : std_logic_vector(07 downto 0); |
signal com_config_reg : std_logic_vector(15 downto 0); |
|
-- SPI Transceiver -- |
signal SPI_IN_BUF : std_logic_vector(01 downto 0); |
signal SPI_MOSI_NXT : std_logic; |
signal SPI_SCK_NXT : std_logic; |
signal SPI_MOSI_FF : std_logic; |
signal SPI_CS_FF : std_logic_vector(07 downto 0); |
signal SPI_CS_FF_NXT : std_logic_vector(07 downto 0); |
signal SPI_IRQ : std_logic; |
-- spi transceiver -- |
signal spi_in_buf : std_logic_vector(01 downto 0); |
signal spi_mosi_nxt : std_logic; |
signal spi_sck_nxt : std_logic; |
signal spi_mosi_ff : std_logic; |
signal spi_cs_ff : std_logic_vector(07 downto 0); |
signal spi_cs_ff_nxt : std_logic_vector(07 downto 0); |
signal spi_irq : std_logic; |
|
-- SPI Arbiter -- |
type spi_arb_state_type is (IDLE, START_TRANS, TRANSMIT_0, TRANSMIT_1, FINISH); |
signal SPI_ARB_STATE : spi_arb_state_type; |
signal SPI_ARB_STATE_NXT : spi_arb_state_type; |
signal SPI_BIT_CNT : std_logic_vector(04 downto 0); |
signal SPI_BIT_CNT_NXT : std_logic_vector(04 downto 0); |
signal SPI_RX_SFT : std_logic_vector(15 downto 0); -- rx shift registers |
signal SPI_RX_SFT_NXT : std_logic_vector(15 downto 0); -- rx shift registers |
signal SPI_TX_SFT : std_logic_vector(15 downto 0); -- tx shift registers |
signal SPI_TX_SFT_NXT : std_logic_vector(15 downto 0); -- tx shift registers |
signal SPI_PRSC_CNT : std_logic_vector(15 downto 0); |
signal SPI_PRSC_CNT_NXT : std_logic_vector(15 downto 0); |
signal SPI_BUSY_FLAG : std_logic; |
signal SPI_BUSY_FLAG_NXT : std_logic; |
signal SPI_SCK_FF : std_logic; |
signal SPI_MISO : std_logic; |
-- spi arbiter -- |
type spi_arb_state_type is (idle, start_trans, transmit_0, transmit_1, finish); |
signal spi_arb_state : spi_arb_state_type; |
signal spi_arb_state_nxt : spi_arb_state_type; |
signal spi_bit_cnt : std_logic_vector(04 downto 0); |
signal spi_bit_cnt_nxt : std_logic_vector(04 downto 0); |
signal spi_rx_sft : std_logic_vector(15 downto 0); -- rx shift registers |
signal spi_rx_sft_nxt : std_logic_vector(15 downto 0); -- rx shift registers |
signal spi_tx_sft : std_logic_vector(15 downto 0); -- tx shift registers |
signal spi_tx_sft_nxt : std_logic_vector(15 downto 0); -- tx shift registers |
signal spi_prsc_cnt : std_logic_vector(15 downto 0); |
signal spi_prsc_cnt_nxt : std_logic_vector(15 downto 0); |
signal spi_busy_flag : std_logic; |
signal spi_busy_flag_nxt : std_logic; |
signal spi_sck_ff : std_logic; |
signal spi_miso : std_logic; |
|
-- PIO Registers -- |
signal PIO_OUT_DATA : std_logic_vector(15 downto 0); |
signal PIO_IN_DATA : std_logic_vector(15 downto 0); |
signal PIO_SYNC : std_logic_vector(15 downto 0); |
signal SYS_IO_I_FF : std_logic_vector(07 downto 0); |
signal SYS_IO_O_FF : std_logic_vector(07 downto 0); |
-- pio registers -- |
signal pio_out_data : std_logic_vector(15 downto 0); |
signal pio_in_data : std_logic_vector(15 downto 0); |
signal pio_sync : std_logic_vector(15 downto 0); |
signal sys_io_i_ff : std_logic_vector(07 downto 0); |
signal sys_io_o_ff : std_logic_vector(07 downto 0); |
|
begin |
|
-- Write Access ---------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
W_ACC: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
UART_PRSC_REG <= (others => '0'); |
COM_CONFIG_REG <= (others => '0'); |
SPI_TX_REG <= (others => '0'); |
SPI_CS_REG <= (others => '0'); |
PIO_IN_DATA <= (others => '0'); |
PIO_OUT_DATA <= (others => '0'); |
PIO_SYNC <= (others => '0'); |
SYS_IO_O_FF <= (others => '0'); |
SYS_IO_I_FF <= (others => '0'); |
elsif (ICE_I = '1') then -- interface enable |
if (W_EN_I = '1') then -- register update |
case (ADR_I) is |
when uart_prsc_reg_c => UART_PRSC_REG <= DAT_I; |
when com_ctrl_reg_c => COM_CONFIG_REG <= DAT_I; |
when spi_data_reg_c => SPI_TX_REG <= DAT_I; |
when spi_cs_reg_c => SPI_CS_REG <= DAT_I(07 downto 00); |
when pio_out_reg_c => PIO_OUT_DATA <= DAT_I; |
when sys_io_reg_c => SYS_IO_O_FF <= DAT_I(15 downto 08); |
when others => NULL; |
end case; |
end if; |
end if; |
PIO_SYNC <= PIO_IN_DATA; |
PIO_IN_DATA <= PIO_IN_I; -- pio input |
SYS_IO_I_FF <= SYS_IO_I; |
end if; |
end process W_ACC; |
-- Write Access ---------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
w_acc: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
uart_prsc_reg <= (others => '0'); |
com_config_reg <= (others => '0'); |
spi_tx_reg <= (others => '0'); |
spi_cs_reg <= (others => '0'); |
pio_in_data <= (others => '0'); |
pio_out_data <= (others => '0'); |
pio_sync <= (others => '0'); |
sys_io_o_ff <= (others => '0'); |
sys_io_i_ff <= (others => '0'); |
elsif (ice_i = '1') then -- interface enable |
if (w_en_i = '1') then -- register update |
case (adr_i) is |
when uart_prsc_reg_c => uart_prsc_reg <= dat_i; |
when com_ctrl_reg_c => com_config_reg <= dat_i; |
when spi_data_reg_c => spi_tx_reg <= dat_i; |
when spi_cs_reg_c => spi_cs_reg <= dat_i(07 downto 00); |
when pio_out_reg_c => pio_out_data <= dat_i; |
when sys_io_reg_c => sys_io_o_ff <= dat_i(15 downto 08); |
when others => null; |
end case; |
end if; |
end if; |
pio_sync <= pio_in_data; |
pio_in_data <= pio_in_i; -- pio input |
sys_io_i_ff <= sys_io_i; |
end if; |
end process w_acc; |
|
-- Output -- |
PIO_OUT_O <= PIO_OUT_DATA; |
SYS_IO_O <= SYS_IO_O_FF; |
-- output -- |
pio_out_o <= pio_out_data; |
sys_io_o <= sys_io_o_ff; |
|
-- PIO Input pin change IRQ -- |
PIO_IRQ_O <= '0' when (PIO_SYNC = PIO_IN_DATA) else '1'; |
-- pio input pin change irq -- |
pio_irq_o <= '0' when (pio_sync = pio_in_data) else '1'; |
|
|
|
-- Read Access ----------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
R_ACC: process(ADR_I, UART_TX_BSY_FLAG, UART_RX_READY, UART_RX_REG, UART_PRSC_REG, COM_CONFIG_REG, SYS_IO_O_FF, |
SPI_BUSY_FLAG, SPI_CS_REG, SPI_RX_REG, PIO_OUT_DATA, PIO_IN_DATA, SYS_IO_I_FF, UART_DCOR_FLAG) |
begin |
case (ADR_I) is |
when uart_rtx_sd_reg_c => DAT_O <= (others => '0'); |
DAT_O(7 downto 0) <= UART_RX_REG; |
DAT_O(uart_rx_ready_c) <= UART_RX_READY; |
when uart_prsc_reg_c => DAT_O <= UART_PRSC_REG; |
when com_ctrl_reg_c => DAT_O <= COM_CONFIG_REG; |
DAT_O(spi_cr_bsy_c) <= SPI_BUSY_FLAG; |
DAT_O(uart_tx_busy_c) <= UART_TX_BSY_FLAG; |
DAT_O(uart_ry_ovf_c) <= UART_DCOR_FLAG; |
when spi_data_reg_c => DAT_O <= SPI_RX_REG; |
when spi_cs_reg_c => DAT_O <= x"00" & SPI_CS_REG; |
when pio_in_reg_c => DAT_O <= PIO_IN_DATA; |
when pio_out_reg_c => DAT_O <= PIO_OUT_DATA; |
when sys_io_reg_c => DAT_O <= SYS_IO_O_FF & SYS_IO_I_FF; |
when others => DAT_O <= x"0000"; |
end case; |
end process R_ACC; |
-- Read Access ----------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
r_acc: process(adr_i, uart_tx_bsy_flag, uart_rx_ready, uart_rx_reg, uart_prsc_reg, com_config_reg, sys_io_o_ff, |
spi_busy_flag, spi_cs_reg, spi_rx_reg, pio_out_data, pio_in_data, sys_io_i_ff, uart_dcor_flag) |
begin |
case (adr_i) is |
when uart_rtx_sd_reg_c => dat_o <= (others => '0'); |
dat_o(7 downto 0) <= uart_rx_reg; |
dat_o(uart_rx_ready_c) <= uart_rx_ready; |
when uart_prsc_reg_c => dat_o <= uart_prsc_reg; |
when com_ctrl_reg_c => dat_o <= com_config_reg; |
dat_o(spi_cr_bsy_c) <= spi_busy_flag; |
dat_o(uart_tx_busy_c) <= uart_tx_bsy_flag; |
dat_o(uart_ry_ovf_c) <= uart_dcor_flag; |
when spi_data_reg_c => dat_o <= spi_rx_reg; |
when spi_cs_reg_c => dat_o <= x"00" & spi_cs_reg; |
when pio_in_reg_c => dat_o <= pio_in_data; |
when pio_out_reg_c => dat_o <= pio_out_data; |
when sys_io_reg_c => dat_o <= sys_io_o_ff & sys_io_i_ff; |
when others => dat_o <= x"0000"; |
end case; |
end process r_acc; |
|
|
|
-- UART Flag Arbiter ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
UART_FLAG_CTRL: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
UART_RX_READY <= '0'; |
UART_RX_READY_SYNC <= '0'; |
UART_DCOR_FLAG <= '0'; |
else |
-- Ready flag and corruption flag -- |
UART_RX_READY_SYNC <= UART_RX_BSY_FLAG; |
if (UART_RX_READY = '1') and (R_EN_I = '1') and (ADR_I = uart_rtx_sd_reg_c) and (ICE_I = '1') then |
UART_RX_READY <= '0'; |
UART_DCOR_FLAG <= '0'; |
elsif (UART_RX_READY_SYNC = '1') and (UART_RX_BSY_FLAG = '0') then -- falling edge |
UART_RX_READY <= '1'; |
UART_DCOR_FLAG <= UART_RX_READY; |
end if; |
end if; |
end if; |
end process UART_FLAG_CTRL; |
-- UART Flag Arbiter ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
uart_flag_ctrl: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
uart_rx_ready <= '0'; |
uart_rx_ready_sync <= '0'; |
uart_dcor_flag <= '0'; |
else |
-- ready flag and corruption flag -- |
uart_rx_ready_sync <= uart_rx_bsy_flag; |
if (uart_rx_ready = '1') and (r_en_i = '1') and (adr_i = uart_rtx_sd_reg_c) and (ice_i = '1') then |
uart_rx_ready <= '0'; |
uart_dcor_flag <= '0'; |
elsif (uart_rx_ready_sync = '1') and (uart_rx_bsy_flag = '0') then -- falling edge |
uart_rx_ready <= '1'; |
uart_dcor_flag <= uart_rx_ready; |
end if; |
end if; |
end if; |
end process uart_flag_ctrl; |
|
-- Interrupt output -- |
UART_RX_IRQ_O <= UART_RX_READY; |
UART_TX_IRQ_O <= not UART_TX_BSY_FLAG; |
-- interrupt output -- |
uart_rx_irq_o <= uart_rx_ready; |
uart_tx_irq_o <= not uart_tx_bsy_flag; |
|
|
|
-- Transmitter Unit ------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
UART_TRANSMITTER: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
UART_TX_BSY_FLAG <= '0'; |
UART_TX_SREG <= (others => '1'); |
UART_TX_BIT_CNT <= (others => '0'); |
UART_TX_BAUD_CNT <= (others => '0'); |
else |
-- UART disabled |
if (COM_CONFIG_REG(uart_en_c) = '0') then |
UART_TX_BSY_FLAG <= '0'; |
UART_TX_SREG <= (others => '1'); |
UART_TX_BIT_CNT <= (others => '0'); |
UART_TX_BAUD_CNT <= (others => '0'); |
-- Transmitter Unit ------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
uart_transmitter: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
uart_tx_bsy_flag <= '0'; |
uart_tx_sreg <= (others => '1'); |
uart_tx_bit_cnt <= (others => '0'); |
uart_tx_baud_cnt <= (others => '0'); |
else |
-- uart disabled |
if (com_config_reg(uart_en_c) = '0') then |
uart_tx_bsy_flag <= '0'; |
uart_tx_sreg <= (others => '1'); |
uart_tx_bit_cnt <= (others => '0'); |
uart_tx_baud_cnt <= (others => '0'); |
|
-- UART TX register -- |
elsif (UART_TX_BSY_FLAG = '0') then |
UART_TX_BIT_CNT <= "1010"; -- 10 bits |
UART_TX_BAUD_CNT <= UART_PRSC_REG; |
if (W_EN_I = '1') and (ADR_I = uart_rtx_sd_reg_c) then |
UART_TX_BSY_FLAG <= '1'; |
UART_TX_SREG <= '1' & DAT_I(7 downto 0) & '0'; -- stopbit & data & startbit |
end if; |
else |
if (UART_TX_BAUD_CNT = x"0000") then |
UART_TX_BAUD_CNT <= UART_PRSC_REG; |
if (UART_TX_BIT_CNT /= "0000") then |
UART_TX_SREG <= '1' & UART_TX_SREG(9 downto 1); |
UART_TX_BIT_CNT <= std_logic_vector(unsigned(UART_TX_BIT_CNT) - 1); |
else |
UART_TX_BSY_FLAG <= '0'; -- done |
end if; |
else |
UART_TX_BAUD_CNT <= std_logic_vector(unsigned(UART_TX_BAUD_CNT) - 1); |
end if; |
end if; |
end if; |
end if; |
end process UART_TRANSMITTER; |
-- uart tx register -- |
elsif (uart_tx_bsy_flag = '0') then |
uart_tx_bit_cnt <= "1010"; -- 10 bits |
uart_tx_baud_cnt <= uart_prsc_reg; |
if (w_en_i = '1') and (adr_i = uart_rtx_sd_reg_c) then |
uart_tx_bsy_flag <= '1'; |
uart_tx_sreg <= '1' & dat_i(7 downto 0) & '0'; -- stopbit & data & startbit |
end if; |
else |
if (uart_tx_baud_cnt = x"0000") then |
uart_tx_baud_cnt <= uart_prsc_reg; |
if (uart_tx_bit_cnt /= "0000") then |
uart_tx_sreg <= '1' & uart_tx_sreg(9 downto 1); |
uart_tx_bit_cnt <= std_logic_vector(unsigned(uart_tx_bit_cnt) - 1); |
else |
uart_tx_bsy_flag <= '0'; -- done |
end if; |
else |
uart_tx_baud_cnt <= std_logic_vector(unsigned(uart_tx_baud_cnt) - 1); |
end if; |
end if; |
end if; |
end if; |
end process uart_transmitter; |
|
-- Transmitter output -- |
UART_TXD_O <= UART_TX_SREG(0); |
-- transmitter output -- |
uart_txd_o <= uart_tx_sreg(0); |
|
|
|
-- UART Receiver Unit ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
UART_RECEIVER: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
UART_RX_BSY_FLAG <= '0'; |
UART_RX_SREG <= (others => '0'); |
UART_RX_BIT_CNT <= (others => '0'); |
UART_RX_BAUD_CNT <= (others => '0'); |
UART_RX_SYNC <= (others => '1'); |
UART_RX_REG <= (others => '0'); |
else |
-- Synchronizer -- |
if (COM_CONFIG_REG(uart_en_c) = '1') then |
UART_RX_SYNC <= UART_RXD_I & UART_RX_SYNC(3 downto 1); |
end if; |
-- UART Receiver Unit ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
uart_receiver: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
uart_rx_bsy_flag <= '0'; |
uart_rx_sreg <= (others => '0'); |
uart_rx_bit_cnt <= (others => '0'); |
uart_rx_baud_cnt <= (others => '0'); |
uart_rx_sync <= (others => '1'); |
uart_rx_reg <= (others => '0'); |
else |
-- synchronizer -- |
if (com_config_reg(uart_en_c) = '1') then |
uart_rx_sync <= uart_rxd_i & uart_rx_sync(3 downto 1); |
end if; |
|
-- UART disabled -- |
if (COM_CONFIG_REG(uart_en_c) = '0') then |
UART_RX_BSY_FLAG <= '0'; |
UART_RX_SREG <= (others => '0'); |
UART_RX_BIT_CNT <= (others => '0'); |
UART_RX_BAUD_CNT <= (others => '0'); |
UART_RX_SYNC <= (others => '1'); |
UART_RX_REG <= (others => '0'); |
|
-- RX shift reg -- |
elsif (UART_RX_BSY_FLAG = '0') then |
UART_RX_BIT_CNT <= "1001"; -- 9 bits (startbit + 8 data bits) |
UART_RX_BAUD_CNT <= '0' & UART_PRSC_REG(15 downto 1); -- half baud rate, sample in middle |
if (UART_RX_SYNC(1 downto 0) = "01") then -- start 'bit' detected (falling logical edge) |
UART_RX_BSY_FLAG <= '1'; |
end if; |
else |
if (UART_RX_BAUD_CNT = x"0000") then |
UART_RX_BAUD_CNT <= UART_PRSC_REG; |
if (UART_RX_BIT_CNT /= "0000") then |
UART_RX_SREG <= UART_RX_SYNC(0) & UART_RX_SREG(9 downto 1); |
UART_RX_BIT_CNT <= std_logic_vector(unsigned(UART_RX_BIT_CNT) - 1); |
else |
UART_RX_BSY_FLAG <= '0'; -- done |
UART_RX_REG <= UART_RX_SREG(9 downto 2); |
end if; |
else |
UART_RX_BAUD_CNT <= std_logic_vector(unsigned(UART_RX_BAUD_CNT) - 1); |
end if; |
end if; |
end if; |
end if; |
end process UART_RECEIVER; |
-- uart disabled -- |
if (com_config_reg(uart_en_c) = '0') then |
uart_rx_bsy_flag <= '0'; |
uart_rx_sreg <= (others => '0'); |
uart_rx_bit_cnt <= (others => '0'); |
uart_rx_baud_cnt <= (others => '0'); |
uart_rx_sync <= (others => '1'); |
uart_rx_reg <= (others => '0'); |
|
-- rx shift reg -- |
elsif (uart_rx_bsy_flag = '0') then |
uart_rx_bit_cnt <= "1001"; -- 9 bits (startbit + 8 data bits) |
uart_rx_baud_cnt <= '0' & uart_prsc_reg(15 downto 1); -- half baud rate, sample in middle |
if (uart_rx_sync(1 downto 0) = "01") then -- start 'bit' detected (falling logical edge) |
uart_rx_bsy_flag <= '1'; |
end if; |
else |
if (uart_rx_baud_cnt = x"0000") then |
uart_rx_baud_cnt <= uart_prsc_reg; |
if (uart_rx_bit_cnt /= "0000") then |
uart_rx_sreg <= uart_rx_sync(0) & uart_rx_sreg(9 downto 1); |
uart_rx_bit_cnt <= std_logic_vector(unsigned(uart_rx_bit_cnt) - 1); |
else |
uart_rx_bsy_flag <= '0'; -- done |
uart_rx_reg <= uart_rx_sreg(9 downto 2); |
end if; |
else |
uart_rx_baud_cnt <= std_logic_vector(unsigned(uart_rx_baud_cnt) - 1); |
end if; |
end if; |
end if; |
end if; |
end process uart_receiver; |
|
|
|
-- SPI Transceiver Unit -------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
SPI_ARB_SYNC: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
SPI_ARB_STATE <= IDLE; |
SPI_RX_SFT <= (others => '0'); |
SPI_TX_SFT <= (others => '0'); |
SPI_BIT_CNT <= (others => '0'); |
SPI_PRSC_CNT <= (others => '0'); |
SPI_RX_REG <= (others => '0'); |
SPI_SCK_FF <= '0'; |
SPI_MOSI_FF <= '0'; |
SPI_IN_BUF <= "00"; |
SPI_CS_FF <= (others => '1'); |
SPI_BUSY_FLAG <= '0'; |
SPI_IRQ_O <= '0'; |
else |
SPI_ARB_STATE <= SPI_ARB_STATE_NXT; |
SPI_RX_SFT <= SPI_RX_SFT_NXT; |
SPI_TX_SFT <= SPI_TX_SFT_NXT; |
SPI_BIT_CNT <= SPI_BIT_CNT_NXT; |
SPI_PRSC_CNT <= SPI_PRSC_CNT_NXT; |
SPI_RX_REG <= SPI_RX_REG_NXT; |
SPI_SCK_FF <= SPI_SCK_NXT; |
SPI_MOSI_FF <= SPI_MOSI_NXT; |
SPI_IN_BUF <= SPI_IN_BUF(0) & SPI_MISO; |
if (COM_CONFIG_REG(spi_cr_auto_cs_c) = '1') then -- auto apply chip select |
SPI_CS_FF <= SPI_CS_FF_NXT; |
else -- manually apply chip select |
SPI_CS_FF <= not SPI_CS_REG; |
end if; |
SPI_BUSY_FLAG <= SPI_BUSY_FLAG_NXT; |
SPI_IRQ_O <= SPI_IRQ; |
end if; |
end if; |
end process SPI_ARB_SYNC; |
-- SPI Transceiver Unit -------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
spi_arb_sync: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
spi_arb_state <= idle; |
spi_rx_sft <= (others => '0'); |
spi_tx_sft <= (others => '0'); |
spi_bit_cnt <= (others => '0'); |
spi_prsc_cnt <= (others => '0'); |
spi_rx_reg <= (others => '0'); |
spi_sck_ff <= '0'; |
spi_mosi_ff <= '0'; |
spi_in_buf <= "00"; |
spi_cs_ff <= (others => '1'); |
spi_busy_flag <= '0'; |
spi_irq_o <= '0'; |
else |
spi_arb_state <= spi_arb_state_nxt; |
spi_rx_sft <= spi_rx_sft_nxt; |
spi_tx_sft <= spi_tx_sft_nxt; |
spi_bit_cnt <= spi_bit_cnt_nxt; |
spi_prsc_cnt <= spi_prsc_cnt_nxt; |
spi_rx_reg <= spi_rx_reg_nxt; |
spi_sck_ff <= spi_sck_nxt; |
spi_mosi_ff <= spi_mosi_nxt; |
spi_in_buf <= spi_in_buf(0) & spi_miso; |
if (com_config_reg(spi_cr_auto_cs_c) = '1') then -- auto apply chip select |
spi_cs_ff <= spi_cs_ff_nxt; |
else -- manually apply chip select |
spi_cs_ff <= not spi_cs_reg; |
end if; |
spi_busy_flag <= spi_busy_flag_nxt; |
spi_irq_o <= spi_irq; |
end if; |
end if; |
end process spi_arb_sync; |
|
|
|
SPI_ARB_COMB: process(SPI_ARB_STATE, COM_CONFIG_REG, SPI_RX_SFT, SPI_TX_SFT, SPI_BIT_CNT, SPI_PRSC_CNT, SPI_IN_BUF, |
SPI_RX_REG, SPI_MOSI_FF, SPI_CS_FF, SPI_CS_REG, SPI_TX_REG, W_EN_I, ADR_I, SPI_BUSY_FLAG, ICE_I) |
variable prsc_match_v : std_logic; |
begin |
-- Defaults -- |
SPI_ARB_STATE_NXT <= SPI_ARB_STATE; -- arbiter state |
SPI_RX_SFT_NXT <= SPI_RX_SFT; -- rx shift register |
SPI_TX_SFT_NXT <= SPI_TX_SFT; -- tx shift register |
SPI_BIT_CNT_NXT <= SPI_BIT_CNT; -- bit counter |
SPI_PRSC_CNT_NXT <= SPI_PRSC_CNT; -- SPI clock prescaler |
SPI_RX_REG_NXT <= SPI_RX_REG; -- complete received data |
SPI_SCK_NXT <= COM_CONFIG_REG(spi_cr_cpol_c); -- clock polarity |
SPI_MOSI_NXT <= SPI_MOSI_FF; -- serial data output |
SPI_BUSY_FLAG_NXT <= SPI_BUSY_FLAG; -- busy flag |
SPI_IRQ <= '0'; -- no interrupt |
prsc_match_v := SPI_PRSC_CNT(to_integer(unsigned(COM_CONFIG_REG(spi_cr_prsc_msb_c downto spi_cr_prsc_lsb_c)))); -- prescaler match |
spi_arb_comb: process(spi_arb_state, com_config_reg, spi_rx_sft, spi_tx_sft, spi_bit_cnt, spi_prsc_cnt, spi_in_buf, |
spi_rx_reg, spi_mosi_ff, spi_cs_ff, spi_cs_reg, spi_tx_reg, w_en_i, adr_i, spi_busy_flag, ice_i) |
variable prsc_match_v : std_logic; |
begin |
-- defaults -- |
spi_arb_state_nxt <= spi_arb_state; -- arbiter state |
spi_rx_sft_nxt <= spi_rx_sft; -- rx shift register |
spi_tx_sft_nxt <= spi_tx_sft; -- tx shift register |
spi_bit_cnt_nxt <= spi_bit_cnt; -- bit counter |
spi_prsc_cnt_nxt <= spi_prsc_cnt; -- spi clock prescaler |
spi_rx_reg_nxt <= spi_rx_reg; -- complete received data |
spi_sck_nxt <= com_config_reg(spi_cr_cpol_c); -- clock polarity |
spi_mosi_nxt <= spi_mosi_ff; -- serial data output |
spi_busy_flag_nxt <= spi_busy_flag; -- busy flag |
spi_irq <= '0'; -- no interrupt |
prsc_match_v := spi_prsc_cnt(to_integer(unsigned(com_config_reg(spi_cr_prsc_msb_c downto spi_cr_prsc_lsb_c)))); -- prescaler match |
|
-- State machine -- |
case (SPI_ARB_STATE) is -- IDLE, START_TRANS, TRANSMIT, END_TRANS |
-- state machine -- |
case (spi_arb_state) is -- idle, start_trans, transmit, end_trans |
|
when IDLE => -- Wait for transmitter init |
SPI_CS_FF_NXT <= (others => '1'); -- deselct all slaves |
SPI_BIT_CNT_NXT <= (others => '0'); |
SPI_RX_SFT_NXT <= (others => '0'); |
SPI_PRSC_CNT_NXT <= (others => '0'); |
SPI_MOSI_NXT <= '0'; |
SPI_SCK_NXT <= COM_CONFIG_REG(spi_cr_cpol_c); -- idle clk polarity |
if (W_EN_I = '1') and (ADR_I = spi_data_reg_c) and (ICE_I = '1') then |
SPI_ARB_STATE_NXT <= START_TRANS; |
SPI_BUSY_FLAG_NXT <= '1'; |
end if; |
when idle => -- wait for transmitter init |
spi_cs_ff_nxt <= (others => '1'); -- deselct all slaves |
spi_bit_cnt_nxt <= (others => '0'); |
spi_rx_sft_nxt <= (others => '0'); |
spi_prsc_cnt_nxt <= (others => '0'); |
spi_mosi_nxt <= '0'; |
spi_sck_nxt <= com_config_reg(spi_cr_cpol_c); -- idle clk polarity |
if (w_en_i = '1') and (adr_i = spi_data_reg_c) and (ice_i = '1') then |
spi_arb_state_nxt <= start_trans; |
spi_busy_flag_nxt <= '1'; |
end if; |
|
when START_TRANS => -- Apply slave select signal |
SPI_TX_SFT_NXT <= SPI_TX_REG; |
SPI_CS_FF_NXT <= not SPI_CS_REG; |
SPI_ARB_STATE_NXT <= TRANSMIT_0; |
when start_trans => -- apply slave select signal |
spi_tx_sft_nxt <= spi_tx_reg; |
spi_cs_ff_nxt <= not spi_cs_reg; |
spi_arb_state_nxt <= transmit_0; |
|
when TRANSMIT_0 => -- first half of bit transmission |
SPI_CS_FF_NXT <= SPI_CS_FF; -- keep CS alive |
SPI_PRSC_CNT_NXT <= std_logic_vector(unsigned(SPI_PRSC_CNT) + 1); |
SPI_SCK_NXT <= COM_CONFIG_REG(spi_cr_cpol_c) xor COM_CONFIG_REG(spi_cr_cpha_c); |
if (COM_CONFIG_REG(spi_cr_dir_flag_c) = '0') then -- MSB first |
SPI_MOSI_NXT <= SPI_TX_SFT(to_integer(unsigned(COM_CONFIG_REG(spi_cr_ln_msb_c downto spi_cr_ln_lsb_c)))); |
else -- LSB first |
SPI_MOSI_NXT <= SPI_TX_SFT(0); |
end if; |
if (prsc_match_v = '1') then -- first half completed |
SPI_ARB_STATE_NXT <= TRANSMIT_1; |
SPI_PRSC_CNT_NXT <= (others => '0'); |
end if; |
when transmit_0 => -- first half of bit transmission |
spi_cs_ff_nxt <= spi_cs_ff; -- keep cs alive |
spi_prsc_cnt_nxt <= std_logic_vector(unsigned(spi_prsc_cnt) + 1); |
spi_sck_nxt <= com_config_reg(spi_cr_cpol_c) xor com_config_reg(spi_cr_cpha_c); |
if (com_config_reg(spi_cr_dir_flag_c) = '0') then -- msb first |
spi_mosi_nxt <= spi_tx_sft(to_integer(unsigned(com_config_reg(spi_cr_ln_msb_c downto spi_cr_ln_lsb_c)))); |
else -- lsb first |
spi_mosi_nxt <= spi_tx_sft(0); |
end if; |
if (prsc_match_v = '1') then -- first half completed |
spi_arb_state_nxt <= transmit_1; |
spi_prsc_cnt_nxt <= (others => '0'); |
end if; |
|
when TRANSMIT_1 => -- second half of bit transmission |
SPI_CS_FF_NXT <= SPI_CS_FF; -- keep CS alive |
SPI_PRSC_CNT_NXT <= std_logic_vector(unsigned(SPI_PRSC_CNT) + 1); |
SPI_SCK_NXT <= not (COM_CONFIG_REG(spi_cr_cpol_c) xor COM_CONFIG_REG(spi_cr_cpha_c)); |
if (prsc_match_v = '1') then -- second half completed |
SPI_BIT_CNT_NXT <= std_logic_vector(unsigned(SPI_BIT_CNT) + 1); |
SPI_PRSC_CNT_NXT <= (others => '0'); |
if (COM_CONFIG_REG(spi_cr_dir_flag_c) = '0') then -- MSB first |
SPI_TX_SFT_NXT <= SPI_TX_SFT(14 downto 0) & '0'; -- left shift |
SPI_RX_SFT_NXT <= SPI_RX_SFT(14 downto 0) & SPI_IN_BUF(1); -- left shift |
else -- LSB first |
SPI_TX_SFT_NXT <= '0' & SPI_TX_SFT(15 downto 1); -- right shift |
SPI_RX_SFT_NXT <= SPI_IN_BUF(1) & SPI_TX_SFT(15 downto 1); -- right shift |
end if; |
if (to_integer(unsigned(SPI_BIT_CNT)) = to_integer(unsigned(COM_CONFIG_REG(spi_cr_ln_msb_c downto spi_cr_ln_lsb_c)))) then |
SPI_ARB_STATE_NXT <= FINISH; |
else |
SPI_ARB_STATE_NXT <= TRANSMIT_0; |
end if; |
end if; |
when transmit_1 => -- second half of bit transmission |
spi_cs_ff_nxt <= spi_cs_ff; -- keep cs alive |
spi_prsc_cnt_nxt <= std_logic_vector(unsigned(spi_prsc_cnt) + 1); |
spi_sck_nxt <= not (com_config_reg(spi_cr_cpol_c) xor com_config_reg(spi_cr_cpha_c)); |
if (prsc_match_v = '1') then -- second half completed |
spi_bit_cnt_nxt <= std_logic_vector(unsigned(spi_bit_cnt) + 1); |
spi_prsc_cnt_nxt <= (others => '0'); |
if (com_config_reg(spi_cr_dir_flag_c) = '0') then -- msb first |
spi_tx_sft_nxt <= spi_tx_sft(14 downto 0) & '0'; -- left shift |
spi_rx_sft_nxt <= spi_rx_sft(14 downto 0) & spi_in_buf(1); -- left shift |
else -- lsb first |
spi_tx_sft_nxt <= '0' & spi_tx_sft(15 downto 1); -- right shift |
spi_rx_sft_nxt <= spi_in_buf(1) & spi_tx_sft(15 downto 1); -- right shift |
end if; |
if (to_integer(unsigned(spi_bit_cnt)) = to_integer(unsigned(com_config_reg(spi_cr_ln_msb_c downto spi_cr_ln_lsb_c)))) then |
spi_arb_state_nxt <= finish; |
else |
spi_arb_state_nxt <= transmit_0; |
end if; |
end if; |
|
when FINISH => -- finish transfer |
SPI_CS_FF_NXT <= SPI_CS_FF; -- keep CS alive |
SPI_BUSY_FLAG_NXT <= '0'; |
SPI_RX_REG_NXT <= SPI_RX_SFT; |
SPI_MOSI_NXT <= '0'; |
SPI_IRQ <= '1'; -- IRQ tick |
SPI_ARB_STATE_NXT <= IDLE; |
when finish => -- finish transfer |
spi_cs_ff_nxt <= spi_cs_ff; -- keep cs alive |
spi_busy_flag_nxt <= '0'; |
spi_rx_reg_nxt <= spi_rx_sft; |
spi_mosi_nxt <= '0'; |
spi_irq <= '1'; -- irq tick |
spi_arb_state_nxt <= idle; |
|
end case; |
end process SPI_ARB_COMB; |
end case; |
end process spi_arb_comb; |
|
|
-- SPI IO Interface -- |
SPI_IO: process(SPI_CS_FF, SPI_MOSI_FF, SPI_SCK_FF, SPI_MISO_I) |
variable spi_miso_bus_v : std_logic_vector(7 downto 0); |
variable spi_miso_v : std_logic; |
begin |
spi_miso_bus_v := SPI_MISO_I and (not SPI_CS_FF); |
spi_miso_v := '0'; |
for i in 0 to 7 loop -- for all channels |
SPI_MOSI_O(i) <= SPI_MOSI_FF and (not SPI_CS_FF(i)); |
SPI_CS_O(i) <= SPI_CS_FF(i); |
SPI_SCK_O(i) <= SPI_SCK_FF; |
spi_miso_v := spi_miso_v or spi_miso_bus_v(i); |
end loop; |
SPI_MISO <= spi_miso_v; |
end process SPI_IO; |
-- spi io interface -- |
spi_io: process(spi_cs_ff, spi_mosi_ff, spi_sck_ff, spi_miso_i) |
variable spi_miso_bus_v : std_logic_vector(7 downto 0); |
variable spi_miso_v : std_logic; |
begin |
spi_miso_bus_v := spi_miso_i and (not spi_cs_ff); |
spi_miso_v := '0'; |
for i in 0 to 7 loop -- for all channels |
spi_mosi_o(i) <= spi_mosi_ff and (not spi_cs_ff(i)); |
spi_cs_o(i) <= spi_cs_ff(i); |
spi_sck_o(i) <= spi_sck_ff; |
spi_miso_v := spi_miso_v or spi_miso_bus_v(i); |
end loop; |
spi_miso <= spi_miso_v; |
end process spi_io; |
|
|
|
end COM_0_CORE_BEHAV; |
end com_0_core_behav; |
/atlas_core/trunk/rtl/SYS_0_CORE.vhd
5,7 → 5,7
-- # -> High Precision Timer (16+16 bit) # |
-- # -> Linear-Feedback Shift Register (16 bit) # |
-- # ***************************************************** # |
-- # Last modified: 13.04.2014 # |
-- # Last modified: 28.11.2014 # |
-- # ***************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################### |
17,270 → 17,270
library work; |
use work.atlas_core_package.all; |
|
entity SYS_0_CORE is |
port ( |
entity sys_0_core is |
port ( |
-- ############################################################################################### |
-- ## Host Interface ## |
-- ############################################################################################### |
|
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
ICE_I : in std_logic; -- interface clock enable, high-active |
W_EN_I : in std_logic; -- write enable |
R_EN_I : in std_logic; -- read enable |
ADR_I : in std_logic_vector(02 downto 0); -- access address |
DAT_I : in std_logic_vector(15 downto 0); -- write data |
DAT_O : out std_logic_vector(15 downto 0); -- read data |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
ice_i : in std_logic; -- interface clock enable, high-active |
w_en_i : in std_logic; -- write enable |
r_en_i : in std_logic; -- read enable |
adr_i : in std_logic_vector(02 downto 0); -- access address |
dat_i : in std_logic_vector(15 downto 0); -- write data |
dat_o : out std_logic_vector(15 downto 0); -- read data |
|
-- ############################################################################################### |
-- ## Interrupt Lines ## |
-- ############################################################################################### |
|
TIMER_IRQ_O : out std_logic; -- timer irq |
IRQ_I : in std_logic_vector(07 downto 0); -- irq input |
IRQ_O : out std_logic -- interrupt request |
); |
end SYS_0_CORE; |
timer_irq_o : out std_logic; -- timer irq |
irq_i : in std_logic_vector(07 downto 0); -- irq input |
irq_o : out std_logic -- interrupt request |
); |
end sys_0_core; |
|
architecture SYS_0_CORE_BEHAV of SYS_0_CORE is |
architecture sys_0_core_behav of sys_0_core is |
|
-- Module Addresses -- |
constant irq_sm_reg_c : std_logic_vector(02 downto 0) := "000"; -- R/W: Interrupt source and mask |
constant irq_conf_reg_c : std_logic_vector(02 downto 0) := "001"; -- R/W: Interrupt type configuration |
-- lo byte: '1': level triggered, '0': edge triggered |
-- hi byte: '1': high level/rising edge, '0': low level/falling edge |
constant timer_cnt_reg_c : std_logic_vector(02 downto 0) := "010"; -- R/W: Timer counter register |
constant timer_thr_reg_c : std_logic_vector(02 downto 0) := "011"; -- R/W: Timer threshold register |
constant timer_prsc_reg_c : std_logic_vector(02 downto 0) := "100"; -- R/W: Timer prescaler register |
constant lfsr_data_reg_c : std_logic_vector(02 downto 0) := "101"; -- R/W: LFSR data register |
constant lfsr_poly_reg_c : std_logic_vector(02 downto 0) := "110"; -- R/W: LFSR polynomial register |
-- bit 15: '0' new value after read access, '1' free running mode |
constant reserved_reg_c : std_logic_vector(02 downto 0) := "111"; -- RESERVED |
-- Module Addresses -- |
constant irq_sm_reg_c : std_logic_vector(02 downto 0) := "000"; -- R/W: Interrupt source and mask |
constant irq_conf_reg_c : std_logic_vector(02 downto 0) := "001"; -- R/W: Interrupt type configuration |
-- lo byte: '1': level triggered, '0': edge triggered |
-- hi byte: '1': high level/rising edge, '0': low level/falling edge |
constant timer_cnt_reg_c : std_logic_vector(02 downto 0) := "010"; -- R/W: Timer counter register |
constant timer_thr_reg_c : std_logic_vector(02 downto 0) := "011"; -- R/W: Timer threshold register |
constant timer_prsc_reg_c : std_logic_vector(02 downto 0) := "100"; -- R/W: Timer prescaler register |
constant lfsr_data_reg_c : std_logic_vector(02 downto 0) := "101"; -- R/W: LFSR data register |
constant lfsr_poly_reg_c : std_logic_vector(02 downto 0) := "110"; -- R/W: LFSR polynomial register |
-- bit 15: '0' new value after read access, '1' free running mode |
constant reserved_reg_c : std_logic_vector(02 downto 0) := "111"; -- RESERVED |
|
-- IRQ Registers -- |
signal IRQ_MASK_REG : std_logic_vector(07 downto 0); |
signal IRQ_SOURCE_REG : std_logic_vector(02 downto 0); |
signal IRQ_CONF_REG : std_logic_vector(15 downto 0); |
-- IRQ Registers -- |
signal irq_mask_reg : std_logic_vector(07 downto 0); |
signal irq_source_reg : std_logic_vector(02 downto 0); |
signal irq_conf_reg : std_logic_vector(15 downto 0); |
|
-- Internals -- |
signal IRQ_SYNC_0 : std_logic_vector(07 downto 0); |
signal IRQ_SYNC_1 : std_logic_vector(07 downto 0); |
signal IRQ_RAW_REQ : std_logic_vector(07 downto 0); |
signal IRQ_BUF : std_logic_vector(07 downto 0); |
signal IRQ_ID : std_logic_vector(02 downto 0); |
signal IRQ_ACK_MASK : std_logic_vector(07 downto 0); |
signal IRQ_ACK_MASK_FF : std_logic_vector(07 downto 0); |
signal IRQ_LOCK : std_logic; |
-- Internals -- |
signal irq_sync_0 : std_logic_vector(07 downto 0); |
signal irq_sync_1 : std_logic_vector(07 downto 0); |
signal irq_raw_req : std_logic_vector(07 downto 0); |
signal irq_buf : std_logic_vector(07 downto 0); |
signal irq_id : std_logic_vector(02 downto 0); |
signal irq_ack_mask : std_logic_vector(07 downto 0); |
signal irq_ack_mask_ff : std_logic_vector(07 downto 0); |
signal irq_lock : std_logic; |
|
-- Timer Registers -- |
signal TMR_CNT_REG : std_logic_vector(15 downto 0); |
signal TMR_THR_REG : std_logic_vector(15 downto 0); |
signal TMR_PRSC_REG : std_logic_vector(15 downto 0); |
signal TMR_PRSC_CNT : std_logic_vector(15 downto 0); |
-- Timer Registers -- |
signal tmr_cnt_reg : std_logic_vector(15 downto 0); |
signal tmr_thr_reg : std_logic_vector(15 downto 0); |
signal tmr_prsc_reg : std_logic_vector(15 downto 0); |
signal tmr_prsc_cnt : std_logic_vector(15 downto 0); |
|
-- Timer Signals -- |
signal TMR_PRSC_MATCH : std_logic; |
signal TMR_THRES_ZERO : std_logic; |
-- Timer Signals -- |
signal tmr_prsc_match : std_logic; |
signal tmr_thres_zero : std_logic; |
|
-- LFSR Registers -- |
signal LFSR_DATA : std_logic_vector(15 downto 0); |
signal LFSR_POLY : std_logic_vector(15 downto 0); |
signal LFSR_NEW : std_logic_vector(15 downto 0); |
signal LFSR_NOISE : std_logic; |
-- LFSR Registers -- |
signal lfsr_data : std_logic_vector(15 downto 0); |
signal lfsr_poly : std_logic_vector(15 downto 0); |
signal lfsr_new : std_logic_vector(15 downto 0); |
signal lfsr_noise : std_logic; |
|
begin |
|
-- Write Access ---------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
W_ACC: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
IRQ_MASK_REG <= (others => '0'); |
IRQ_CONF_REG <= (others => '0'); |
TMR_CNT_REG <= (others => '0'); |
TMR_THR_REG <= (others => '0'); |
TMR_PRSC_REG <= (others => '0'); |
TMR_PRSC_CNT <= (others => '0'); |
LFSR_DATA <= (others => '0'); |
LFSR_POLY <= (others => '0'); |
IRQ_SYNC_0 <= (others => '0'); |
IRQ_SYNC_1 <= (others => '0'); |
else |
-- IRQ CTRL write access -- |
if (W_EN_I = '1') and (ICE_I = '1') and ((ADR_I = irq_sm_reg_c) or (ADR_I = irq_conf_reg_c)) then |
if (ADR_I = irq_sm_reg_c) then |
IRQ_MASK_REG <= DAT_I(15 downto 08); |
else -- (ADR_I = irq_conf_reg_c) |
IRQ_CONF_REG <= DAT_I; |
end if; |
end if; |
IRQ_SYNC_1 <= IRQ_SYNC_0; |
IRQ_SYNC_0 <= IRQ_I; |
-- Write Access ---------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
w_acc: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
irq_mask_reg <= (others => '0'); |
irq_conf_reg <= (others => '0'); |
tmr_cnt_reg <= (others => '0'); |
tmr_thr_reg <= (others => '0'); |
tmr_prsc_reg <= (others => '0'); |
tmr_prsc_cnt <= (others => '0'); |
lfsr_data <= (others => '0'); |
lfsr_poly <= (others => '0'); |
irq_sync_0 <= (others => '0'); |
irq_sync_1 <= (others => '0'); |
else |
-- irq ctrl write access -- |
if (w_en_i = '1') and (ice_i = '1') and ((adr_i = irq_sm_reg_c) or (adr_i = irq_conf_reg_c)) then |
if (adr_i = irq_sm_reg_c) then |
irq_mask_reg <= dat_i(15 downto 08); |
else -- (adr_i = irq_conf_reg_c) |
irq_conf_reg <= dat_i; |
end if; |
end if; |
irq_sync_1 <= irq_sync_0; |
irq_sync_0 <= irq_i; |
|
-- TIMER write access -- |
if (W_EN_I = '1') and (ICE_I = '1') and ((ADR_I = timer_cnt_reg_c) or (ADR_I = timer_thr_reg_c) or (ADR_I = timer_prsc_reg_c)) then |
TMR_PRSC_CNT <= (others => '0'); |
if (ADR_I = timer_cnt_reg_c) then |
TMR_CNT_REG <= DAT_I; |
elsif (ADR_I = timer_thr_reg_c) then |
TMR_THR_REG <= DAT_I; |
else -- (ADR_I = timer_prsc_reg_c) |
TMR_PRSC_REG <= DAT_I; |
end if; |
else -- auto update |
if (TMR_PRSC_MATCH = '1') or (TMR_THRES_ZERO = '1') then -- prescaler increment |
TMR_PRSC_CNT <= (others => '0'); |
else |
TMR_PRSC_CNT <= std_logic_vector(unsigned(TMR_PRSC_CNT) + 1); |
end if; |
if (TMR_CNT_REG = TMR_THR_REG) then -- counter increment |
TMR_CNT_REG <= (others => '0'); |
elsif (TMR_THRES_ZERO = '0') and (TMR_PRSC_MATCH = '1') then |
TMR_CNT_REG <= std_logic_vector(unsigned(TMR_CNT_REG) + 1); |
end if; |
end if; |
-- timer write access -- |
if (w_en_i = '1') and (ice_i = '1') and ((adr_i = timer_cnt_reg_c) or (adr_i = timer_thr_reg_c) or (adr_i = timer_prsc_reg_c)) then |
tmr_prsc_cnt <= (others => '0'); |
if (adr_i = timer_cnt_reg_c) then |
tmr_cnt_reg <= dat_i; |
elsif (adr_i = timer_thr_reg_c) then |
tmr_thr_reg <= dat_i; |
else -- (adr_i = timer_prsc_reg_c) |
tmr_prsc_reg <= dat_i; |
end if; |
else -- auto update |
if (tmr_prsc_match = '1') or (tmr_thres_zero = '1') then -- prescaler increment |
tmr_prsc_cnt <= (others => '0'); |
else |
tmr_prsc_cnt <= std_logic_vector(unsigned(tmr_prsc_cnt) + 1); |
end if; |
if (tmr_cnt_reg = tmr_thr_reg) then -- counter increment |
tmr_cnt_reg <= (others => '0'); |
elsif (tmr_thres_zero = '0') and (tmr_prsc_match = '1') then |
tmr_cnt_reg <= std_logic_vector(unsigned(tmr_cnt_reg) + 1); |
end if; |
end if; |
|
-- LFSR write access -- |
if (W_EN_I = '1') and (ICE_I = '1') and ((ADR_I = lfsr_data_reg_c) or (ADR_I = lfsr_poly_reg_c)) then |
if (ADR_I = lfsr_data_reg_c) then |
LFSR_DATA <= DAT_I; |
else -- (ADR_I = lfsr_poly_reg_c) |
LFSR_POLY <= DAT_I; |
end if; |
else -- auto update |
if (LFSR_POLY(15) = '0') then -- access-update? |
if (R_EN_I = '1') and (ADR_I = lfsr_data_reg_c) and (ICE_I = '1') then |
LFSR_DATA <= LFSR_NEW; |
end if; |
else -- free-running mode |
LFSR_DATA <= LFSR_NEW; |
end if; |
end if; |
end if; |
end if; |
end process W_ACC; |
-- lfsr write access -- |
if (w_en_i = '1') and (ice_i = '1') and ((adr_i = lfsr_data_reg_c) or (adr_i = lfsr_poly_reg_c)) then |
if (adr_i = lfsr_data_reg_c) then |
lfsr_data <= dat_i; |
else -- (adr_i = lfsr_poly_reg_c) |
lfsr_poly <= dat_i; |
end if; |
else -- auto update |
if (lfsr_poly(15) = '0') then -- access-update? |
if (r_en_i = '1') and (adr_i = lfsr_data_reg_c) and (ice_i = '1') then |
lfsr_data <= lfsr_new; |
end if; |
else -- free-running mode |
lfsr_data <= lfsr_new; |
end if; |
end if; |
end if; |
end if; |
end process w_acc; |
|
-- Timer prescaler match -- |
TMR_PRSC_MATCH <= '1' when (TMR_PRSC_CNT = TMR_PRSC_REG) else '0'; |
-- timer prescaler match -- |
tmr_prsc_match <= '1' when (tmr_prsc_cnt = tmr_prsc_reg) else '0'; |
|
-- Timer threshold zero test -- |
TMR_THRES_ZERO <= '1' when (TMR_THR_REG = x"0000") else '0'; |
-- timer threshold zero test -- |
tmr_thres_zero <= '1' when (tmr_thr_reg = x"0000") else '0'; |
|
-- Timer IRQ -- |
TIMER_IRQ_O <= '1' when ((TMR_CNT_REG = TMR_THR_REG) and (TMR_THRES_ZERO = '0')) else '0'; |
-- timer irq -- |
timer_irq_o <= '1' when ((tmr_cnt_reg = tmr_thr_reg) and (tmr_thres_zero = '0')) else '0'; |
|
|
|
-- Read Access ----------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
R_ACC: process(ADR_I, IRQ_MASK_REG, IRQ_CONF_REG, IRQ_SOURCE_REG, TMR_CNT_REG, TMR_THR_REG, |
TMR_PRSC_REG, LFSR_DATA, LFSR_POLY) |
begin |
case (ADR_I) is |
when irq_sm_reg_c => DAT_O <= IRQ_MASK_REG & "00000" & IRQ_SOURCE_REG; |
when irq_conf_reg_c => DAT_O <= IRQ_CONF_REG; |
when timer_cnt_reg_c => DAT_O <= TMR_CNT_REG; |
when timer_thr_reg_c => DAT_O <= TMR_THR_REG; |
when timer_prsc_reg_c => DAT_O <= TMR_PRSC_REG; |
when lfsr_data_reg_c => DAT_O <= LFSR_DATA; |
when lfsr_poly_reg_c => DAT_O <= LFSR_POLY; |
when others => DAT_O <= (others => '0'); |
end case; |
end process R_ACC; |
-- Read Access ----------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
r_acc: process(adr_i, irq_mask_reg, irq_conf_reg, irq_source_reg, tmr_cnt_reg, tmr_thr_reg, |
tmr_prsc_reg, lfsr_data, lfsr_poly) |
begin |
case (adr_i) is |
when irq_sm_reg_c => dat_o <= irq_mask_reg & "00000" & irq_source_reg; |
when irq_conf_reg_c => dat_o <= irq_conf_reg; |
when timer_cnt_reg_c => dat_o <= tmr_cnt_reg; |
when timer_thr_reg_c => dat_o <= tmr_thr_reg; |
when timer_prsc_reg_c => dat_o <= tmr_prsc_reg; |
when lfsr_data_reg_c => dat_o <= lfsr_data; |
when lfsr_poly_reg_c => dat_o <= lfsr_poly; |
when others => dat_o <= (others => '0'); |
end case; |
end process r_acc; |
|
|
|
-- Interrupt Detector ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
IRQ_DETECTOR: process(IRQ_MASK_REG, IRQ_CONF_REG, IRQ_SYNC_0, IRQ_SYNC_1) |
begin |
-- Edge/Level detector -- |
IRQ_RAW_REQ <= (others => '0'); |
for i in 0 to 7 loop |
if (IRQ_MASK_REG(i) = '1') then -- channel enabled |
if (IRQ_CONF_REG(i) = '1') then -- level triggered |
IRQ_RAW_REQ(i) <= IRQ_CONF_REG(i+8) xnor IRQ_SYNC_0(i); |
else -- edge triggered |
if (IRQ_CONF_REG(i+8) = '1') then -- rising edge |
IRQ_RAW_REQ(i) <= IRQ_SYNC_0(i) and (not IRQ_SYNC_1(i)); |
else -- falling edge |
IRQ_RAW_REQ(i) <= (not IRQ_SYNC_0(i)) and IRQ_SYNC_1(i); |
end if; |
end if; |
end if; |
end loop; |
end process IRQ_DETECTOR; |
-- Interrupt Detector ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
irq_detector: process(irq_mask_reg, irq_conf_reg, irq_sync_0, irq_sync_1) |
begin |
-- edge/level detector -- |
irq_raw_req <= (others => '0'); |
for i in 0 to 7 loop |
if (irq_mask_reg(i) = '1') then -- channel enabled |
if (irq_conf_reg(i) = '1') then -- level triggered |
irq_raw_req(i) <= irq_conf_reg(i+8) xnor irq_sync_0(i); |
else -- edge triggered |
if (irq_conf_reg(i+8) = '1') then -- rising edge |
irq_raw_req(i) <= irq_sync_0(i) and (not irq_sync_1(i)); |
else -- falling edge |
irq_raw_req(i) <= (not irq_sync_0(i)) and irq_sync_1(i); |
end if; |
end if; |
end if; |
end loop; |
end process irq_detector; |
|
|
|
-- Interrupt Request Buffer ---------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
IRQ_BUFFER: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
IRQ_BUF <= (others => '0'); |
IRQ_SOURCE_REG <= (others => '0'); |
IRQ_ACK_MASK_FF <= (others => '0'); |
IRQ_LOCK <= '0'; |
else |
if (IRQ_LOCK = '0') then -- store ID and mask until ACK |
IRQ_ACK_MASK_FF <= IRQ_ACK_MASK; |
IRQ_SOURCE_REG <= IRQ_ID; |
end if; |
if (R_EN_I = '1') and (ADR_I = irq_sm_reg_c) then -- ack on source reg read |
IRQ_BUF <= (IRQ_BUF or IRQ_RAW_REQ) and (not IRQ_ACK_MASK_FF); |
IRQ_LOCK <= '0'; -- ACK: remove lock |
else |
IRQ_BUF <= IRQ_BUF or IRQ_RAW_REQ; |
if (IRQ_BUF /= x"00") then |
IRQ_LOCK <= '1'; |
end if; |
end if; |
end if; |
end if; |
end process IRQ_BUFFER; |
-- Interrupt Request Buffer ---------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
irq_buffer: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
irq_buf <= (others => '0'); |
irq_source_reg <= (others => '0'); |
irq_ack_mask_ff <= (others => '0'); |
irq_lock <= '0'; |
else |
if (irq_lock = '0') then -- store id and mask until ack |
irq_ack_mask_ff <= irq_ack_mask; |
irq_source_reg <= irq_id; |
end if; |
if (r_en_i = '1') and (adr_i = irq_sm_reg_c) then -- ack on source reg read |
irq_buf <= (irq_buf or irq_raw_req) and (not irq_ack_mask_ff); |
irq_lock <= '0'; -- ack: remove lock |
else |
irq_buf <= irq_buf or irq_raw_req; |
if (irq_buf /= x"00") then |
irq_lock <= '1'; |
end if; |
end if; |
end if; |
end if; |
end process irq_buffer; |
|
-- IRQ signal to host -- |
IRQ_O <= IRQ_LOCK; |
-- irq signal to host -- |
irq_o <= irq_lock; |
|
|
|
-- Interrupt Priority Encoder -------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
IRQ_PR_ENC: process(IRQ_BUF) |
begin |
IRQ_ID <= (others => '0'); |
IRQ_ACK_MASK <= (others => '0'); |
for i in 0 to 7 loop |
if (IRQ_BUF(i) = '1') then |
IRQ_ID <= std_logic_vector(to_unsigned(i,3)); |
IRQ_ACK_MASK(i) <= '1'; |
exit; |
end if; |
end loop; |
end process IRQ_PR_ENC; |
-- Interrupt Priority Encoder -------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
irq_pr_enc: process(irq_buf) |
begin |
irq_id <= (others => '0'); |
irq_ack_mask <= (others => '0'); |
for i in 0 to 7 loop |
if (irq_buf(i) = '1') then |
irq_id <= std_logic_vector(to_unsigned(i,3)); |
irq_ack_mask(i) <= '1'; |
exit; |
end if; |
end loop; |
end process irq_pr_enc; |
|
|
|
-- LFSR Update ----------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
LFSR_UPDATE: process(LFSR_DATA, LFSR_POLY, LFSR_NOISE) |
begin |
for i in 0 to 14 loop |
if (LFSR_POLY(i) = '1') then |
LFSR_NEW(i) <= LFSR_DATA(i+1) xor LFSR_DATA(0); |
else |
LFSR_NEW(i) <= LFSR_DATA(i+1); |
end if; |
end loop; |
LFSR_NEW(15) <= LFSR_DATA(0) xor LFSR_NOISE; |
end process LFSR_UPDATE; |
-- LFSR Update ----------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
lfsr_update: process(lfsr_data, lfsr_poly, lfsr_noise) |
begin |
for i in 0 to 14 loop |
if (lfsr_poly(i) = '1') then |
lfsr_new(i) <= lfsr_data(i+1) xor lfsr_data(0); |
else |
lfsr_new(i) <= lfsr_data(i+1); |
end if; |
end loop; |
lfsr_new(15) <= lfsr_data(0) xor lfsr_noise; |
end process lfsr_update; |
|
-- External noise input -- |
LFSR_NOISE <= '0'; -- not used yet |
-- external noise input -- |
lfsr_noise <= '0'; -- not used yet |
|
|
|
end SYS_0_CORE_BEHAV; |
end sys_0_core_behav; |
/atlas_core/trunk/rtl/SYS_1_CORE.vhd
4,7 → 4,7
-- # -> Memory Management Unit # |
-- # -> Clock Information # |
-- # ***************************************************** # |
-- # Last modified: 07.05.2014 # |
-- # Last modified: 28.11.2014 # |
-- # ***************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################### |
16,183 → 16,183
library work; |
use work.atlas_core_package.all; |
|
entity SYS_1_CORE is |
entity sys_1_core is |
-- ############################################################################################### |
-- ## Clock Speed Configuration ## |
-- ############################################################################################### |
generic ( |
CLK_SPEED_G : std_logic_vector(31 downto 0) := (others => '0') -- clock speed (in Hz) |
); |
port ( |
generic ( |
clk_speed_g : std_logic_vector(31 downto 0) := (others => '0') -- clock speed (in Hz) |
); |
port ( |
-- ############################################################################################### |
-- ## Host Interface ## |
-- ############################################################################################### |
|
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
ICE_I : in std_logic; -- interface clock enable, high-active |
W_EN_I : in std_logic; -- write enable |
R_EN_I : in std_logic; -- read enable |
ADR_I : in std_logic_vector(02 downto 0); -- access address |
DAT_I : in std_logic_vector(15 downto 0); -- write data |
DAT_O : out std_logic_vector(15 downto 0); -- read data |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
ice_i : in std_logic; -- interface clock enable, high-active |
w_en_i : in std_logic; -- write enable |
r_en_i : in std_logic; -- read enable |
adr_i : in std_logic_vector(02 downto 0); -- access address |
dat_i : in std_logic_vector(15 downto 0); -- write data |
dat_o : out std_logic_vector(15 downto 0); -- read data |
|
SYS_MODE_I : in std_logic; -- current operating mode |
INT_EXE_I : in std_logic; -- interrupt beeing executed |
sys_mode_i : in std_logic; -- current operating mode |
int_exe_i : in std_logic; -- interrupt beeing executed |
|
-- ############################################################################################### |
-- ## Memory Interface ## |
-- ############################################################################################### |
|
MEM_IP_ADR_O : out std_logic_vector(15 downto 0); -- instruction page |
MEM_DP_ADR_O : out std_logic_vector(15 downto 0) -- data page |
); |
end SYS_1_CORE; |
mem_ip_adr_o : out std_logic_vector(15 downto 0); -- instruction page |
mem_dp_adr_o : out std_logic_vector(15 downto 0) -- data page |
); |
end sys_1_core; |
|
architecture SYS_1_CORE_BEHAV of SYS_1_CORE is |
architecture sys_1_core_behav of sys_1_core is |
|
-- Register addresses -- |
constant mmu_irq_base_c : std_logic_vector(02 downto 0) := "000"; -- R/W: base page for IRQs |
constant mmu_sys_i_page_c : std_logic_vector(02 downto 0) := "001"; -- R/W: system mode I page |
constant mmu_sys_d_page_c : std_logic_vector(02 downto 0) := "010"; -- R/W: system mode D page |
constant mmu_usr_i_page_c : std_logic_vector(02 downto 0) := "011"; -- R/W: user mode I page |
constant mmu_usr_d_page_c : std_logic_vector(02 downto 0) := "100"; -- R/W: user mode D page |
constant mmu_i_page_link_c : std_logic_vector(02 downto 0) := "101"; -- R: linked i page |
constant mmu_d_page_link_c : std_logic_vector(02 downto 0) := "110"; -- R: linked d page |
constant mmu_sys_info_c : std_logic_vector(02 downto 0) := "111"; -- R: system info |
-- Sys info register (uses auto-pointer): |
-- 1st read access: clock speed LOW |
-- 2nd read access: clock speed HIGH |
-- register addresses -- |
constant mmu_irq_base_c : std_logic_vector(02 downto 0) := "000"; -- r/w: base page for irqs |
constant mmu_sys_i_page_c : std_logic_vector(02 downto 0) := "001"; -- r/w: system mode i page |
constant mmu_sys_d_page_c : std_logic_vector(02 downto 0) := "010"; -- r/w: system mode d page |
constant mmu_usr_i_page_c : std_logic_vector(02 downto 0) := "011"; -- r/w: user mode i page |
constant mmu_usr_d_page_c : std_logic_vector(02 downto 0) := "100"; -- r/w: user mode d page |
constant mmu_i_page_link_c : std_logic_vector(02 downto 0) := "101"; -- r: linked i page |
constant mmu_d_page_link_c : std_logic_vector(02 downto 0) := "110"; -- r: linked d page |
constant mmu_sys_info_c : std_logic_vector(02 downto 0) := "111"; -- r: system info |
-- sys info register (uses auto-pointer): |
-- 1st read access: clock speed low |
-- 2nd read access: clock speed high |
|
-- Registers -- |
signal MMU_IRQ_BASE : std_logic_vector(15 downto 0); |
signal MMU_SYS_I_PAGE : std_logic_vector(15 downto 0); |
signal MMU_SYS_D_PAGE : std_logic_vector(15 downto 0); |
signal MMU_USR_I_PAGE : std_logic_vector(15 downto 0); |
signal MMU_USR_D_PAGE : std_logic_vector(15 downto 0); |
signal MMU_I_PAGE_LINK : std_logic_vector(15 downto 0); |
signal MMU_D_PAGE_LINK : std_logic_vector(15 downto 0); |
-- registers -- |
signal mmu_irq_base : std_logic_vector(15 downto 0); |
signal mmu_sys_i_page : std_logic_vector(15 downto 0); |
signal mmu_sys_d_page : std_logic_vector(15 downto 0); |
signal mmu_usr_i_page : std_logic_vector(15 downto 0); |
signal mmu_usr_d_page : std_logic_vector(15 downto 0); |
signal mmu_i_page_link : std_logic_vector(15 downto 0); |
signal mmu_d_page_link : std_logic_vector(15 downto 0); |
|
-- Buffers / Local signals -- |
signal I_SYS_TMP, I_USR_TMP : std_logic_vector(15 downto 0); |
signal D_SYS_TMP, D_USR_TMP : std_logic_vector(15 downto 0); |
signal MODE_BUF : std_logic_vector(01 downto 0); |
signal SYS_INFO : std_logic_vector(15 downto 0); |
signal SYS_INFO_ADR : std_logic_vector(01 downto 0); |
-- buffers / local signals -- |
signal i_sys_tmp, i_usr_tmp : std_logic_vector(15 downto 0); |
signal d_sys_tmp, d_usr_tmp : std_logic_vector(15 downto 0); |
signal mode_buf : std_logic_vector(01 downto 0); |
signal sys_info : std_logic_vector(15 downto 0); |
signal sys_info_adr : std_logic_vector(01 downto 0); |
|
begin |
|
-- MMU Register Update --------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
MMU_REG_UP: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
MMU_IRQ_BASE <= start_page_c; -- (others => '0'); |
MMU_SYS_I_PAGE <= start_page_c; |
MMU_SYS_D_PAGE <= start_page_c; |
MMU_USR_I_PAGE <= start_page_c; -- (others => '0'); |
MMU_USR_D_PAGE <= start_page_c; -- (others => '0'); |
MMU_I_PAGE_LINK <= start_page_c; -- (others => '0'); |
MMU_D_PAGE_LINK <= start_page_c; -- (others => '0'); |
I_SYS_TMP <= start_page_c; |
D_SYS_TMP <= start_page_c; |
I_USR_TMP <= start_page_c; -- (others => '0'); |
D_USR_TMP <= start_page_c; -- (others => '0'); |
MODE_BUF <= system_mode_c & system_mode_c; -- start in system mode |
elsif (ICE_I = '1') then |
-- MMU Register Update --------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
mmu_reg_up: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
mmu_irq_base <= start_page_c; -- (others => '0'); |
mmu_sys_i_page <= start_page_c; |
mmu_sys_d_page <= start_page_c; |
mmu_usr_i_page <= start_page_c; -- (others => '0'); |
mmu_usr_d_page <= start_page_c; -- (others => '0'); |
mmu_i_page_link <= start_page_c; -- (others => '0'); |
mmu_d_page_link <= start_page_c; -- (others => '0'); |
i_sys_tmp <= start_page_c; |
d_sys_tmp <= start_page_c; |
i_usr_tmp <= start_page_c; -- (others => '0'); |
d_usr_tmp <= start_page_c; -- (others => '0'); |
mode_buf <= system_mode_c & system_mode_c; -- start in system mode |
elsif (ice_i = '1') then |
|
-- Auto update -- |
MODE_BUF <= MODE_BUF(0) & SYS_MODE_I; |
I_SYS_TMP <= MMU_SYS_I_PAGE; |
D_SYS_TMP <= MMU_SYS_D_PAGE; |
I_USR_TMP <= MMU_USR_I_PAGE; |
D_USR_TMP <= MMU_USR_D_PAGE; |
-- auto update -- |
mode_buf <= mode_buf(0) & sys_mode_i; |
i_sys_tmp <= mmu_sys_i_page; |
d_sys_tmp <= mmu_sys_d_page; |
i_usr_tmp <= mmu_usr_i_page; |
d_usr_tmp <= mmu_usr_d_page; |
|
-- Exception Processing ---------------------------------------------------------- |
-- ---------------------------------------------------------------------------------- |
if (INT_EXE_I = '1') then |
MMU_SYS_I_PAGE <= MMU_IRQ_BASE; -- system-mode base page for IRQs |
MMU_SYS_D_PAGE <= MMU_IRQ_BASE; -- system-mode base page for IRQs |
I_SYS_TMP <= MMU_IRQ_BASE; -- system-mode base page for IRQs |
D_SYS_TMP <= MMU_IRQ_BASE; -- system-mode base page for IRQs |
if (MODE_BUF(1) = user_mode_c) then -- we were in USR mode |
MMU_I_PAGE_LINK <= I_USR_TMP; -- save current sys i-page |
MMU_D_PAGE_LINK <= D_USR_TMP; -- save current sys d-page |
else -- we were in SYS mode |
MMU_I_PAGE_LINK <= I_SYS_TMP; -- save current sys i-page |
MMU_D_PAGE_LINK <= D_SYS_TMP; -- save current sys d-page |
end if; |
-- exception processing ---------------------------------------------------------- |
-- ---------------------------------------------------------------------------------- |
if (int_exe_i = '1') then |
mmu_sys_i_page <= mmu_irq_base; -- system-mode base page for irqs |
mmu_sys_d_page <= mmu_irq_base; -- system-mode base page for irqs |
i_sys_tmp <= mmu_irq_base; -- system-mode base page for irqs |
d_sys_tmp <= mmu_irq_base; -- system-mode base page for irqs |
if (mode_buf(1) = user_mode_c) then -- we were in usr mode |
mmu_i_page_link <= i_usr_tmp; -- save current sys i-page |
mmu_d_page_link <= d_usr_tmp; -- save current sys d-page |
else -- we were in sys mode |
mmu_i_page_link <= i_sys_tmp; -- save current sys i-page |
mmu_d_page_link <= d_sys_tmp; -- save current sys d-page |
end if; |
|
-- Data Transfer ----------------------------------------------------------------- |
-- ---------------------------------------------------------------------------------- |
elsif (W_EN_I = '1') then -- valid write |
case (ADR_I) is |
when mmu_irq_base_c => MMU_IRQ_BASE <= DAT_I; -- system-mode base page |
when mmu_sys_i_page_c => MMU_SYS_I_PAGE <= DAT_I; -- system instruction page |
when mmu_sys_d_page_c => MMU_SYS_D_PAGE <= DAT_I; -- system data page |
when mmu_usr_i_page_c => MMU_USR_I_PAGE <= DAT_I; -- user instruction page |
when mmu_usr_d_page_c => MMU_USR_D_PAGE <= DAT_I; -- user data page |
-- when mmu_i_page_link_c => MMU_I_PAGE_LINK <= DAT_I; -- instruction page link |
-- when mmu_d_page_link_c => MMU_D_PAGE_LINK <= DAT_I; -- data page link |
when others => NULL; -- do nothing |
end case; |
end if; |
end if; |
end if; |
end process MMU_REG_UP; |
-- data transfer ----------------------------------------------------------------- |
-- ---------------------------------------------------------------------------------- |
elsif (w_en_i = '1') then -- valid write |
case (adr_i) is |
when mmu_irq_base_c => mmu_irq_base <= dat_i; -- system-mode base page |
when mmu_sys_i_page_c => mmu_sys_i_page <= dat_i; -- system instruction page |
when mmu_sys_d_page_c => mmu_sys_d_page <= dat_i; -- system data page |
when mmu_usr_i_page_c => mmu_usr_i_page <= dat_i; -- user instruction page |
when mmu_usr_d_page_c => mmu_usr_d_page <= dat_i; -- user data page |
-- when mmu_i_page_link_c => mmu_i_page_link <= dat_i; -- instruction page link |
-- when mmu_d_page_link_c => mmu_d_page_link <= dat_i; -- data page link |
when others => null; -- do nothing |
end case; |
end if; |
end if; |
end if; |
end process mmu_reg_up; |
|
-- Page Output -- |
MEM_IP_ADR_O <= I_USR_TMP when (SYS_MODE_I = user_mode_c) else I_SYS_TMP; |
MEM_DP_ADR_O <= D_USR_TMP when (SYS_MODE_I = user_mode_c) else D_SYS_TMP; |
-- page output -- |
mem_ip_adr_o <= i_usr_tmp when (sys_mode_i = user_mode_c) else i_sys_tmp; |
mem_dp_adr_o <= d_usr_tmp when (sys_mode_i = user_mode_c) else d_sys_tmp; |
|
|
|
-- MMU Read Access ------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
R_ACC: process(ADR_I, MMU_IRQ_BASE, MMU_SYS_I_PAGE, MMU_SYS_D_PAGE, MMU_USR_I_PAGE, |
MMU_USR_D_PAGE, MMU_I_PAGE_LINK, MMU_D_PAGE_LINK, SYS_INFO) |
begin |
case (ADR_I) is |
when mmu_irq_base_c => DAT_O <= MMU_IRQ_BASE; -- system-mode base page |
when mmu_sys_i_page_c => DAT_O <= MMU_SYS_I_PAGE; -- system instruction page |
when mmu_sys_d_page_c => DAT_O <= MMU_SYS_D_PAGE; -- system data page |
when mmu_usr_i_page_c => DAT_O <= MMU_USR_I_PAGE; -- user instruction page |
when mmu_usr_d_page_c => DAT_O <= MMU_USR_D_PAGE; -- user data page |
when mmu_i_page_link_c => DAT_O <= MMU_I_PAGE_LINK; -- instruction page link |
when mmu_d_page_link_c => DAT_O <= MMU_D_PAGE_LINK; -- data page link |
when mmu_sys_info_c => DAT_O <= SYS_INFO; -- system info |
when others => DAT_O <= (others => '0'); -- dummy output |
end case; |
end process R_ACC; |
-- MMU Read Access ------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
r_acc: process(adr_i, mmu_irq_base, mmu_sys_i_page, mmu_sys_d_page, mmu_usr_i_page, |
mmu_usr_d_page, mmu_i_page_link, mmu_d_page_link, sys_info) |
begin |
case (adr_i) is |
when mmu_irq_base_c => dat_o <= mmu_irq_base; -- system-mode base page |
when mmu_sys_i_page_c => dat_o <= mmu_sys_i_page; -- system instruction page |
when mmu_sys_d_page_c => dat_o <= mmu_sys_d_page; -- system data page |
when mmu_usr_i_page_c => dat_o <= mmu_usr_i_page; -- user instruction page |
when mmu_usr_d_page_c => dat_o <= mmu_usr_d_page; -- user data page |
when mmu_i_page_link_c => dat_o <= mmu_i_page_link; -- instruction page link |
when mmu_d_page_link_c => dat_o <= mmu_d_page_link; -- data page link |
when mmu_sys_info_c => dat_o <= sys_info; -- system info |
when others => dat_o <= (others => '0'); -- dummy output |
end case; |
end process r_acc; |
|
|
|
-- System Info Output Control -------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
SYS_INFO_CTRL: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
SYS_INFO_ADR <= (others => '0'); |
elsif (R_EN_I = '1') and (ICE_I = '1') and (ADR_I = mmu_sys_info_c) then |
SYS_INFO_ADR <= std_logic_vector(unsigned(SYS_INFO_ADR) + 1); |
end if; |
end if; |
end process SYS_INFO_CTRL; |
-- System Info Output Control -------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
sys_info_ctrl: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
sys_info_adr <= (others => '0'); |
elsif (r_en_i = '1') and (ice_i = '1') and (adr_i = mmu_sys_info_c) then |
sys_info_adr <= std_logic_vector(unsigned(sys_info_adr) + 1); |
end if; |
end if; |
end process sys_info_ctrl; |
|
-- Output selector -- |
SYS_INFO_OUT: process(SYS_INFO_ADR) |
begin |
case (SYS_INFO_ADR) is |
when "00" => SYS_INFO <= CLK_SPEED_G(15 downto 00); |
when "01" => SYS_INFO <= CLK_SPEED_G(31 downto 16); |
when "10" => SYS_INFO <= CLK_SPEED_G(15 downto 00); |
when "11" => SYS_INFO <= CLK_SPEED_G(31 downto 16); |
when others => SYS_INFO <= (others => '0'); |
end case; |
end process SYS_INFO_OUT; |
-- output selector -- |
sys_info_out: process(sys_info_adr) |
begin |
case (sys_info_adr) is |
when "00" => sys_info <= clk_speed_g(15 downto 00); |
when "01" => sys_info <= clk_speed_g(31 downto 16); |
when "10" => sys_info <= clk_speed_g(15 downto 00); |
when "11" => sys_info <= clk_speed_g(31 downto 16); |
when others => sys_info <= (others => '0'); |
end case; |
end process sys_info_out; |
|
|
|
end SYS_1_CORE_BEHAV; |
end sys_1_core_behav; |
/atlas_core/trunk/rtl/COM_1_CORE.vhd
6,7 → 6,7
-- # -> Variable Length Burst-Transfers # |
-- # -> Bus access is pipelined # |
-- # ***************************************************** # |
-- # Last modified: 10.04.2014 # |
-- # Last modified: 28.11.2014 # |
-- # ***************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################### |
18,379 → 18,379
library work; |
use work.atlas_core_package.all; |
|
entity COM_1_CORE is |
port ( |
entity com_1_core is |
port ( |
-- ############################################################################################### |
-- ## Host Interface ## |
-- ############################################################################################### |
|
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
ICE_I : in std_logic; -- interface clock enable, high-active |
W_EN_I : in std_logic; -- write enable |
R_EN_I : in std_logic; -- read enable |
CMD_EXE_I : in std_logic; -- execute command |
ADR_I : in std_logic_vector(02 downto 0); -- access address/command |
DAT_I : in std_logic_vector(15 downto 0); -- write data |
DAT_O : out std_logic_vector(15 downto 0); -- read data |
IRQ_O : out std_logic; -- interrupt request |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
ice_i : in std_logic; -- interface clock enable, high-active |
w_en_i : in std_logic; -- write enable |
r_en_i : in std_logic; -- read enable |
cmd_exe_i : in std_logic; -- execute command |
adr_i : in std_logic_vector(02 downto 0); -- access address/command |
dat_i : in std_logic_vector(15 downto 0); -- write data |
dat_o : out std_logic_vector(15 downto 0); -- read data |
irq_o : out std_logic; -- interrupt request |
|
-- ############################################################################################### |
-- ## Wishbone Bus ## |
-- ############################################################################################### |
|
WB_CLK_O : out std_logic; -- bus clock |
WB_RST_O : out std_logic; -- bus reset, sync, high active |
WB_ADR_O : out std_logic_vector(31 downto 0); -- address |
WB_SEL_O : out std_logic_vector(01 downto 0); -- byte select |
WB_DATA_O : out std_logic_vector(15 downto 0); -- data out |
WB_DATA_I : in std_logic_vector(15 downto 0); -- data in |
WB_WE_O : out std_logic; -- read/write |
WB_CYC_O : out std_logic; -- cycle enable |
WB_STB_O : out std_logic; -- strobe |
WB_ACK_I : in std_logic; -- acknowledge |
-- WB_HALT_I : in std_logic; -- halt transfer |
WB_ERR_I : in std_logic -- bus error |
); |
end COM_1_CORE; |
wb_clk_o : out std_logic; -- bus clock |
wb_rst_o : out std_logic; -- bus reset, sync, high active |
wb_adr_o : out std_logic_vector(31 downto 0); -- address |
wb_sel_o : out std_logic_vector(01 downto 0); -- byte select |
wb_data_o : out std_logic_vector(15 downto 0); -- data out |
wb_data_i : in std_logic_vector(15 downto 0); -- data in |
wb_we_o : out std_logic; -- read/write |
wb_cyc_o : out std_logic; -- cycle enable |
wb_stb_o : out std_logic; -- strobe |
wb_ack_i : in std_logic; -- acknowledge |
-- wb_halt_i : in std_logic; -- halt transfer |
wb_err_i : in std_logic -- bus error |
); |
end com_1_core; |
|
architecture COM_1_CORE_BEHAV of COM_1_CORE is |
architecture com_1_core_behav of com_1_core is |
|
-- Module Addresses -- |
constant ctrl_reg_c : std_logic_vector(02 downto 0) := "000"; -- R/W: control register (see below) |
constant base_adr_l_reg_c : std_logic_vector(02 downto 0) := "001"; -- R/W: base address low |
constant base_adr_h_reg_c : std_logic_vector(02 downto 0) := "010"; -- R/W: base address high |
constant adr_offset_c : std_logic_vector(02 downto 0) := "011"; -- R/W: address offset (2's comp) |
constant rtx_fifo_c : std_logic_vector(02 downto 0) := "100"; -- R/W: Read/write FIFO |
constant timeout_val_c : std_logic_vector(02 downto 0) := "101"; -- R/W: Bus timeout cycles |
-- Module Addresses -- |
constant ctrl_reg_c : std_logic_vector(02 downto 0) := "000"; -- R/W: control register (see below) |
constant base_adr_l_reg_c : std_logic_vector(02 downto 0) := "001"; -- R/W: base address low |
constant base_adr_h_reg_c : std_logic_vector(02 downto 0) := "010"; -- R/W: base address high |
constant adr_offset_c : std_logic_vector(02 downto 0) := "011"; -- R/W: address offset (2's comp) |
constant rtx_fifo_c : std_logic_vector(02 downto 0) := "100"; -- R/W: Read/write FIFO |
constant timeout_val_c : std_logic_vector(02 downto 0) := "101"; -- R/W: Bus timeout cycles |
|
-- Module Operations -- |
constant cmd_init_rtrans_c : std_logic_vector(02 downto 0) := "000"; -- start READ transfer |
constant cmd_init_wtrans_c : std_logic_vector(02 downto 0) := "001"; -- start WRITE transfer |
-- Module Operations -- |
constant cmd_init_rtrans_c : std_logic_vector(02 downto 0) := "000"; -- start READ transfer |
constant cmd_init_wtrans_c : std_logic_vector(02 downto 0) := "001"; -- start WRITE transfer |
|
-- CTRL Register Bits -- |
constant done_irq_c : natural := 0; -- R: Transfer done (interrupt) flag |
constant bus_err_irq_c : natural := 1; -- R: Wishbone bus error (interrupt) flag |
constant timeout_irq_c : natural := 2; -- R: Wishbone bus timeout (interrupt) flag |
constant done_irq_en_c : natural := 3; -- R/W: Allow IRQ for <transfer done> |
constant bus_err_en_irq_c : natural := 4; -- R/W: Allow IRQ for <bus error> |
constant timeout_en_irq_c : natural := 5; -- R/W: Allow IRQ for <bus timeout> |
constant busy_flag_c : natural := 6; -- R: Transfer in progress (busy) |
constant dir_flag_c : natural := 7; -- R: Direction of last transfer (1: write, 0: read) |
constant burst_size_lsb_c : natural := 8; -- R/W: Burst size LSB |
constant burst_size_msb_c : natural := 15; -- R/W: Burst size MSB |
-- CTRL Register Bits -- |
constant done_irq_c : natural := 0; -- R: Transfer done (interrupt) flag |
constant bus_err_irq_c : natural := 1; -- R: Wishbone bus error (interrupt) flag |
constant timeout_irq_c : natural := 2; -- R: Wishbone bus timeout (interrupt) flag |
constant done_irq_en_c : natural := 3; -- R/W: Allow IRQ for <transfer done> |
constant bus_err_en_irq_c : natural := 4; -- R/W: Allow IRQ for <bus error> |
constant timeout_en_irq_c : natural := 5; -- R/W: Allow IRQ for <bus timeout> |
constant busy_flag_c : natural := 6; -- R: Transfer in progress (busy) |
constant dir_flag_c : natural := 7; -- R: Direction of last transfer (1: write, 0: read) |
constant burst_size_lsb_c : natural := 8; -- R/W: Burst size LSB |
constant burst_size_msb_c : natural := 15; -- R/W: Burst size MSB |
|
-- Config Regs -- |
signal BASE_ADR : std_logic_vector(31 downto 0); -- base address |
signal ADR_OFFSET : std_logic_vector(15 downto 0); -- address offset (2's comp) |
signal TIMEOUT_VAL : std_logic_vector(15 downto 0); -- timeout in cycles |
-- Config Regs -- |
signal base_adr : std_logic_vector(31 downto 0); -- base address |
signal adr_offset : std_logic_vector(15 downto 0); -- address offset (2's comp) |
signal timeout_val : std_logic_vector(15 downto 0); -- timeout in cycles |
|
-- Arbiter -- |
signal ARB_BUSY : std_logic; -- arbiter busy flag |
signal DIR_CTRL : std_logic; -- direction of current/last transfer (0:read, 1:write) |
signal BURST_SIZE : std_logic_vector(log2(wb_fifo_size_c)-1 downto 0); |
signal ACK_CNT : std_logic_vector(log2(wb_fifo_size_c)-1 downto 0); |
signal WB_ADR_OFFSET : std_logic_vector(31 downto 0); |
signal TIMEOUT_CNT : std_logic_vector(15 downto 0); |
-- arbiter -- |
signal arb_busy : std_logic; -- arbiter busy flag |
signal dir_ctrl : std_logic; -- direction of current/last transfer (0:read, 1:write) |
signal burst_size : std_logic_vector(log2(wb_fifo_size_c)-1 downto 0); |
signal ack_cnt : std_logic_vector(log2(wb_fifo_size_c)-1 downto 0); |
signal wb_adr_offset : std_logic_vector(31 downto 0); |
signal timeout_cnt : std_logic_vector(15 downto 0); |
|
-- IRQ System -- |
signal BUS_ERR_IRQ_EN : std_logic; |
signal TRANS_DONE_IRQ_EN : std_logic; |
signal TIMEOUT_IRQ_EN : std_logic; |
signal BUS_ERR_IRQ : std_logic; |
signal TRANS_DONE_IRQ : std_logic; |
signal TIMEOUT_IRQ : std_logic; |
-- irq system -- |
signal bus_err_irq_en : std_logic; |
signal trans_done_irq_en : std_logic; |
signal timeout_irq_en : std_logic; |
signal bus_err_irq : std_logic; |
signal trans_done_irq : std_logic; |
signal timeout_irq : std_logic; |
|
-- RTX FIFO -- |
type rtx_fifo_t is array (0 to wb_fifo_size_c-1) of std_logic_vector(15 downto 0); |
signal TX_FIFO, RX_FIFO : rtx_fifo_t := (others => (others => '0')); |
signal RX_FIFO_R_PNT : std_logic_vector(log2(wb_fifo_size_c)-1 downto 0); |
signal RX_FIFO_W_PNT : std_logic_vector(log2(wb_fifo_size_c)-1 downto 0); |
signal TX_FIFO_R_PNT : std_logic_vector(log2(wb_fifo_size_c)-1 downto 0); |
signal TX_FIFO_W_PNT : std_logic_vector(log2(wb_fifo_size_c)-1 downto 0); |
-- rtx fifo -- |
type rtx_fifo_t is array (0 to wb_fifo_size_c-1) of std_logic_vector(15 downto 0); |
signal tx_fifo, rx_fifo : rtx_fifo_t := (others => (others => '0')); |
signal rx_fifo_r_pnt : std_logic_vector(log2(wb_fifo_size_c)-1 downto 0); |
signal rx_fifo_w_pnt : std_logic_vector(log2(wb_fifo_size_c)-1 downto 0); |
signal tx_fifo_r_pnt : std_logic_vector(log2(wb_fifo_size_c)-1 downto 0); |
signal tx_fifo_w_pnt : std_logic_vector(log2(wb_fifo_size_c)-1 downto 0); |
|
-- WB Sync -- |
signal WB_DATA_I_FF : std_logic_vector(15 downto 0); -- data in buffer |
signal WB_ACK_FF : std_logic; -- acknowledge buffer |
signal WB_ERR_FF : std_logic; -- bus error |
signal WB_ADR : std_logic_vector(31 downto 0); |
signal WB_ADR_BUF : std_logic_vector(31 downto 0); |
signal WB_STB_BUF : std_logic; |
signal WB_CYC_BUF : std_logic; |
-- wb sync -- |
signal wb_data_i_ff : std_logic_vector(15 downto 0); -- data in buffer |
signal wb_ack_ff : std_logic; -- acknowledge buffer |
signal wb_err_ff : std_logic; -- bus error |
signal wb_adr : std_logic_vector(31 downto 0); |
signal wb_adr_buf : std_logic_vector(31 downto 0); |
signal wb_stb_buf : std_logic; |
signal wb_cyc_buf : std_logic; |
|
begin |
|
-- Write Access ---------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
W_ACC: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
BASE_ADR <= (others => '0'); |
BURST_SIZE <= (others => '0'); |
ADR_OFFSET <= (others => '0'); |
TIMEOUT_VAL <= (others => '0'); |
BUS_ERR_IRQ_EN <= '0'; |
TRANS_DONE_IRQ_EN <= '0'; |
TIMEOUT_IRQ_EN <= '0'; |
elsif (ICE_I = '1') then -- interface enable |
if (W_EN_I = '1') and (ARB_BUSY = '0') then -- register update only if not busy |
case (ADR_I) is |
when ctrl_reg_c => |
BURST_SIZE <= DAT_I(burst_size_lsb_c+log2(wb_fifo_size_c)-1 downto burst_size_lsb_c); |
BUS_ERR_IRQ_EN <= DAT_I(bus_err_en_irq_c); |
TRANS_DONE_IRQ_EN <= DAT_I(done_irq_en_c); |
TIMEOUT_IRQ_EN <= DAT_I(timeout_en_irq_c); |
when base_adr_l_reg_c => BASE_ADR(15 downto 00) <= DAT_I; |
when base_adr_h_reg_c => BASE_ADR(31 downto 16) <= DAT_I; |
when adr_offset_c => ADR_OFFSET <= DAT_I; |
when timeout_val_c => TIMEOUT_VAL <= DAT_I; |
when others => NULL; |
end case; |
end if; |
end if; |
end if; |
end process W_ACC; |
-- Write Access ---------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
w_acc: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
base_adr <= (others => '0'); |
burst_size <= (others => '0'); |
adr_offset <= (others => '0'); |
timeout_val <= (others => '0'); |
bus_err_irq_en <= '0'; |
trans_done_irq_en <= '0'; |
timeout_irq_en <= '0'; |
elsif (ice_i = '1') then -- interface enable |
if (w_en_i = '1') and (arb_busy = '0') then -- register update only if not busy |
case (adr_i) is |
when ctrl_reg_c => |
burst_size <= dat_i(burst_size_lsb_c+log2(wb_fifo_size_c)-1 downto burst_size_lsb_c); |
bus_err_irq_en <= dat_i(bus_err_en_irq_c); |
trans_done_irq_en <= dat_i(done_irq_en_c); |
timeout_irq_en <= dat_i(timeout_en_irq_c); |
when base_adr_l_reg_c => base_adr(15 downto 00) <= dat_i; |
when base_adr_h_reg_c => base_adr(31 downto 16) <= dat_i; |
when adr_offset_c => adr_offset <= dat_i; |
when timeout_val_c => timeout_val <= dat_i; |
when others => null; |
end case; |
end if; |
end if; |
end if; |
end process w_acc; |
|
|
|
-- Read Access ----------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
R_ACC: process(ADR_I, BASE_ADR, ADR_OFFSET, ARB_BUSY, DIR_CTRL, BURST_SIZE, BUS_ERR_IRQ_EN, |
TRANS_DONE_IRQ_EN, BUS_ERR_IRQ, TRANS_DONE_IRQ, RX_FIFO, RX_FIFO_R_PNT, |
TIMEOUT_IRQ_EN, TIMEOUT_IRQ, TIMEOUT_VAL) |
begin |
case (ADR_I) is |
when ctrl_reg_c => |
DAT_O <= (others => '0'); |
DAT_O(busy_flag_c) <= ARB_BUSY; |
DAT_O(dir_flag_c) <= DIR_CTRL; |
DAT_O(bus_err_irq_c) <= BUS_ERR_IRQ; |
DAT_O(bus_err_en_irq_c) <= BUS_ERR_IRQ_EN; |
DAT_O(done_irq_c) <= TRANS_DONE_IRQ; |
DAT_O(done_irq_en_c) <= TRANS_DONE_IRQ_EN; |
DAT_O(timeout_irq_c) <= TIMEOUT_IRQ; |
DAT_O(timeout_en_irq_c) <= TIMEOUT_IRQ_EN; |
DAT_O(burst_size_lsb_c+log2(wb_fifo_size_c)-1 downto burst_size_lsb_c) <= BURST_SIZE; |
when base_adr_l_reg_c => DAT_O <= BASE_ADR(15 downto 00); |
when base_adr_h_reg_c => DAT_O <= BASE_ADR(31 downto 16); |
when adr_offset_c => DAT_O <= ADR_OFFSET; |
when rtx_fifo_c => DAT_O <= RX_FIFO(to_integer(unsigned(RX_FIFO_R_PNT))); |
when timeout_val_c => DAT_O <= TIMEOUT_VAL; |
when others => DAT_O <= x"0000"; |
end case; |
end process R_ACC; |
-- Read Access ----------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
r_acc: process(adr_i, base_adr, adr_offset, arb_busy, dir_ctrl, burst_size, bus_err_irq_en, |
trans_done_irq_en, bus_err_irq, trans_done_irq, rx_fifo, rx_fifo_r_pnt, |
timeout_irq_en, timeout_irq, timeout_val) |
begin |
case (adr_i) is |
when ctrl_reg_c => |
dat_o <= (others => '0'); |
dat_o(busy_flag_c) <= arb_busy; |
dat_o(dir_flag_c) <= dir_ctrl; |
dat_o(bus_err_irq_c) <= bus_err_irq; |
dat_o(bus_err_en_irq_c) <= bus_err_irq_en; |
dat_o(done_irq_c) <= trans_done_irq; |
dat_o(done_irq_en_c) <= trans_done_irq_en; |
dat_o(timeout_irq_c) <= timeout_irq; |
dat_o(timeout_en_irq_c) <= timeout_irq_en; |
dat_o(burst_size_lsb_c+log2(wb_fifo_size_c)-1 downto burst_size_lsb_c) <= burst_size; |
when base_adr_l_reg_c => dat_o <= base_adr(15 downto 00); |
when base_adr_h_reg_c => dat_o <= base_adr(31 downto 16); |
when adr_offset_c => dat_o <= adr_offset; |
when rtx_fifo_c => dat_o <= rx_fifo(to_integer(unsigned(rx_fifo_r_pnt))); |
when timeout_val_c => dat_o <= timeout_val; |
when others => dat_o <= x"0000"; |
end case; |
end process r_acc; |
|
|
|
-- Host FIFO Access ------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
FIFO_ACC: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
TX_FIFO_W_PNT <= (others => '0'); |
RX_FIFO_R_PNT <= (others => '0'); |
elsif (ICE_I = '1') then -- interface enabled |
if (ADR_I = rtx_fifo_c) then -- fifo access |
if ((W_EN_I and (ARB_BUSY nand DIR_CTRL)) = '1') then -- valid write to tx fifo? |
TX_FIFO(to_integer(unsigned(TX_FIFO_W_PNT))) <= DAT_I; |
if (TX_FIFO_W_PNT /= BURST_SIZE) then |
TX_FIFO_W_PNT <= std_logic_vector(unsigned(TX_FIFO_W_PNT) + 1); -- inc tx fifo write pointer |
else |
TX_FIFO_W_PNT <= (others => '0'); |
end if; |
end if; |
if ((R_EN_I and (ARB_BUSY nand (not DIR_CTRL))) = '1') then -- valid read from RX fifo? |
if (RX_FIFO_R_PNT /= BURST_SIZE) then |
RX_FIFO_R_PNT <= std_logic_vector(unsigned(RX_FIFO_R_PNT) + 1); -- inc rx fifo read pointer |
else |
RX_FIFO_R_PNT <= (others => '0'); |
end if; |
end if; |
end if; |
end if; |
end if; |
end process FIFO_ACC; |
-- Host FIFO Access ------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
fifo_acc: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
tx_fifo_w_pnt <= (others => '0'); |
rx_fifo_r_pnt <= (others => '0'); |
elsif (ice_i = '1') then -- interface enabled |
if (adr_i = rtx_fifo_c) then -- fifo access |
if ((w_en_i and (arb_busy nand dir_ctrl)) = '1') then -- valid write to tx fifo? |
tx_fifo(to_integer(unsigned(tx_fifo_w_pnt))) <= dat_i; |
if (tx_fifo_w_pnt /= burst_size) then |
tx_fifo_w_pnt <= std_logic_vector(unsigned(tx_fifo_w_pnt) + 1); -- inc tx fifo write pointer |
else |
tx_fifo_w_pnt <= (others => '0'); |
end if; |
end if; |
if ((r_en_i and (arb_busy nand (not dir_ctrl))) = '1') then -- valid read from rx fifo? |
if (rx_fifo_r_pnt /= burst_size) then |
rx_fifo_r_pnt <= std_logic_vector(unsigned(rx_fifo_r_pnt) + 1); -- inc rx fifo read pointer |
else |
rx_fifo_r_pnt <= (others => '0'); |
end if; |
end if; |
end if; |
end if; |
end if; |
end process fifo_acc; |
|
|
|
-- Address Offset -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
ADR_OFFSET_COMP: process(ADR_OFFSET) |
begin |
WB_ADR_OFFSET(15 downto 0) <= ADR_OFFSET; |
for i in 16 to 31 loop -- sign extension |
WB_ADR_OFFSET(i) <= ADR_OFFSET(15); |
end loop; |
end process ADR_OFFSET_COMP; |
-- Address Offset -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
adr_offset_comp: process(adr_offset) |
begin |
wb_adr_offset(15 downto 0) <= adr_offset; |
for i in 16 to 31 loop -- sign extension |
wb_adr_offset(i) <= adr_offset(15); |
end loop; |
end process adr_offset_comp; |
|
|
|
-- Interrupt Output ------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
IRQ_O <= (BUS_ERR_IRQ and BUS_ERR_IRQ_EN) or |
(TRANS_DONE_IRQ and TRANS_DONE_IRQ_EN) or |
(TIMEOUT_IRQ and TIMEOUT_IRQ_EN); -- use edge trigger! |
-- Interrupt Output ------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
irq_o <= (bus_err_irq and bus_err_irq_en) or |
(trans_done_irq and trans_done_irq_en) or |
(timeout_irq and timeout_irq_en); -- use edge trigger! |
|
|
|
-- Bus Synchronizer ------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
BUS_SYNC: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
WB_DATA_I_FF <= (others => '0'); |
WB_ACK_FF <= '0'; |
WB_ERR_FF <= '0'; |
else |
WB_DATA_I_FF <= WB_DATA_I; |
WB_ACK_FF <= WB_ACK_I; |
WB_ERR_FF <= WB_ERR_I; |
end if; |
end if; |
end process BUS_SYNC; |
-- Bus Synchronizer ------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
bus_sync: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
wb_data_i_ff <= (others => '0'); |
wb_ack_ff <= '0'; |
wb_err_ff <= '0'; |
else |
wb_data_i_ff <= wb_data_i; |
wb_ack_ff <= wb_ack_i; |
wb_err_ff <= wb_err_i; |
end if; |
end if; |
end process bus_sync; |
|
-- Static output -- |
WB_SEL_O <= (others => '1'); |
WB_ADR_O <= WB_ADR; |
WB_CLK_O <= CLK_I; |
WB_RST_O <= RST_I; |
-- static output -- |
wb_sel_o <= (others => '1'); |
wb_adr_o <= wb_adr; |
wb_clk_o <= clk_i; |
wb_rst_o <= rst_i; |
|
|
|
-- Bus Arbiter ------------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
BUS_ARBITER: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
DIR_CTRL <= '0'; |
ARB_BUSY <= '0'; |
ACK_CNT <= (others => '0'); |
TIMEOUT_CNT <= (others => '0'); |
TX_FIFO_R_PNT <= (others => '0'); |
RX_FIFO_W_PNT <= (others => '0'); |
BUS_ERR_IRQ <= '0'; |
TRANS_DONE_IRQ <= '0'; |
TIMEOUT_IRQ <= '0'; |
WB_DATA_O <= (others => '0'); |
WB_ADR <= (others => '0'); |
WB_ADR_BUF <= (others => '0'); |
WB_CYC_O <= '0'; |
WB_STB_O <= '0'; |
WB_STB_BUF <= '0'; |
WB_CYC_BUF <= '0'; |
WB_WE_O <= '0'; |
else |
-- IDLE MODE ------------------------------ |
if (ARB_BUSY = '0') then |
ACK_CNT <= (others => '0'); |
TIMEOUT_CNT <= (others => '0'); |
ARB_BUSY <= '0'; |
RX_FIFO_W_PNT <= (others => '0'); |
TX_FIFO_R_PNT <= (others => '0'); |
WB_ADR <= (others => '0'); |
WB_ADR_BUF <= BASE_ADR; |
WB_STB_O <= '0'; |
WB_STB_BUF <= '0'; |
WB_CYC_O <= '0'; |
WB_CYC_BUF <= '0'; |
-- Bus Arbiter ------------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
bus_arbiter: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
dir_ctrl <= '0'; |
arb_busy <= '0'; |
ack_cnt <= (others => '0'); |
timeout_cnt <= (others => '0'); |
tx_fifo_r_pnt <= (others => '0'); |
rx_fifo_w_pnt <= (others => '0'); |
bus_err_irq <= '0'; |
trans_done_irq <= '0'; |
timeout_irq <= '0'; |
wb_data_o <= (others => '0'); |
wb_adr <= (others => '0'); |
wb_adr_buf <= (others => '0'); |
wb_cyc_o <= '0'; |
wb_stb_o <= '0'; |
wb_stb_buf <= '0'; |
wb_cyc_buf <= '0'; |
wb_we_o <= '0'; |
else |
-- idle mode ------------------------------ |
if (arb_busy = '0') then |
ack_cnt <= (others => '0'); |
timeout_cnt <= (others => '0'); |
arb_busy <= '0'; |
rx_fifo_w_pnt <= (others => '0'); |
tx_fifo_r_pnt <= (others => '0'); |
wb_adr <= (others => '0'); |
wb_adr_buf <= base_adr; |
wb_stb_o <= '0'; |
wb_stb_buf <= '0'; |
wb_cyc_o <= '0'; |
wb_cyc_buf <= '0'; |
|
-- Interface -- |
if (ICE_I = '1') then |
if (R_EN_I = '1') and (ADR_I = ctrl_reg_c) then -- read CTRL reg? |
BUS_ERR_IRQ <= '0'; |
TRANS_DONE_IRQ <= '0'; |
TIMEOUT_IRQ <= '0'; |
end if; |
if (CMD_EXE_I = '1') then -- execute transfer command? |
if (ADR_I = cmd_init_rtrans_c) then |
DIR_CTRL <= '0'; -- read transfer |
ARB_BUSY <= '1'; -- start! |
BUS_ERR_IRQ <= '0'; |
TRANS_DONE_IRQ <= '0'; |
TIMEOUT_IRQ <= '0'; |
WB_STB_BUF <= '1'; |
WB_CYC_BUF <= '1'; |
elsif (ADR_I = cmd_init_wtrans_c) then |
DIR_CTRL <= '1'; -- write transfer |
ARB_BUSY <= '1'; -- start! |
BUS_ERR_IRQ <= '0'; |
TRANS_DONE_IRQ <= '0'; |
TIMEOUT_IRQ <= '0'; |
WB_STB_BUF <= '1'; |
WB_CYC_BUF <= '1'; |
end if; |
end if; |
end if; |
-- interface -- |
if (ice_i = '1') then |
if (r_en_i = '1') and (adr_i = ctrl_reg_c) then -- read ctrl reg? |
bus_err_irq <= '0'; |
trans_done_irq <= '0'; |
timeout_irq <= '0'; |
end if; |
if (cmd_exe_i = '1') then -- execute transfer command? |
if (adr_i = cmd_init_rtrans_c) then |
dir_ctrl <= '0'; -- read transfer |
arb_busy <= '1'; -- start! |
bus_err_irq <= '0'; |
trans_done_irq <= '0'; |
timeout_irq <= '0'; |
wb_stb_buf <= '1'; |
wb_cyc_buf <= '1'; |
elsif (adr_i = cmd_init_wtrans_c) then |
dir_ctrl <= '1'; -- write transfer |
arb_busy <= '1'; -- start! |
bus_err_irq <= '0'; |
trans_done_irq <= '0'; |
timeout_irq <= '0'; |
wb_stb_buf <= '1'; |
wb_cyc_buf <= '1'; |
end if; |
end if; |
end if; |
|
-- TRANSFER IN PROGRESS ------------------- |
else --elsif (WB_HALT_I = '0') then |
WB_WE_O <= DIR_CTRL; |
WB_ADR <= WB_ADR_BUF; |
WB_STB_O <= WB_STB_BUF; |
WB_CYC_O <= WB_CYC_BUF; |
TIMEOUT_CNT <= std_logic_vector(unsigned(TIMEOUT_CNT) + 1); |
-- transfer in progress ------------------- |
else --elsif (wb_halt_i = '0') then |
wb_we_o <= dir_ctrl; |
wb_adr <= wb_adr_buf; |
wb_stb_o <= wb_stb_buf; |
wb_cyc_o <= wb_cyc_buf; |
timeout_cnt <= std_logic_vector(unsigned(timeout_cnt) + 1); |
|
-- Read Transfer ------------------------ |
if (DIR_CTRL = '0') then |
if (WB_ACK_FF = '1') then |
RX_FIFO(to_integer(unsigned(RX_FIFO_W_PNT))) <= WB_DATA_I_FF; |
RX_FIFO_W_PNT <= std_logic_vector(unsigned(RX_FIFO_W_PNT) + 1); -- inc rx fifo write pointer |
end if; |
if (RX_FIFO_W_PNT /= BURST_SIZE) then -- all transfered? |
WB_ADR_BUF <= std_logic_vector(unsigned(WB_ADR_BUF) + unsigned(WB_ADR_OFFSET)); -- ADR |
WB_STB_BUF <= '1'; |
else |
WB_STB_BUF <= '0'; |
end if; |
-- read transfer ------------------------ |
if (dir_ctrl = '0') then |
if (wb_ack_ff = '1') then |
rx_fifo(to_integer(unsigned(rx_fifo_w_pnt))) <= wb_data_i_ff; |
rx_fifo_w_pnt <= std_logic_vector(unsigned(rx_fifo_w_pnt) + 1); -- inc rx fifo write pointer |
end if; |
if (rx_fifo_w_pnt /= burst_size) then -- all transfered? |
wb_adr_buf <= std_logic_vector(unsigned(wb_adr_buf) + unsigned(wb_adr_offset)); -- adr |
wb_stb_buf <= '1'; |
else |
wb_stb_buf <= '0'; |
end if; |
|
-- Write Transfer ----------------------- |
else |
WB_DATA_O <= TX_FIFO(to_integer(unsigned(TX_FIFO_R_PNT))); |
if (TX_FIFO_R_PNT /= BURST_SIZE) then -- all transfered? |
TX_FIFO_R_PNT <= std_logic_vector(unsigned(TX_FIFO_R_PNT) + 1); -- inc tx fifo read pointer |
WB_ADR_BUF <= std_logic_vector(unsigned(WB_ADR_BUF) + unsigned(WB_ADR_OFFSET)); -- ADR |
WB_STB_BUF <= '1'; |
else |
WB_STB_BUF <= '0'; |
end if; |
end if; |
-- write transfer ----------------------- |
else |
wb_data_o <= tx_fifo(to_integer(unsigned(tx_fifo_r_pnt))); |
if (tx_fifo_r_pnt /= burst_size) then -- all transfered? |
tx_fifo_r_pnt <= std_logic_vector(unsigned(tx_fifo_r_pnt) + 1); -- inc tx fifo read pointer |
wb_adr_buf <= std_logic_vector(unsigned(wb_adr_buf) + unsigned(wb_adr_offset)); -- adr |
wb_stb_buf <= '1'; |
else |
wb_stb_buf <= '0'; |
end if; |
end if; |
|
-- ACK counter -- |
if (WB_ACK_FF = '1') then |
if (ACK_CNT = BURST_SIZE) then -- yeay, finished! |
WB_CYC_BUF <= '0'; |
WB_CYC_O <= '0'; |
ARB_BUSY <= '0'; -- done |
TRANS_DONE_IRQ <= '1'; |
else |
ACK_CNT <= std_logic_vector(unsigned(ACK_CNT) + 1); |
WB_CYC_BUF <= '1'; |
end if; |
end if; |
-- ack counter -- |
if (wb_ack_ff = '1') then |
if (ack_cnt = burst_size) then -- yeay, finished! |
wb_cyc_buf <= '0'; |
wb_cyc_o <= '0'; |
arb_busy <= '0'; -- done |
trans_done_irq <= '1'; |
else |
ack_cnt <= std_logic_vector(unsigned(ack_cnt) + 1); |
wb_cyc_buf <= '1'; |
end if; |
end if; |
|
-- Bus Error/Timeout? -- |
if (WB_ERR_FF = '1') or (TIMEOUT_CNT = TIMEOUT_VAL) then |
WB_CYC_O <= '0'; |
WB_CYC_BUF <= '0'; |
WB_STB_O <= '0'; |
WB_STB_BUF <= '0'; |
ARB_BUSY <= '0'; -- terminate |
TRANS_DONE_IRQ <= '0'; |
if (WB_ERR_FF = '1') then |
BUS_ERR_IRQ <= '1'; |
else |
TIMEOUT_IRQ <= '1'; |
end if; |
end if; |
end if; |
end if; |
end if; |
end process BUS_ARBITER; |
-- bus error/timeout? -- |
if (wb_err_ff = '1') or (timeout_cnt = timeout_val) then |
wb_cyc_o <= '0'; |
wb_cyc_buf <= '0'; |
wb_stb_o <= '0'; |
wb_stb_buf <= '0'; |
arb_busy <= '0'; -- terminate |
trans_done_irq <= '0'; |
if (wb_err_ff = '1') then |
bus_err_irq <= '1'; |
else |
timeout_irq <= '1'; |
end if; |
end if; |
end if; |
end if; |
end if; |
end process bus_arbiter; |
|
|
|
end COM_1_CORE_BEHAV; |
end com_1_core_behav; |
/atlas_core/trunk/rtl/SYSTEM_CP.vhd
3,7 → 3,7
-- # **************************************************** # |
-- # Top entity of the system extension coprocessor. # |
-- # **************************************************** # |
-- # Last modified: 09.04.2014 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
15,311 → 15,311
library work; |
use work.atlas_core_package.all; |
|
entity SYSTEM_CP is |
entity system_cp is |
-- ############################################################################################### |
-- ## Module Configuration ## |
-- ############################################################################################### |
generic ( |
CLOCK_SPEED_G : std_logic_vector(31 downto 0) := x"00000000" -- clock speed in Hz |
); |
port ( |
generic ( |
clock_speed_g : std_logic_vector(31 downto 0) := x"00000000" -- clock speed in Hz |
); |
port ( |
-- ############################################################################################### |
-- ## Global Control ## |
-- ############################################################################################### |
|
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
ICE_I : in std_logic; -- interface clock enable, high-active |
CLK_I : IN STD_LOGIC; -- GLOBAL CLOCK LINE |
RST_I : IN STD_LOGIC; -- GLOBAL RESET LINE, SYNC, HIGH-ACTIVE |
ICE_I : IN STD_LOGIC; -- INTERFACE CLOCK ENABLE, HIGH-ACTIVE |
|
-- ############################################################################################### |
-- ## Processor Interface ## |
-- ############################################################################################### |
|
CP_EN_I : in std_logic; -- access coprocessor |
CP_OP_I : in std_logic; -- data transfer/processing |
CP_RW_I : in std_logic; -- read/write access |
CP_CMD_I : in std_logic_vector(cp_cmd_width_c-1 downto 0); -- register addresses / cmd |
CP_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- write data |
CP_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- read data |
CP_IRQ_O : out std_logic; -- unit interrupt request |
cp_en_i : in std_logic; -- access coprocessor |
cp_op_i : in std_logic; -- data transfer/processing |
cp_rw_i : in std_logic; -- read/write access |
cp_cmd_i : in std_logic_vector(cp_cmd_width_c-1 downto 0); -- register addresses / cmd |
cp_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- write data |
cp_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- read data |
cp_irq_o : out std_logic; -- unit interrupt request |
|
SYS_MODE_I : in std_logic; -- current operating mode |
INT_EXE_I : in std_logic; -- interrupt beeing executed |
sys_mode_i : in std_logic; -- current operating mode |
int_exe_i : in std_logic; -- interrupt beeing executed |
|
-- ############################################################################################### |
-- ## Memory Interface ## |
-- ############################################################################################### |
|
MEM_IP_ADR_O : out std_logic_vector(15 downto 0); -- instruction page |
MEM_DP_ADR_O : out std_logic_vector(15 downto 0); -- data page |
mem_ip_adr_o : out std_logic_vector(15 downto 0); -- instruction page |
mem_dp_adr_o : out std_logic_vector(15 downto 0); -- data page |
|
-- ############################################################################################### |
-- ## Peripheral Communication Interface ## |
-- ############################################################################################### |
|
-- UART -- |
UART_RXD_I : in std_logic; -- receiver input |
UART_TXD_O : out std_logic; -- UART transmitter output |
-- uart -- |
uart_rxd_i : in std_logic; -- receiver input |
uart_txd_o : out std_logic; -- uart transmitter output |
|
-- SPI -- |
SPI_MOSI_O : out std_logic_vector(07 downto 0); -- serial data out |
SPI_MISO_I : in std_logic_vector(07 downto 0); -- serial data in |
SPI_SCK_O : out std_logic_vector(07 downto 0); -- serial clock out |
SPI_CS_O : out std_logic_vector(07 downto 0); -- chip select (low active) |
-- spi -- |
spi_mosi_o : out std_logic_vector(07 downto 0); -- serial data out |
spi_miso_i : in std_logic_vector(07 downto 0); -- serial data in |
spi_sck_o : out std_logic_vector(07 downto 0); -- serial clock out |
spi_cs_o : out std_logic_vector(07 downto 0); -- chip select (low active) |
|
-- Parallel IO -- |
PIO_OUT_O : out std_logic_vector(15 downto 0); -- parallel output |
PIO_IN_I : in std_logic_vector(15 downto 0); -- parallel input |
-- parallel io -- |
pio_out_o : out std_logic_vector(15 downto 0); -- parallel output |
pio_in_i : in std_logic_vector(15 downto 0); -- parallel input |
|
-- System IO -- |
SYS_OUT_O : out std_logic_vector(07 downto 0); -- system output |
SYS_IN_I : in std_logic_vector(07 downto 0); -- system input |
-- system io -- |
sys_out_o : out std_logic_vector(07 downto 0); -- system output |
sys_in_i : in std_logic_vector(07 downto 0); -- system input |
|
-- IRQs -- |
IRQ_I : in std_logic; -- IRQ |
-- irqs -- |
irq_i : in std_logic; -- IRQ |
|
-- ############################################################################################### |
-- ## Wishbone Bus ## |
-- ############################################################################################### |
|
WB_CLK_O : out std_logic; -- bus clock |
WB_RST_O : out std_logic; -- bus reset, sync, high active |
WB_ADR_O : out std_logic_vector(31 downto 0); -- address |
WB_SEL_O : out std_logic_vector(01 downto 0); -- byte select |
WB_DATA_O : out std_logic_vector(15 downto 0); -- data out |
WB_DATA_I : in std_logic_vector(15 downto 0); -- data in |
WB_WE_O : out std_logic; -- read/write |
WB_CYC_O : out std_logic; -- cycle enable |
WB_STB_O : out std_logic; -- strobe |
WB_ACK_I : in std_logic; -- acknowledge |
WB_ERR_I : in std_logic -- bus error |
); |
end SYSTEM_CP; |
wb_clk_o : out std_logic; -- bus clock |
wb_rst_o : out std_logic; -- bus reset, sync, high active |
wb_adr_o : out std_logic_vector(31 downto 0); -- address |
wb_sel_o : out std_logic_vector(01 downto 0); -- byte select |
wb_data_o : out std_logic_vector(15 downto 0); -- data out |
wb_data_i : in std_logic_vector(15 downto 0); -- data in |
wb_we_o : out std_logic; -- read/write |
wb_cyc_o : out std_logic; -- cycle enable |
wb_stb_o : out std_logic; -- strobe |
wb_ack_i : in std_logic; -- acknowledge |
wb_err_i : in std_logic -- bus error |
); |
end system_cp; |
|
architecture SYSTEM_CP_BEHAV of SYSTEM_CP is |
architecture system_cp_behav of system_cp is |
|
-- Module addresses -- |
constant sys0_module_c : std_logic_vector(1 downto 0) := "00"; |
constant sys1_module_c : std_logic_vector(1 downto 0) := "01"; |
constant com0_module_c : std_logic_vector(1 downto 0) := "10"; |
constant com1_module_c : std_logic_vector(1 downto 0) := "11"; |
-- module addresses -- |
constant sys0_module_c : std_logic_vector(1 downto 0) := "00"; |
constant sys1_module_c : std_logic_vector(1 downto 0) := "01"; |
constant com0_module_c : std_logic_vector(1 downto 0) := "10"; |
constant com1_module_c : std_logic_vector(1 downto 0) := "11"; |
|
-- Module interface -- |
type module_interface_t is record |
DATA_O : std_logic_vector(data_width_c-1 downto 0); |
W_EN : std_logic; |
R_EN : std_logic; |
CMD_EXE : std_logic; |
end record; |
-- module interface -- |
type module_interface_t is record |
data_o : std_logic_vector(data_width_c-1 downto 0); |
w_en : std_logic; |
r_en : std_logic; |
cmd_exe : std_logic; |
end record; |
|
signal SYS_0_MODULE : module_interface_t; |
signal SYS_1_MODULE : module_interface_t; |
signal COM_0_MODULE : module_interface_t; |
signal COM_1_MODULE : module_interface_t; |
signal sys_0_module : module_interface_t; |
signal sys_1_module : module_interface_t; |
signal com_0_module : module_interface_t; |
signal com_1_module : module_interface_t; |
|
-- Raw interrupt signals -- |
signal INT_ASSIGN : std_logic_vector(7 downto 0); |
signal TIMER_IRQ : std_logic; |
signal UART_RX_IRQ : std_logic; |
signal UART_TX_IRQ : std_logic; |
signal SPI_IRQ : std_logic; |
signal PIO_IRQ : std_logic; |
signal WB_CORE_IRQ : std_logic; |
-- raw interrupt signals -- |
signal int_assign : std_logic_vector(7 downto 0); |
signal timer_irq : std_logic; |
signal uart_rx_irq : std_logic; |
signal uart_tx_irq : std_logic; |
signal spi_irq : std_logic; |
signal pio_irq : std_logic; |
signal wb_core_irq : std_logic; |
|
-- Internals -- |
signal READ_ACC : std_logic; -- true read access |
signal CMD_EXE : std_logic; -- true coprocessor command |
-- internals -- |
signal read_acc : std_logic; -- true read access |
signal cmd_exe : std_logic; -- true coprocessor command |
|
begin |
|
-- Write Access Logic ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
CTRL_W_ACC: process(CP_EN_I, CP_RW_I, CP_OP_I, CP_CMD_I) |
variable valid_acc_v : std_logic; |
begin |
-- Valid Write Access? -- |
valid_acc_v := CP_EN_I and CP_RW_I and CP_OP_I; |
-- Write Access Logic ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
ctrl_w_acc: process(cp_en_i, cp_rw_i, cp_op_i, cp_cmd_i) |
variable valid_acc_v : std_logic; |
begin |
-- valid write access? -- |
valid_acc_v := cp_en_i and cp_rw_i and cp_op_i; |
|
-- Address Decoder -- |
SYS_0_MODULE.W_EN <= '0'; |
SYS_1_MODULE.W_EN <= '0'; |
COM_0_MODULE.W_EN <= '0'; |
COM_1_MODULE.W_EN <= '0'; |
case (CP_CMD_I(cp_op_a_msb_c-1 downto cp_op_a_lsb_c)) is |
when sys0_module_c => SYS_0_MODULE.W_EN <= valid_acc_v; |
when sys1_module_c => SYS_1_MODULE.W_EN <= valid_acc_v; |
when com0_module_c => COM_0_MODULE.W_EN <= valid_acc_v; |
when com1_module_c => COM_1_MODULE.W_EN <= valid_acc_v; |
when others => NULL; |
end case; |
end process CTRL_W_ACC; |
-- address decoder -- |
sys_0_module.w_en <= '0'; |
sys_1_module.w_en <= '0'; |
com_0_module.w_en <= '0'; |
com_1_module.w_en <= '0'; |
case (cp_cmd_i(cp_op_a_msb_c-1 downto cp_op_a_lsb_c)) is |
when sys0_module_c => sys_0_module.w_en <= valid_acc_v; |
when sys1_module_c => sys_1_module.w_en <= valid_acc_v; |
when com0_module_c => com_0_module.w_en <= valid_acc_v; |
when com1_module_c => com_1_module.w_en <= valid_acc_v; |
when others => null; |
end case; |
end process ctrl_w_acc; |
|
|
|
-- Read Access Logic ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
CTRL_R_ACC: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
CP_DAT_O <= (others => '0'); |
elsif (ICE_I = '1') then -- clock enabled |
if (READ_ACC = '1') then -- valid read |
case (CP_CMD_I(cp_op_b_msb_c-1 downto cp_op_b_lsb_c)) is |
when sys0_module_c => CP_DAT_O <= SYS_0_MODULE.DATA_O; |
when sys1_module_c => CP_DAT_O <= SYS_1_MODULE.DATA_O; |
when com0_module_c => CP_DAT_O <= COM_0_MODULE.DATA_O; |
when com1_module_c => CP_DAT_O <= COM_1_MODULE.DATA_O; |
when others => CP_DAT_O <= (others => '0'); |
end case; |
else |
CP_DAT_O <= (others => '0'); |
end if; |
end if; |
end if; |
end process CTRL_R_ACC; |
-- Read Access Logic ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
ctrl_r_acc: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
cp_dat_o <= (others => '0'); |
elsif (ice_i = '1') then -- clock enabled |
if (read_acc = '1') then -- valid read |
case (cp_cmd_i(cp_op_b_msb_c-1 downto cp_op_b_lsb_c)) is |
when sys0_module_c => cp_dat_o <= sys_0_module.data_o; |
when sys1_module_c => cp_dat_o <= sys_1_module.data_o; |
when com0_module_c => cp_dat_o <= com_0_module.data_o; |
when com1_module_c => cp_dat_o <= com_1_module.data_o; |
when others => cp_dat_o <= (others => '0'); |
end case; |
else |
cp_dat_o <= (others => '0'); |
end if; |
end if; |
end if; |
end process ctrl_r_acc; |
|
-- Module Read Enable -- |
READ_ACC <= CP_EN_I and (not CP_RW_I) and CP_OP_I; -- true read access |
SYS_0_MODULE.R_EN <= READ_ACC when (CP_CMD_I(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = sys0_module_c) else '0'; |
SYS_1_MODULE.R_EN <= READ_ACC when (CP_CMD_I(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = sys1_module_c) else '0'; |
COM_0_MODULE.R_EN <= READ_ACC when (CP_CMD_I(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = com0_module_c) else '0'; |
COM_1_MODULE.R_EN <= READ_ACC when (CP_CMD_I(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = com1_module_c) else '0'; |
-- module read enable -- |
read_acc <= cp_en_i and (not cp_rw_i) and cp_op_i; -- true read access |
sys_0_module.r_en <= read_acc when (cp_cmd_i(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = sys0_module_c) else '0'; |
sys_1_module.r_en <= read_acc when (cp_cmd_i(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = sys1_module_c) else '0'; |
com_0_module.r_en <= read_acc when (cp_cmd_i(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = com0_module_c) else '0'; |
com_1_module.r_en <= read_acc when (cp_cmd_i(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = com1_module_c) else '0'; |
|
-- Module Execute Command -- |
CMD_EXE <= CP_EN_I and (not CP_OP_I); -- true coprocessor command |
SYS_0_MODULE.CMD_EXE <= CMD_EXE when (CP_CMD_I(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = sys0_module_c) else '0'; |
SYS_1_MODULE.CMD_EXE <= CMD_EXE when (CP_CMD_I(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = sys1_module_c) else '0'; |
COM_0_MODULE.CMD_EXE <= CMD_EXE when (CP_CMD_I(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = com0_module_c) else '0'; |
COM_1_MODULE.CMD_EXE <= CMD_EXE when (CP_CMD_I(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = com1_module_c) else '0'; |
-- module execute command -- |
cmd_exe <= cp_en_i and (not cp_op_i); -- true coprocessor command |
sys_0_module.cmd_exe <= cmd_exe when (cp_cmd_i(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = sys0_module_c) else '0'; |
sys_1_module.cmd_exe <= cmd_exe when (cp_cmd_i(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = sys1_module_c) else '0'; |
com_0_module.cmd_exe <= cmd_exe when (cp_cmd_i(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = com0_module_c) else '0'; |
com_1_module.cmd_exe <= cmd_exe when (cp_cmd_i(cp_op_b_msb_c-1 downto cp_op_b_lsb_c) = com1_module_c) else '0'; |
|
|
|
-- System Controller 0 --------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
system_ctrl_0: SYS_0_CORE |
port map ( |
-- Host interface -- |
CLK_I => CLK_I, -- global clock line |
RST_I => RST_I, -- global reset line, sync, high-active |
ICE_I => ICE_I, -- interface clock enable, high-active |
W_EN_I => SYS_0_MODULE.W_EN, -- write enable |
R_EN_I => SYS_0_MODULE.R_EN, -- read enable |
ADR_I => CP_CMD_I(cp_cmd_msb_c downto cp_cmd_lsb_c), -- access address |
DAT_I => CP_DAT_I, -- write data |
DAT_O => SYS_0_MODULE.DATA_O, -- read data |
-- System Controller 0 --------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
system_ctrl_0: sys_0_core |
port map ( |
-- host interface -- |
clk_i => clk_i, -- global clock line |
rst_i => rst_i, -- global reset line, sync, high-active |
ice_i => ice_i, -- interface clock enable, high-active |
w_en_i => sys_0_module.w_en, -- write enable |
r_en_i => sys_0_module.r_en, -- read enable |
adr_i => cp_cmd_i(cp_cmd_msb_c downto cp_cmd_lsb_c), -- access address |
dat_i => cp_dat_i, -- write data |
dat_o => sys_0_module.data_o, -- read data |
|
-- IRQ lines -- |
TIMER_IRQ_O => TIMER_IRQ, -- timer irq |
IRQ_I => INT_ASSIGN, -- irq input |
IRQ_O => CP_IRQ_O -- interrupt request to cpu |
); |
-- irq lines -- |
timer_irq_o => timer_irq, -- timer irq |
irq_i => int_assign, -- irq input |
irq_o => cp_irq_o -- interrupt request to cpu |
); |
|
-- IRQ assignment -- |
INT_ASSIGN(0) <= TIMER_IRQ; -- high precision timer irq |
INT_ASSIGN(1) <= WB_CORE_IRQ; -- Wishbone Interface CTRL IRQ |
INT_ASSIGN(2) <= UART_RX_IRQ; -- UART data received irq |
INT_ASSIGN(3) <= UART_TX_IRQ; -- UART data send irq |
INT_ASSIGN(4) <= SPI_IRQ; -- SPI transfer done irq |
INT_ASSIGN(5) <= PIO_IRQ; -- PIO input change IRQ |
INT_ASSIGN(6) <= '0'; -- reserved |
INT_ASSIGN(7) <= IRQ_I; -- 'external' irq |
-- irq assignment -- |
int_assign(0) <= timer_irq; -- high precision timer irq |
int_assign(1) <= wb_core_irq; -- wishbone interface ctrl irq |
int_assign(2) <= uart_rx_irq; -- uart data received irq |
int_assign(3) <= uart_tx_irq; -- uart data send irq |
int_assign(4) <= spi_irq; -- spi transfer done irq |
int_assign(5) <= pio_irq; -- pio input change irq |
int_assign(6) <= '0'; -- reserved |
int_assign(7) <= irq_i; -- 'external' irq |
|
|
|
-- System Controller 1 --------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
system_ctrl_1: SYS_1_CORE |
generic map ( |
CLK_SPEED_G => CLOCK_SPEED_G -- clock speed (inHz) |
) |
port map ( |
-- Host interface -- |
CLK_I => CLK_I, -- global clock line |
RST_I => RST_I, -- global reset line, sync, high-active |
ICE_I => ICE_I, -- interface clock enable, high-active |
W_EN_I => SYS_1_MODULE.W_EN, -- write enable |
R_EN_I => SYS_1_MODULE.R_EN, -- read enable |
ADR_I => CP_CMD_I(cp_cmd_msb_c downto cp_cmd_lsb_c), -- access address |
DAT_I => CP_DAT_I, -- write data |
DAT_O => SYS_1_MODULE.DATA_O, -- read data |
-- System Controller 1 --------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
system_ctrl_1: sys_1_core |
generic map ( |
clk_speed_g => clock_speed_g -- clock speed (inhz) |
) |
port map ( |
-- host interface -- |
clk_i => clk_i, -- global clock line |
rst_i => rst_i, -- global reset line, sync, high-active |
ice_i => ice_i, -- interface clock enable, high-active |
w_en_i => sys_1_module.w_en, -- write enable |
r_en_i => sys_1_module.r_en, -- read enable |
adr_i => cp_cmd_i(cp_cmd_msb_c downto cp_cmd_lsb_c), -- access address |
dat_i => cp_dat_i, -- write data |
dat_o => sys_1_module.data_o, -- read data |
|
-- CPU-special -- |
SYS_MODE_I => SYS_MODE_I, -- current operating mode |
INT_EXE_I => INT_EXE_I, -- interrupt beeing executed |
-- cpu-special -- |
sys_mode_i => sys_mode_i, -- current operating mode |
int_exe_i => int_exe_i, -- interrupt beeing executed |
|
-- Memory Interface -- |
MEM_IP_ADR_O => MEM_IP_ADR_O, -- instruction page |
MEM_DP_ADR_O => MEM_DP_ADR_O -- data page |
); |
-- memory interface -- |
mem_ip_adr_o => mem_ip_adr_o, -- instruction page |
mem_dp_adr_o => mem_dp_adr_o -- data page |
); |
|
|
|
-- Communication Controller 0 -------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
communication_ctrl_0: COM_0_CORE |
port map ( |
-- Host interface -- |
CLK_I => CLK_I, -- global clock line |
RST_I => RST_I, -- global reset line, sync, high-active |
ICE_I => ICE_I, -- interface clock enable, high-active |
W_EN_I => COM_0_MODULE.W_EN, -- write enable |
R_EN_I => COM_0_MODULE.R_EN, -- read enable |
ADR_I => CP_CMD_I(cp_cmd_msb_c downto cp_cmd_lsb_c), -- access address |
DAT_I => CP_DAT_I, -- write data |
DAT_O => COM_0_MODULE.DATA_O, -- read data |
-- Communication Controller 0 -------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
communication_ctrl_0: com_0_core |
port map ( |
-- host interface -- |
clk_i => clk_i, -- global clock line |
rst_i => rst_i, -- global reset line, sync, high-active |
ice_i => ice_i, -- interface clock enable, high-active |
w_en_i => com_0_module.w_en, -- write enable |
r_en_i => com_0_module.r_en, -- read enable |
adr_i => cp_cmd_i(cp_cmd_msb_c downto cp_cmd_lsb_c), -- access address |
dat_i => cp_dat_i, -- write data |
dat_o => com_0_module.data_o, -- read data |
|
-- Interrupt Lines -- |
UART_RX_IRQ_O => UART_RX_IRQ, -- UART IRQ "data available" |
UART_TX_IRQ_O => UART_TX_IRQ, -- UART IRQ "sending done" |
SPI_IRQ_O => SPI_IRQ, -- SPI IRQ "transfer done" |
PIO_IRQ_O => PIO_IRQ, -- PIO input pin change irq |
-- interrupt lines -- |
uart_rx_irq_o => uart_rx_irq, -- uart irq "data available" |
uart_tx_irq_o => uart_tx_irq, -- uart irq "sending done" |
spi_irq_o => spi_irq, -- spi irq "transfer done" |
pio_irq_o => pio_irq, -- pio input pin change irq |
|
-- Peripheral Interface -- |
UART_TXD_O => UART_TXD_O, -- UART transmitter |
UART_RXD_I => UART_RXD_I, -- UART receiver |
SPI_MOSI_O => SPI_MOSI_O, -- SPI master out slave in |
SPI_MISO_I => SPI_MISO_I, -- SPI master in slave out |
SPI_SCK_O => SPI_SCK_O, -- SPI clock out |
SPI_CS_O => SPI_CS_O, -- SPI chip select |
PIO_IN_I => PIO_IN_I, -- parallel input |
PIO_OUT_O => PIO_OUT_O, -- parallel output |
SYS_IO_I => SYS_IN_I, -- system input |
SYS_IO_O => SYS_OUT_O -- system output |
); |
-- peripheral interface -- |
uart_txd_o => uart_txd_o, -- uart transmitter |
uart_rxd_i => uart_rxd_i, -- uart receiver |
spi_mosi_o => spi_mosi_o, -- spi master out slave in |
spi_miso_i => spi_miso_i, -- spi master in slave out |
spi_sck_o => spi_sck_o, -- spi clock out |
spi_cs_o => spi_cs_o, -- spi chip select |
pio_in_i => pio_in_i, -- parallel input |
pio_out_o => pio_out_o, -- parallel output |
sys_io_i => sys_in_i, -- system input |
sys_io_o => sys_out_o -- system output |
); |
|
|
|
-- Communication Controller 1 -------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
communication_ctrl_1: COM_1_CORE |
port map ( |
-- Host interface -- |
WB_CLK_O => WB_CLK_O, -- bus clock |
WB_RST_O => WB_RST_O, -- bus reset, sync, high active |
CLK_I => CLK_I, -- global clock line |
RST_I => RST_I, -- global reset line, sync, high-active |
ICE_I => ICE_I, -- interface clock enable, high-active |
W_EN_I => COM_1_MODULE.W_EN, -- write enable |
R_EN_I => COM_1_MODULE.R_EN, -- read enable |
CMD_EXE_I => COM_1_MODULE.CMD_EXE,-- execute command |
ADR_I => CP_CMD_I(cp_cmd_msb_c downto cp_cmd_lsb_c), -- access address/command |
DAT_I => CP_DAT_I, -- write data |
DAT_O => COM_1_MODULE.DATA_O, -- read data |
IRQ_O => WB_CORE_IRQ, -- interrupt request |
-- Communication Controller 1 -------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
communication_ctrl_1: com_1_core |
port map ( |
-- host interface -- |
wb_clk_o => wb_clk_o, -- bus clock |
wb_rst_o => wb_rst_o, -- bus reset, sync, high active |
clk_i => clk_i, -- global clock line |
rst_i => rst_i, -- global reset line, sync, high-active |
ice_i => ice_i, -- interface clock enable, high-active |
w_en_i => com_1_module.w_en, -- write enable |
r_en_i => com_1_module.r_en, -- read enable |
cmd_exe_i => com_1_module.cmd_exe,-- execute command |
adr_i => cp_cmd_i(cp_cmd_msb_c downto cp_cmd_lsb_c), -- access address/command |
dat_i => cp_dat_i, -- write data |
dat_o => com_1_module.data_o, -- read data |
irq_o => wb_core_irq, -- interrupt request |
|
-- Wishbone Bus -- |
WB_ADR_O => WB_ADR_O, -- address |
WB_SEL_O => WB_SEL_O, -- byte select |
WB_DATA_O => WB_DATA_O, -- data out |
WB_DATA_I => WB_DATA_I, -- data in |
WB_WE_O => WB_WE_O, -- read/write |
WB_CYC_O => WB_CYC_O, -- cycle enable |
WB_STB_O => WB_STB_O, -- strobe |
WB_ACK_I => WB_ACK_I, -- acknowledge |
WB_ERR_I => WB_ERR_I -- bus error |
); |
-- wishbone bus -- |
wb_adr_o => wb_adr_o, -- address |
wb_sel_o => wb_sel_o, -- byte select |
wb_data_o => wb_data_o, -- data out |
wb_data_i => wb_data_i, -- data in |
wb_we_o => wb_we_o, -- read/write |
wb_cyc_o => wb_cyc_o, -- cycle enable |
wb_stb_o => wb_stb_o, -- strobe |
wb_ack_i => wb_ack_i, -- acknowledge |
wb_err_i => wb_err_i -- bus error |
); |
|
|
|
end SYSTEM_CP_BEHAV; |
end system_cp_behav; |
/atlas_core/trunk/rtl/WB_UNIT.vhd
3,7 → 3,7
-- # **************************************************** # |
-- # Data write back selector for register file input. # |
-- # **************************************************** # |
-- # Last modified: 08.05.2013 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
15,117 → 15,117
library work; |
use work.atlas_core_package.all; |
|
entity WB_UNIT is |
port ( |
entity wb_unit is |
port ( |
-- ############################################################################################### |
-- ## Global Control ## |
-- ############################################################################################### |
|
CLK_I : in std_logic; -- global clock line |
CE_I : in std_logic; -- clock enable |
RST_I : in std_logic; -- global reset line, sync, high-active |
CLK_I : IN STD_LOGIC; -- GLOBAL CLOCK LINE |
CE_I : IN STD_LOGIC; -- CLOCK ENABLE |
RST_I : IN STD_LOGIC; -- GLOBAL RESET LINE, SYNC, HIGH-ACTIVE |
|
-- ############################################################################################### |
-- ## Function Control ## |
-- ############################################################################################### |
|
WB_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- wb stage control |
wb_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- wb stage control |
|
-- ############################################################################################### |
-- ## Data Input ## |
-- ############################################################################################### |
|
MEM_WB_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- memory read data |
ALU_WB_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- alu read data |
MEM_ADR_FB_I : in std_logic_vector(data_width_c-1 downto 0); -- memory address feedback |
mem_wb_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- memory read data |
alu_wb_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- alu read data |
mem_adr_fb_i : in std_logic_vector(data_width_c-1 downto 0); -- memory address feedback |
|
-- ############################################################################################### |
-- ## Data Output ## |
-- ############################################################################################### |
|
WB_DATA_O : out std_logic_vector(data_width_c-1 downto 0); -- write back data |
WB_FWD_O : out std_logic_vector(fwd_width_c-1 downto 0) -- WB stage forwarding path |
); |
end WB_UNIT; |
wb_data_o : out std_logic_vector(data_width_c-1 downto 0); -- write back data |
wb_fwd_o : out std_logic_vector(fwd_width_c-1 downto 0) -- wb stage forwarding path |
); |
end wb_unit; |
|
architecture WB_STRUCTURE of WB_UNIT is |
architecture wb_structure of wb_unit is |
|
-- Pipeline register -- |
signal ALU_FF : std_logic_vector(data_width_c-1 downto 0); |
-- pipeline register -- |
signal alu_ff : std_logic_vector(data_width_c-1 downto 0); |
|
-- Write-Back Source Select -- |
signal WB_DATA_INT : std_logic_vector(data_width_c-1 downto 0); |
-- write-back source select -- |
signal wb_data_int : std_logic_vector(data_width_c-1 downto 0); |
|
-- Aligned Mem Data -- |
signal MEM_ADR_FB : std_logic_vector(data_width_c-1 downto 0); |
signal MEM_WB_DAT_INT : std_logic_vector(data_width_c-1 downto 0); |
-- aligned mem data -- |
signal mem_adr_fb : std_logic_vector(data_width_c-1 downto 0); |
signal mem_wb_dat_int : std_logic_vector(data_width_c-1 downto 0); |
|
begin |
|
-- Pipeline Register ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
PIPE_REG: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
ALU_FF <= (others => '0'); |
MEM_ADR_FB <= (others => '0'); |
elsif (CE_I = '1') then |
ALU_FF <= ALU_WB_DAT_I; |
MEM_ADR_FB <= MEM_ADR_FB_I; |
end if; |
end if; |
end process PIPE_REG; |
-- Pipeline Register ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
pipe_reg: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
alu_ff <= (others => '0'); |
mem_adr_fb <= (others => '0'); |
elsif (ce_i = '1') then |
alu_ff <= alu_wb_dat_i; |
mem_adr_fb <= mem_adr_fb_i; |
end if; |
end if; |
end process pipe_reg; |
|
|
|
-- Data Alignment -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
DAT_ALIGN: process(MEM_ADR_FB, MEM_WB_DAT_I) |
variable dat_end_v : std_logic_vector(data_width_c-1 downto 0); |
begin |
-- Endianness converter -- |
if (big_endian_c = false) then |
dat_end_v := MEM_WB_DAT_I(data_width_c/2-1 downto 0) & MEM_WB_DAT_I(data_width_c-1 downto data_width_c/2); |
else |
dat_end_v := MEM_WB_DAT_I; |
end if; |
-- Data Alignment -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
dat_align: process(mem_adr_fb, mem_wb_dat_i) |
variable dat_end_v : std_logic_vector(data_width_c-1 downto 0); |
begin |
-- endianness converter -- |
if (big_endian_c = false) then |
dat_end_v := mem_wb_dat_i(data_width_c/2-1 downto 0) & mem_wb_dat_i(data_width_c-1 downto data_width_c/2); |
else |
dat_end_v := mem_wb_dat_i; |
end if; |
|
-- Unaligned access? -- |
if (word_mode_en_c = false) then -- byte-addressed memory |
if (MEM_ADR_FB(0) = '1') then -- swap bytes |
MEM_WB_DAT_INT <= dat_end_v(data_width_c/2-1 downto 0) & dat_end_v(data_width_c-1 downto data_width_c/2); |
else |
MEM_WB_DAT_INT <= dat_end_v; |
end if; |
else -- word-addressed memory |
MEM_WB_DAT_INT <= dat_end_v; |
end if; |
end process DAT_ALIGN; |
-- unaligned access? -- |
if (word_mode_en_c = false) then -- byte-addressed memory |
if (mem_adr_fb(0) = '1') then -- swap bytes |
mem_wb_dat_int <= dat_end_v(data_width_c/2-1 downto 0) & dat_end_v(data_width_c-1 downto data_width_c/2); |
else |
mem_wb_dat_int <= dat_end_v; |
end if; |
else -- word-addressed memory |
mem_wb_dat_int <= dat_end_v; |
end if; |
end process dat_align; |
|
|
|
-- Module Data Output ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
-- route mem data if valid mem-read-access |
WB_DATA_INT <= MEM_WB_DAT_INT when (WB_CTRL_BUS_I(ctrl_rd_mem_acc_c) = '1') else ALU_FF; |
WB_DATA_O <= WB_DATA_INT; |
-- Module Data Output ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
-- route mem data if valid mem-read-access |
wb_data_int <= mem_wb_dat_int when (wb_ctrl_bus_i(ctrl_rd_mem_acc_c) = '1') else alu_ff; |
wb_data_o <= wb_data_int; |
|
|
|
-- Forwarding Path Output ------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
-- Forwarding Path Output ------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
|
-- forwarding data -- |
WB_FWD_O(fwd_dat_msb_c downto fwd_dat_lsb_c) <= WB_DATA_INT; |
-- forwarding data -- |
wb_fwd_o(fwd_dat_msb_c downto fwd_dat_lsb_c) <= wb_data_int; |
|
-- destination address -- |
WB_FWD_O(fwd_adr_3_c downto fwd_adr_0_c) <= WB_CTRL_BUS_I(ctrl_rd_3_c downto ctrl_rd_0_c); |
-- destination address -- |
wb_fwd_o(fwd_adr_3_c downto fwd_adr_0_c) <= wb_ctrl_bus_i(ctrl_rd_3_c downto ctrl_rd_0_c); |
|
-- valid forwarding -- |
WB_FWD_O(fwd_en_c) <= WB_CTRL_BUS_I(ctrl_wb_en_c); |
-- valid forwarding -- |
wb_fwd_o(fwd_en_c) <= wb_ctrl_bus_i(ctrl_wb_en_c); |
|
|
|
|
end WB_STRUCTURE; |
end wb_structure; |
/atlas_core/trunk/rtl/SYS_REG.vhd
6,7 → 6,7
-- # processing circuits are implemented within this # |
-- # unit. # |
-- # **************************************************** # |
-- # Last modified: 23.03.2014 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
18,402 → 18,402
library work; |
use work.atlas_core_package.all; |
|
entity SYS_REG is |
port ( |
entity sys_reg is |
port ( |
-- ############################################################################################### |
-- ## Global Control ## |
-- ############################################################################################### |
|
CLK_I : in std_logic; -- global clock line |
CE_I : in std_logic; -- clock enable |
RST_I : in std_logic; -- global reset line, sync, high-active |
clk_i : in std_logic; -- global clock line |
ce_i : in std_logic; -- clock enable |
rst_i : in std_logic; -- global reset line, sync, high-active |
|
-- ############################################################################################### |
-- ## Function Control ## |
-- ############################################################################################### |
|
EX_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- ex stage control |
MA_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- ma stage control |
EXT_INT_REQ0_I : in std_logic; -- external interrupt request 0 |
EXT_INT_REQ1_I : in std_logic; -- external interrupt request 1 |
ex_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- ex stage control |
ma_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- ma stage control |
ext_int_req0_i : in std_logic; -- external interrupt request 0 |
ext_int_req1_i : in std_logic; -- external interrupt request 1 |
|
-- ############################################################################################### |
-- ## Data Input ## |
-- ############################################################################################### |
|
FLAG_BUS_I : in std_logic_vector(flag_bus_width_c-1 downto 0); -- flag input |
EXC_POS_I : in std_logic; -- exception would be possible |
STOP_PC : in std_logic; -- freeze pc |
PC_DATA_I : in std_logic_vector(data_width_c-1 downto 0); -- PC write data |
MSR_DATA_I : in std_logic_vector(data_width_c-1 downto 0); -- MSR write data |
flag_bus_i : in std_logic_vector(flag_bus_width_c-1 downto 0); -- flag input |
exc_pos_i : in std_logic; -- exception would be possible |
stop_pc : in std_logic; -- freeze pc |
pc_data_i : in std_logic_vector(data_width_c-1 downto 0); -- pc write data |
msr_data_i : in std_logic_vector(data_width_c-1 downto 0); -- msr write data |
|
-- ############################################################################################### |
-- ## Data Output ## |
-- ############################################################################################### |
|
FLAG_BUS_O : out std_logic_vector(flag_bus_width_c-1 downto 0); -- flag output |
VALID_BRANCH_O : out std_logic; -- valid branch detected |
EXC_EXECUTED_O : out std_logic; -- executed executed |
WAKE_UP_O : out std_logic; -- wake-up signal |
RD_MSR_O : out std_logic_vector(data_width_c-1 downto 0); -- read data msr |
PC_O : out std_logic_vector(data_width_c-1 downto 0); -- pc output |
PC_1D_O : out std_logic_vector(data_width_c-1 downto 0); -- pc 1x delayed |
CP_PTC_O : out std_logic; -- user coprocessor protection |
COND_TRUE_O : out std_logic; -- condition is true |
MODE_O : out std_logic; -- current operating mode |
MODE_FF_O : out std_logic -- delayed current mode |
); |
end SYS_REG; |
flag_bus_o : out std_logic_vector(flag_bus_width_c-1 downto 0); -- flag output |
valid_branch_o : out std_logic; -- valid branch detected |
exc_executed_o : out std_logic; -- executed executed |
wake_up_o : out std_logic; -- wake-up signal |
rd_msr_o : out std_logic_vector(data_width_c-1 downto 0); -- read data msr |
pc_o : out std_logic_vector(data_width_c-1 downto 0); -- pc output |
pc_1d_o : out std_logic_vector(data_width_c-1 downto 0); -- pc 1x delayed |
cp_ptc_o : out std_logic; -- user coprocessor protection |
cond_true_o : out std_logic; -- condition is true |
mode_o : out std_logic; -- current operating mode |
mode_ff_o : out std_logic -- delayed current mode |
); |
end sys_reg; |
|
architecture SR_STRUCTURE of SYS_REG is |
architecture sr_structure of sys_reg is |
|
-- System Register -- |
signal SYS_REG_PC : std_logic_vector(data_width_c-1 downto 0); |
signal SYS_REG_MSR : std_logic_vector(data_width_c-1 downto 0); |
signal PC_1D_TMP : std_logic_vector(data_width_c-1 downto 0); |
-- system register -- |
signal sys_reg_pc : std_logic_vector(data_width_c-1 downto 0); |
signal sys_reg_msr : std_logic_vector(data_width_c-1 downto 0); |
signal pc_1d_tmp : std_logic_vector(data_width_c-1 downto 0); |
|
-- Branch System -- |
signal VALID_BRANCH : std_logic; |
-- branch system -- |
signal valid_branch : std_logic; |
|
-- Interrupt System -- |
signal INT_REQ : std_logic; |
signal INT_VECTOR : std_logic_vector(15 downto 0); |
signal XINT_SYNC : std_logic_vector(01 downto 0); |
-- interrupt system -- |
signal int_req : std_logic; |
signal int_vector : std_logic_vector(15 downto 0); |
signal xint_sync : std_logic_vector(01 downto 0); |
|
-- Mode Flag Delay Buffer -- |
signal MODE_BUFFER : std_logic_vector(02 downto 0); |
-- mode flag delay buffer -- |
signal mode_buffer : std_logic_vector(02 downto 0); |
|
begin |
|
-- External Interrupt Sychronizer ---------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
XI_SYNCHRONIZER: process(CLK_I) |
variable valid_int_req_v : std_logic; |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
XINT_SYNC <= (others => '0'); |
elsif (CE_I = '1') then |
XINT_SYNC(0) <= EXT_INT_REQ0_I; |
XINT_SYNC(1) <= EXT_INT_REQ1_I; |
end if; |
end if; |
end process XI_SYNCHRONIZER; |
-- External Interrupt Sychronizer ---------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
xi_synchronizer: process(clk_i) |
variable valid_int_req_v : std_logic; |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
xint_sync <= (others => '0'); |
elsif (ce_i = '1') then |
xint_sync(0) <= ext_int_req0_i; |
xint_sync(1) <= ext_int_req1_i; |
end if; |
end if; |
end process xi_synchronizer; |
|
|
|
-- Exception Priority System --------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
EXC_SYS: process(EX_CTRL_BUS_I, XINT_SYNC, EXC_POS_I, SYS_REG_MSR) |
variable xint0_en_v, xint1_en_v : std_logic; |
variable xint0_valid_v, xint1_valid_v : std_logic; |
begin |
-- external interrupt enable -- |
-- => external_int is possible AND int_source is enabled AND global_ints are enabled |
xint0_en_v := SYS_REG_MSR(msr_xint0_en_c); |
xint1_en_v := SYS_REG_MSR(msr_xint1_en_c); |
xint0_valid_v := EXC_POS_I and xint0_en_v and SYS_REG_MSR(msr_xint_en_c); |
xint1_valid_v := EXC_POS_I and xint1_en_v and SYS_REG_MSR(msr_xint_en_c); |
-- Exception Priority System --------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
exc_sys: process(ex_ctrl_bus_i, xint_sync, exc_pos_i, sys_reg_msr) |
variable xint0_en_v, xint1_en_v : std_logic; |
variable xint0_valid_v, xint1_valid_v : std_logic; |
begin |
-- external interrupt enable -- |
-- => external_int is possible and int_source is enabled and global_ints are enabled |
xint0_en_v := sys_reg_msr(msr_xint0_en_c); |
xint1_en_v := sys_reg_msr(msr_xint1_en_c); |
xint0_valid_v := exc_pos_i and xint0_en_v and sys_reg_msr(msr_xint_en_c); |
xint1_valid_v := exc_pos_i and xint1_en_v and sys_reg_msr(msr_xint_en_c); |
|
-- Wake up signal -- |
WAKE_UP_O <= (xint0_en_v and XINT_SYNC(0)) or (xint1_en_v and XINT_SYNC(1)); |
-- wake up signal -- |
wake_up_o <= (xint0_en_v and xint_sync(0)) or (xint1_en_v and xint_sync(1)); |
|
-- exception priority list and encoding -- |
if ((xint0_valid_v = '1') and (XINT_SYNC(0) = '1')) then -- external interrupt 0 |
INT_REQ <= '1'; |
INT_VECTOR <= irq0_int_vec_c; |
elsif ((xint1_valid_v = '1') and (XINT_SYNC(1) = '1')) then -- external interrupt 1 |
INT_REQ <= '1'; |
INT_VECTOR <= irq1_int_vec_c; |
elsif ((EXC_POS_I = '1') and (EX_CTRL_BUS_I(ctrl_cmd_err_c) = '1')) then -- msr/reg/coprocessor access violation // undefined instruction |
INT_REQ <= '1'; |
INT_VECTOR <= cmd_err_int_vec_c; |
elsif ((EXC_POS_I = '1') and (EX_CTRL_BUS_I(ctrl_syscall_c) = '1')) then -- software interrupt / system call |
INT_REQ <= '1'; |
INT_VECTOR <= swi_int_vec_c; |
else -- no exception |
INT_REQ <= '0'; |
INT_VECTOR <= res_int_vec_c; -- irrelevant |
end if; |
end process EXC_SYS; |
-- exception priority list and encoding -- |
if ((xint0_valid_v = '1') and (xint_sync(0) = '1')) then -- external interrupt 0 |
int_req <= '1'; |
int_vector <= irq0_int_vec_c; |
elsif ((xint1_valid_v = '1') and (xint_sync(1) = '1')) then -- external interrupt 1 |
int_req <= '1'; |
int_vector <= irq1_int_vec_c; |
elsif ((exc_pos_i = '1') and (ex_ctrl_bus_i(ctrl_cmd_err_c) = '1')) then -- msr/reg/coprocessor access violation // undefined instruction |
int_req <= '1'; |
int_vector <= cmd_err_int_vec_c; |
elsif ((exc_pos_i = '1') and (ex_ctrl_bus_i(ctrl_syscall_c) = '1')) then -- software interrupt / system call |
int_req <= '1'; |
int_vector <= swi_int_vec_c; |
else -- no exception |
int_req <= '0'; |
int_vector <= res_int_vec_c; -- irrelevant |
end if; |
end process exc_sys; |
|
-- output to cycle manager -- |
EXC_EXECUTED_O <= INT_REQ; |
-- output to cycle manager -- |
exc_executed_o <= int_req; |
|
|
|
-- System Register Update ------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
SR_UPDATE: process(CLK_I, SYS_REG_MSR, EX_CTRL_BUS_I, MODE_BUFFER) |
variable m_msr_acc_v : std_logic_vector(2 downto 0); |
begin |
-- manual msr access mode (from EX stage) -- |
m_msr_acc_v := MODE_BUFFER(1) & EX_CTRL_BUS_I(ctrl_msr_am_1_c downto ctrl_msr_am_0_c); |
-- System Register Update ------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
sr_update: process(clk_i, sys_reg_msr, ex_ctrl_bus_i, mode_buffer) |
variable m_msr_acc_v : std_logic_vector(2 downto 0); |
begin |
-- manual msr access mode (from ex stage) -- |
m_msr_acc_v := mode_buffer(1) & ex_ctrl_bus_i(ctrl_msr_am_1_c downto ctrl_msr_am_0_c); |
|
-- sync update -- |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
SYS_REG_PC <= start_adr_c; -- start address |
SYS_REG_MSR <= (others => '0'); |
SYS_REG_MSR(msr_mode_flag_c) <= system_mode_c; -- we're the king after reset |
SYS_REG_MSR(msr_svd_mode_c) <= system_mode_c; |
elsif (CE_I = '1') then -- clock enable |
-- sync update -- |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
sys_reg_pc <= start_adr_c; -- start address |
sys_reg_msr <= (others => '0'); |
sys_reg_msr(msr_mode_flag_c) <= system_mode_c; -- we're the king after reset |
sys_reg_msr(msr_svd_mode_c) <= system_mode_c; |
elsif (ce_i = '1') then -- clock enable |
|
-- Exception MSR Update ------------------------------------------------- |
if (INT_REQ = '1') then -- switch to system mode |
SYS_REG_MSR(msr_mode_flag_c) <= system_mode_c; -- goto sytem mode |
SYS_REG_MSR(msr_svd_mode_c) <= MODE_BUFFER(1); -- save current mode of instr. in EX stage |
SYS_REG_MSR(msr_xint_en_c) <= '0'; -- clear global xint enable flag |
-- exception msr update ------------------------------------------------- |
if (int_req = '1') then -- switch to system mode |
sys_reg_msr(msr_mode_flag_c) <= system_mode_c; -- goto sytem mode |
sys_reg_msr(msr_svd_mode_c) <= mode_buffer(1); -- save current mode of instr. in ex stage |
sys_reg_msr(msr_xint_en_c) <= '0'; -- clear global xint enable flag |
|
elsif (EX_CTRL_BUS_I(ctrl_en_c) = '1') then -- valid operation |
if (MODE_BUFFER(1) = system_mode_c) then -- only system mode (instr. in EX stage) |
if (EX_CTRL_BUS_I(ctrl_re_xint_c) = '1') and (EX_CTRL_BUS_I(ctrl_pc_wr_c) = '1') then -- valid pc access and re-enable request? |
SYS_REG_MSR(msr_xint_en_c) <= '1'; -- auto re-enable global x_ints |
end if; |
end if; |
elsif (ex_ctrl_bus_i(ctrl_en_c) = '1') then -- valid operation |
if (mode_buffer(1) = system_mode_c) then -- only system mode (instr. in ex stage) |
if (ex_ctrl_bus_i(ctrl_re_xint_c) = '1') and (ex_ctrl_bus_i(ctrl_pc_wr_c) = '1') then -- valid pc access and re-enable request? |
sys_reg_msr(msr_xint_en_c) <= '1'; -- auto re-enable global x_ints |
end if; |
end if; |
|
-- Manual MSR Update ---------------------------------------------------- |
if (EX_CTRL_BUS_I(ctrl_msr_wr_c) = '1') then -- write operation |
case (m_msr_acc_v) is |
when "100" => -- system mode: full update |
SYS_REG_MSR <= MSR_DATA_I; |
when "101" => -- system mode: update all ALU flags |
SYS_REG_MSR(msr_usr_z_flag_c) <= MSR_DATA_I(msr_usr_z_flag_c); |
SYS_REG_MSR(msr_usr_c_flag_c) <= MSR_DATA_I(msr_usr_c_flag_c); |
SYS_REG_MSR(msr_usr_o_flag_c) <= MSR_DATA_I(msr_usr_o_flag_c); |
SYS_REG_MSR(msr_usr_n_flag_c) <= MSR_DATA_I(msr_usr_n_flag_c); |
SYS_REG_MSR(msr_usr_t_flag_c) <= MSR_DATA_I(msr_usr_t_flag_c); |
SYS_REG_MSR(msr_sys_z_flag_c) <= MSR_DATA_I(msr_sys_z_flag_c); |
SYS_REG_MSR(msr_sys_c_flag_c) <= MSR_DATA_I(msr_sys_c_flag_c); |
SYS_REG_MSR(msr_sys_o_flag_c) <= MSR_DATA_I(msr_sys_o_flag_c); |
SYS_REG_MSR(msr_sys_n_flag_c) <= MSR_DATA_I(msr_sys_n_flag_c); |
SYS_REG_MSR(msr_sys_t_flag_c) <= MSR_DATA_I(msr_sys_t_flag_c); |
when "110" => -- system mode: only update system ALU flags |
SYS_REG_MSR(msr_sys_z_flag_c) <= MSR_DATA_I(msr_sys_z_flag_c); |
SYS_REG_MSR(msr_sys_c_flag_c) <= MSR_DATA_I(msr_sys_c_flag_c); |
SYS_REG_MSR(msr_sys_o_flag_c) <= MSR_DATA_I(msr_sys_o_flag_c); |
SYS_REG_MSR(msr_sys_n_flag_c) <= MSR_DATA_I(msr_sys_n_flag_c); |
SYS_REG_MSR(msr_sys_t_flag_c) <= MSR_DATA_I(msr_sys_t_flag_c); |
when others => -- system/user mode: only update user ALU flags |
SYS_REG_MSR(msr_usr_z_flag_c) <= MSR_DATA_I(msr_usr_z_flag_c); |
SYS_REG_MSR(msr_usr_c_flag_c) <= MSR_DATA_I(msr_usr_c_flag_c); |
SYS_REG_MSR(msr_usr_o_flag_c) <= MSR_DATA_I(msr_usr_o_flag_c); |
SYS_REG_MSR(msr_usr_n_flag_c) <= MSR_DATA_I(msr_usr_n_flag_c); |
SYS_REG_MSR(msr_usr_t_flag_c) <= MSR_DATA_I(msr_usr_t_flag_c); |
end case; |
-- manual msr update ---------------------------------------------------- |
if (ex_ctrl_bus_i(ctrl_msr_wr_c) = '1') then -- write operation |
case (m_msr_acc_v) is |
when "100" => -- system mode: full update |
sys_reg_msr <= msr_data_i; |
when "101" => -- system mode: update all alu flags |
sys_reg_msr(msr_usr_z_flag_c) <= msr_data_i(msr_usr_z_flag_c); |
sys_reg_msr(msr_usr_c_flag_c) <= msr_data_i(msr_usr_c_flag_c); |
sys_reg_msr(msr_usr_o_flag_c) <= msr_data_i(msr_usr_o_flag_c); |
sys_reg_msr(msr_usr_n_flag_c) <= msr_data_i(msr_usr_n_flag_c); |
sys_reg_msr(msr_usr_t_flag_c) <= msr_data_i(msr_usr_t_flag_c); |
sys_reg_msr(msr_sys_z_flag_c) <= msr_data_i(msr_sys_z_flag_c); |
sys_reg_msr(msr_sys_c_flag_c) <= msr_data_i(msr_sys_c_flag_c); |
sys_reg_msr(msr_sys_o_flag_c) <= msr_data_i(msr_sys_o_flag_c); |
sys_reg_msr(msr_sys_n_flag_c) <= msr_data_i(msr_sys_n_flag_c); |
sys_reg_msr(msr_sys_t_flag_c) <= msr_data_i(msr_sys_t_flag_c); |
when "110" => -- system mode: only update system alu flags |
sys_reg_msr(msr_sys_z_flag_c) <= msr_data_i(msr_sys_z_flag_c); |
sys_reg_msr(msr_sys_c_flag_c) <= msr_data_i(msr_sys_c_flag_c); |
sys_reg_msr(msr_sys_o_flag_c) <= msr_data_i(msr_sys_o_flag_c); |
sys_reg_msr(msr_sys_n_flag_c) <= msr_data_i(msr_sys_n_flag_c); |
sys_reg_msr(msr_sys_t_flag_c) <= msr_data_i(msr_sys_t_flag_c); |
when others => -- system/user mode: only update user alu flags |
sys_reg_msr(msr_usr_z_flag_c) <= msr_data_i(msr_usr_z_flag_c); |
sys_reg_msr(msr_usr_c_flag_c) <= msr_data_i(msr_usr_c_flag_c); |
sys_reg_msr(msr_usr_o_flag_c) <= msr_data_i(msr_usr_o_flag_c); |
sys_reg_msr(msr_usr_n_flag_c) <= msr_data_i(msr_usr_n_flag_c); |
sys_reg_msr(msr_usr_t_flag_c) <= msr_data_i(msr_usr_t_flag_c); |
end case; |
|
-- Context Change ------------------------------------------------------- |
elsif (EX_CTRL_BUS_I(ctrl_ctx_down_c) = '1') or (EX_CTRL_BUS_I(ctrl_restsm_c) = '1') then -- context down/switch |
SYS_REG_MSR(msr_svd_mode_c) <= MODE_BUFFER(1); -- save current mode of instr. in EX stage |
if (EX_CTRL_BUS_I(ctrl_ctx_down_c) = '1') then |
SYS_REG_MSR(msr_mode_flag_c) <= user_mode_c; -- go down to user mode |
elsif (EX_CTRL_BUS_I(ctrl_restsm_c) = '1') then |
SYS_REG_MSR(msr_mode_flag_c) <= SYS_REG_MSR(msr_svd_mode_c); -- restore old mode |
end if; |
-- if (SYS_REG_MSR(msr_mode_flag_c) = system_mode_c) then -- only in system mode! |
-- SYS_REG_MSR(msr_xint_en_c) <= EX_CTRL_BUS_I(ctrl_re_xint_c); -- auto re-enable global x_ints |
-- context change ------------------------------------------------------- |
elsif (ex_ctrl_bus_i(ctrl_ctx_down_c) = '1') or (ex_ctrl_bus_i(ctrl_restsm_c) = '1') then -- context down/switch |
sys_reg_msr(msr_svd_mode_c) <= mode_buffer(1); -- save current mode of instr. in ex stage |
if (ex_ctrl_bus_i(ctrl_ctx_down_c) = '1') then |
sys_reg_msr(msr_mode_flag_c) <= user_mode_c; -- go down to user mode |
elsif (ex_ctrl_bus_i(ctrl_restsm_c) = '1') then |
sys_reg_msr(msr_mode_flag_c) <= sys_reg_msr(msr_svd_mode_c); -- restore old mode |
end if; |
-- if (sys_reg_msr(msr_mode_flag_c) = system_mode_c) then -- only in system mode! |
-- sys_reg_msr(msr_xint_en_c) <= ex_ctrl_bus_i(ctrl_re_xint_c); -- auto re-enable global x_ints |
-- end if; |
|
-- Automatic MSR Update ------------------------------------------------- |
else |
if (MODE_BUFFER(1) = user_mode_c) then -- user mode auto alu flag update (instr. in EX stage) |
if(EX_CTRL_BUS_I(ctrl_fupdate_c) = '1') then -- allow auto update of ALU flags |
SYS_REG_MSR(msr_usr_z_flag_c) <= FLAG_BUS_I(flag_z_c); |
SYS_REG_MSR(msr_usr_c_flag_c) <= FLAG_BUS_I(flag_c_c); |
SYS_REG_MSR(msr_usr_o_flag_c) <= FLAG_BUS_I(flag_o_c); |
SYS_REG_MSR(msr_usr_n_flag_c) <= FLAG_BUS_I(flag_n_c); |
end if; |
if (EX_CTRL_BUS_I(ctrl_tf_store_c) = '1') then -- allow user mode update of T-flag |
SYS_REG_MSR(msr_usr_t_flag_c) <= FLAG_BUS_I(flag_t_c); |
end if; |
else -- system mode auto alu flag update |
if(EX_CTRL_BUS_I(ctrl_fupdate_c) = '1') then -- allow system mode auto update of ALU flags |
SYS_REG_MSR(msr_sys_z_flag_c) <= FLAG_BUS_I(flag_z_c); |
SYS_REG_MSR(msr_sys_c_flag_c) <= FLAG_BUS_I(flag_c_c); |
SYS_REG_MSR(msr_sys_o_flag_c) <= FLAG_BUS_I(flag_o_c); |
SYS_REG_MSR(msr_sys_n_flag_c) <= FLAG_BUS_I(flag_n_c); |
end if; |
if (EX_CTRL_BUS_I(ctrl_tf_store_c) = '1') then -- allow system mode update of T-flag |
SYS_REG_MSR(msr_sys_t_flag_c) <= FLAG_BUS_I(flag_t_c); |
end if; |
end if; |
end if; |
end if; |
-- automatic msr update ------------------------------------------------- |
else |
if (mode_buffer(1) = user_mode_c) then -- user mode auto alu flag update (instr. in ex stage) |
if(ex_ctrl_bus_i(ctrl_fupdate_c) = '1') then -- allow auto update of alu flags |
sys_reg_msr(msr_usr_z_flag_c) <= flag_bus_i(flag_z_c); |
sys_reg_msr(msr_usr_c_flag_c) <= flag_bus_i(flag_c_c); |
sys_reg_msr(msr_usr_o_flag_c) <= flag_bus_i(flag_o_c); |
sys_reg_msr(msr_usr_n_flag_c) <= flag_bus_i(flag_n_c); |
end if; |
if (ex_ctrl_bus_i(ctrl_tf_store_c) = '1') then -- allow user mode update of t-flag |
sys_reg_msr(msr_usr_t_flag_c) <= flag_bus_i(flag_t_c); |
end if; |
else -- system mode auto alu flag update |
if(ex_ctrl_bus_i(ctrl_fupdate_c) = '1') then -- allow system mode auto update of alu flags |
sys_reg_msr(msr_sys_z_flag_c) <= flag_bus_i(flag_z_c); |
sys_reg_msr(msr_sys_c_flag_c) <= flag_bus_i(flag_c_c); |
sys_reg_msr(msr_sys_o_flag_c) <= flag_bus_i(flag_o_c); |
sys_reg_msr(msr_sys_n_flag_c) <= flag_bus_i(flag_n_c); |
end if; |
if (ex_ctrl_bus_i(ctrl_tf_store_c) = '1') then -- allow system mode update of t-flag |
sys_reg_msr(msr_sys_t_flag_c) <= flag_bus_i(flag_t_c); |
end if; |
end if; |
end if; |
end if; |
|
-- Exception PC Update -------------------------------------------------- |
if (INT_REQ = '1') then |
if (word_mode_en_c = false) then -- byte-addressed memory |
SYS_REG_PC <= INT_VECTOR(14 downto 0) & '0'; |
else -- word-addressed memory |
SYS_REG_PC <= INT_VECTOR; |
end if; |
-- exception pc update -------------------------------------------------- |
if (int_req = '1') then |
if (word_mode_en_c = false) then -- byte-addressed memory |
sys_reg_pc <= int_vector(14 downto 0) & '0'; |
else -- word-addressed memory |
sys_reg_pc <= int_vector; |
end if; |
|
-- Manual/Branch PC Update ---------------------------------------------- |
elsif (VALID_BRANCH = '1') or ((EX_CTRL_BUS_I(ctrl_en_c) = '1') and (EX_CTRL_BUS_I(ctrl_ctx_down_c) = '1')) then -- valid automatic/manual update/goto user mode |
SYS_REG_PC <= PC_DATA_I; |
-- manual/branch pc update ---------------------------------------------- |
elsif (valid_branch = '1') or ((ex_ctrl_bus_i(ctrl_en_c) = '1') and (ex_ctrl_bus_i(ctrl_ctx_down_c) = '1')) then -- valid automatic/manual update/goto user mode |
sys_reg_pc <= pc_data_i; |
|
-- Automatic PC Update -------------------------------------------------- |
elsif (STOP_PC = '0') then -- update instruction address |
if (word_mode_en_c = false) then -- byte-addressed memory |
SYS_REG_PC <= Std_Logic_Vector(unsigned(SYS_REG_PC) + 2); -- byte increment |
else -- word-addressed memory |
SYS_REG_PC <= Std_Logic_Vector(unsigned(SYS_REG_PC) + 1); -- word increment |
end if; |
end if; |
-- automatic pc update -------------------------------------------------- |
elsif (stop_pc = '0') then -- update instruction address |
if (word_mode_en_c = false) then -- byte-addressed memory |
sys_reg_pc <= std_logic_vector(unsigned(sys_reg_pc) + 2); -- byte increment |
else -- word-addressed memory |
sys_reg_pc <= std_logic_vector(unsigned(sys_reg_pc) + 1); -- word increment |
end if; |
end if; |
|
end if; |
end if; |
end process SR_UPDATE; |
end if; |
end if; |
end process sr_update; |
|
|
|
-- MSR Flag Output ------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
FLAG_BUS_O(flag_z_c) <= SYS_REG_MSR(msr_usr_z_flag_c) when (MODE_BUFFER(1) = user_mode_c) else SYS_REG_MSR(msr_sys_z_flag_c); |
FLAG_BUS_O(flag_c_c) <= SYS_REG_MSR(msr_usr_c_flag_c) when (MODE_BUFFER(1) = user_mode_c) else SYS_REG_MSR(msr_sys_c_flag_c); |
FLAG_BUS_O(flag_o_c) <= SYS_REG_MSR(msr_usr_o_flag_c) when (MODE_BUFFER(1) = user_mode_c) else SYS_REG_MSR(msr_sys_o_flag_c); |
FLAG_BUS_O(flag_n_c) <= SYS_REG_MSR(msr_usr_n_flag_c) when (MODE_BUFFER(1) = user_mode_c) else SYS_REG_MSR(msr_sys_n_flag_c); |
FLAG_BUS_O(flag_t_c) <= SYS_REG_MSR(msr_usr_t_flag_c) when (MODE_BUFFER(1) = user_mode_c) else SYS_REG_MSR(msr_sys_t_flag_c); |
-- MSR Flag Output ------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
flag_bus_o(flag_z_c) <= sys_reg_msr(msr_usr_z_flag_c) when (mode_buffer(1) = user_mode_c) else sys_reg_msr(msr_sys_z_flag_c); |
flag_bus_o(flag_c_c) <= sys_reg_msr(msr_usr_c_flag_c) when (mode_buffer(1) = user_mode_c) else sys_reg_msr(msr_sys_c_flag_c); |
flag_bus_o(flag_o_c) <= sys_reg_msr(msr_usr_o_flag_c) when (mode_buffer(1) = user_mode_c) else sys_reg_msr(msr_sys_o_flag_c); |
flag_bus_o(flag_n_c) <= sys_reg_msr(msr_usr_n_flag_c) when (mode_buffer(1) = user_mode_c) else sys_reg_msr(msr_sys_n_flag_c); |
flag_bus_o(flag_t_c) <= sys_reg_msr(msr_usr_t_flag_c) when (mode_buffer(1) = user_mode_c) else sys_reg_msr(msr_sys_t_flag_c); |
|
-- Special Flag output -- |
MODE_O <= SYS_REG_MSR(msr_mode_flag_c); -- current operating mode (for PC parallel access) |
MODE_FF_O <= MODE_BUFFER(2); -- delayed current operating mode (for OF stage) |
-- special flag output -- |
mode_o <= sys_reg_msr(msr_mode_flag_c); -- current operating mode (for pc parallel access) |
mode_ff_o <= mode_buffer(2); -- delayed current operating mode (for of stage) |
|
|
|
-- MSR Data-Read Access -------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
MSR_RD_ACC: process(MA_CTRL_BUS_I, SYS_REG_MSR, MODE_BUFFER) |
variable msr_r_mode_v : std_logic_vector(2 downto 0); |
begin |
msr_r_mode_v := MODE_BUFFER(0) & MA_CTRL_BUS_I(ctrl_msr_am_1_c downto ctrl_msr_am_0_c); -- access from MA stage |
RD_MSR_O <= (others => '0'); |
case (msr_r_mode_v) is |
when "100" => -- system mode: full read access |
RD_MSR_O <= SYS_REG_MSR; |
when "101" => -- system mode: only read all ALU flags |
RD_MSR_O(msr_sys_z_flag_c) <= SYS_REG_MSR(msr_sys_z_flag_c); |
RD_MSR_O(msr_sys_c_flag_c) <= SYS_REG_MSR(msr_sys_c_flag_c); |
RD_MSR_O(msr_sys_o_flag_c) <= SYS_REG_MSR(msr_sys_o_flag_c); |
RD_MSR_O(msr_sys_n_flag_c) <= SYS_REG_MSR(msr_sys_n_flag_c); |
RD_MSR_O(msr_sys_t_flag_c) <= SYS_REG_MSR(msr_sys_t_flag_c); |
RD_MSR_O(msr_usr_z_flag_c) <= SYS_REG_MSR(msr_usr_z_flag_c); |
RD_MSR_O(msr_usr_c_flag_c) <= SYS_REG_MSR(msr_usr_c_flag_c); |
RD_MSR_O(msr_usr_o_flag_c) <= SYS_REG_MSR(msr_usr_o_flag_c); |
RD_MSR_O(msr_usr_n_flag_c) <= SYS_REG_MSR(msr_usr_n_flag_c); |
RD_MSR_O(msr_usr_t_flag_c) <= SYS_REG_MSR(msr_usr_t_flag_c); |
when "110" => -- system mode: only read system ALU flags |
RD_MSR_O(msr_sys_z_flag_c) <= SYS_REG_MSR(msr_sys_z_flag_c); |
RD_MSR_O(msr_sys_c_flag_c) <= SYS_REG_MSR(msr_sys_c_flag_c); |
RD_MSR_O(msr_sys_o_flag_c) <= SYS_REG_MSR(msr_sys_o_flag_c); |
RD_MSR_O(msr_sys_n_flag_c) <= SYS_REG_MSR(msr_sys_n_flag_c); |
RD_MSR_O(msr_sys_t_flag_c) <= SYS_REG_MSR(msr_sys_t_flag_c); |
when others => -- system/user mode: only read user ALU flags |
RD_MSR_O(msr_usr_z_flag_c) <= SYS_REG_MSR(msr_usr_z_flag_c); |
RD_MSR_O(msr_usr_c_flag_c) <= SYS_REG_MSR(msr_usr_c_flag_c); |
RD_MSR_O(msr_usr_o_flag_c) <= SYS_REG_MSR(msr_usr_o_flag_c); |
RD_MSR_O(msr_usr_n_flag_c) <= SYS_REG_MSR(msr_usr_n_flag_c); |
RD_MSR_O(msr_usr_t_flag_c) <= SYS_REG_MSR(msr_usr_t_flag_c); |
end case; |
end process MSR_RD_ACC; |
-- MSR Data-Read Access -------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
msr_rd_acc: process(ma_ctrl_bus_i, sys_reg_msr, mode_buffer) |
variable msr_r_mode_v : std_logic_vector(2 downto 0); |
begin |
msr_r_mode_v := mode_buffer(0) & ma_ctrl_bus_i(ctrl_msr_am_1_c downto ctrl_msr_am_0_c); -- access from ma stage |
rd_msr_o <= (others => '0'); |
case (msr_r_mode_v) is |
when "100" => -- system mode: full read access |
rd_msr_o <= sys_reg_msr; |
when "101" => -- system mode: only read all alu flags |
rd_msr_o(msr_sys_z_flag_c) <= sys_reg_msr(msr_sys_z_flag_c); |
rd_msr_o(msr_sys_c_flag_c) <= sys_reg_msr(msr_sys_c_flag_c); |
rd_msr_o(msr_sys_o_flag_c) <= sys_reg_msr(msr_sys_o_flag_c); |
rd_msr_o(msr_sys_n_flag_c) <= sys_reg_msr(msr_sys_n_flag_c); |
rd_msr_o(msr_sys_t_flag_c) <= sys_reg_msr(msr_sys_t_flag_c); |
rd_msr_o(msr_usr_z_flag_c) <= sys_reg_msr(msr_usr_z_flag_c); |
rd_msr_o(msr_usr_c_flag_c) <= sys_reg_msr(msr_usr_c_flag_c); |
rd_msr_o(msr_usr_o_flag_c) <= sys_reg_msr(msr_usr_o_flag_c); |
rd_msr_o(msr_usr_n_flag_c) <= sys_reg_msr(msr_usr_n_flag_c); |
rd_msr_o(msr_usr_t_flag_c) <= sys_reg_msr(msr_usr_t_flag_c); |
when "110" => -- system mode: only read system alu flags |
rd_msr_o(msr_sys_z_flag_c) <= sys_reg_msr(msr_sys_z_flag_c); |
rd_msr_o(msr_sys_c_flag_c) <= sys_reg_msr(msr_sys_c_flag_c); |
rd_msr_o(msr_sys_o_flag_c) <= sys_reg_msr(msr_sys_o_flag_c); |
rd_msr_o(msr_sys_n_flag_c) <= sys_reg_msr(msr_sys_n_flag_c); |
rd_msr_o(msr_sys_t_flag_c) <= sys_reg_msr(msr_sys_t_flag_c); |
when others => -- system/user mode: only read user alu flags |
rd_msr_o(msr_usr_z_flag_c) <= sys_reg_msr(msr_usr_z_flag_c); |
rd_msr_o(msr_usr_c_flag_c) <= sys_reg_msr(msr_usr_c_flag_c); |
rd_msr_o(msr_usr_o_flag_c) <= sys_reg_msr(msr_usr_o_flag_c); |
rd_msr_o(msr_usr_n_flag_c) <= sys_reg_msr(msr_usr_n_flag_c); |
rd_msr_o(msr_usr_t_flag_c) <= sys_reg_msr(msr_usr_t_flag_c); |
end case; |
end process msr_rd_acc; |
|
|
|
-- PC, M-Flag and UCP_P-Flag Delay Generator ----------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
DELAY_GEN: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
PC_1D_TMP <= (others => '0'); |
MODE_BUFFER <= (others => '0'); |
CP_PTC_O <= '0'; |
elsif (CE_I = '1') then |
CP_PTC_O <= SYS_REG_MSR(msr_usr_cp_ptc_c); -- user_coprocessor protection |
MODE_BUFFER <= SYS_REG_MSR(msr_mode_flag_c) & MODE_BUFFER(2 downto 1); |
if (STOP_PC = '0') then |
PC_1D_TMP <= SYS_REG_PC; |
-- MODE_BUFFER <= SYS_REG_MSR(msr_mode_flag_c) & MODE_BUFFER(2 downto 1); |
end if; |
end if; |
end if; |
end process DELAY_GEN; |
-- PC, M-Flag and UCP_P-Flag Delay Generator ----------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
delay_gen: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
pc_1d_tmp <= (others => '0'); |
mode_buffer <= (others => '0'); |
cp_ptc_o <= '0'; |
elsif (ce_i = '1') then |
cp_ptc_o <= sys_reg_msr(msr_usr_cp_ptc_c); -- user_coprocessor protection |
mode_buffer <= sys_reg_msr(msr_mode_flag_c) & mode_buffer(2 downto 1); |
if (stop_pc = '0') then |
pc_1d_tmp <= sys_reg_pc; |
-- mode_buffer <= sys_reg_msr(msr_mode_flag_c) & mode_buffer(2 downto 1); |
end if; |
end if; |
end if; |
end process delay_gen; |
|
-- SYS_REG_MSR(msr_mode_flag_c) -> M-Flag for IF Stage |
-- MODE_BUFFER(2) -> M-Flag for OF Stage |
-- MODE_BUFFER(1) -> M-Flag for EX Stage |
-- MODE_BUFFER(0) -> M-Flag for MA Stage |
-- sys_reg_msr(msr_mode_flag_c) -> m-flag for if stage |
-- mode_buffer(2) -> m-flag for of stage |
-- mode_buffer(1) -> m-flag for ex stage |
-- mode_buffer(0) -> m-flag for ma stage |
|
-- PC outputs -- |
PC_OUT_DRIVER: process(SYS_REG_PC) |
begin |
PC_O <= SYS_REG_PC; |
PC_O(0) <= '0'; |
end process PC_OUT_DRIVER; |
PC_1D_O <= PC_1D_TMP; -- 1x delayed |
-- pc outputs -- |
pc_out_driver: process(sys_reg_pc) |
begin |
pc_o <= sys_reg_pc; |
pc_o(0) <= '0'; |
end process pc_out_driver; |
pc_1d_o <= pc_1d_tmp; -- 1x delayed |
|
|
|
-- Branch Detector ------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
BRANCH_DETECTOR: process(EX_CTRL_BUS_I, SYS_REG_MSR, INT_REQ, MODE_BUFFER) |
variable z_v, c_v, o_v, n_v, t_v : std_logic; |
variable valid_v : std_logic; |
variable valid_branch_v : std_logic; |
variable manual_branch_v : std_logic; |
begin |
-- Branch Detector ------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
branch_detector: process(ex_ctrl_bus_i, sys_reg_msr, int_req, mode_buffer) |
variable z_v, c_v, o_v, n_v, t_v : std_logic; |
variable valid_v : std_logic; |
variable valid_branch_v : std_logic; |
variable manual_branch_v : std_logic; |
begin |
|
-- flag isolation (instruction from EX stage) -- |
if (MODE_BUFFER(1) = user_mode_c) then -- user mode |
z_v := SYS_REG_MSR(msr_usr_z_flag_c); |
c_v := SYS_REG_MSR(msr_usr_c_flag_c); |
o_v := SYS_REG_MSR(msr_usr_o_flag_c); |
n_v := SYS_REG_MSR(msr_usr_n_flag_c); |
t_v := SYS_REG_MSR(msr_usr_t_flag_c); |
else -- system mode |
z_v := SYS_REG_MSR(msr_sys_z_flag_c); |
c_v := SYS_REG_MSR(msr_sys_c_flag_c); |
o_v := SYS_REG_MSR(msr_sys_o_flag_c); |
n_v := SYS_REG_MSR(msr_sys_n_flag_c); |
t_v := SYS_REG_MSR(msr_sys_t_flag_c); |
end if; |
-- flag isolation (instruction from ex stage) -- |
if (mode_buffer(1) = user_mode_c) then -- user mode |
z_v := sys_reg_msr(msr_usr_z_flag_c); |
c_v := sys_reg_msr(msr_usr_c_flag_c); |
o_v := sys_reg_msr(msr_usr_o_flag_c); |
n_v := sys_reg_msr(msr_usr_n_flag_c); |
t_v := sys_reg_msr(msr_usr_t_flag_c); |
else -- system mode |
z_v := sys_reg_msr(msr_sys_z_flag_c); |
c_v := sys_reg_msr(msr_sys_c_flag_c); |
o_v := sys_reg_msr(msr_sys_o_flag_c); |
n_v := sys_reg_msr(msr_sys_n_flag_c); |
t_v := sys_reg_msr(msr_sys_t_flag_c); |
end if; |
|
-- condition check -- |
case (EX_CTRL_BUS_I(ctrl_cond_3_c downto ctrl_cond_0_c)) is |
when cond_eq_c => valid_v := z_v; -- equal |
when cond_ne_c => valid_v := not z_v; -- not equal |
when cond_cs_c => valid_v := c_v; -- unsigned higher or same |
when cond_cc_c => valid_v := not c_v; -- unsigned lower |
when cond_mi_c => valid_v := n_v; -- negative |
when cond_pl_c => valid_v := not n_v; -- positive or zero |
when cond_os_c => valid_v := o_v; -- overflow |
when cond_oc_c => valid_v := not o_v; -- no overflow |
when cond_hi_c => valid_v := c_v and (not z_v); -- unisgned higher |
when cond_ls_c => valid_v := (not c_v) or z_v; -- unsigned lower or same |
when cond_ge_c => valid_v := n_v xnor o_v; -- greater than or equal |
when cond_lt_c => valid_v := n_v xor o_v; -- less than |
when cond_gt_c => valid_v := (not z_v) and (n_v xnor o_v); -- greater than |
when cond_le_c => valid_v := z_v or (n_v xor o_v); -- less than or equal |
when cond_ts_c => valid_v := t_v; -- transfer set |
when cond_al_c => valid_v := '1'; -- always |
when others => valid_v := '0'; -- undefined = never |
end case; |
-- condition check -- |
case (ex_ctrl_bus_i(ctrl_cond_3_c downto ctrl_cond_0_c)) is |
when cond_eq_c => valid_v := z_v; -- equal |
when cond_ne_c => valid_v := not z_v; -- not equal |
when cond_cs_c => valid_v := c_v; -- unsigned higher or same |
when cond_cc_c => valid_v := not c_v; -- unsigned lower |
when cond_mi_c => valid_v := n_v; -- negative |
when cond_pl_c => valid_v := not n_v; -- positive or zero |
when cond_os_c => valid_v := o_v; -- overflow |
when cond_oc_c => valid_v := not o_v; -- no overflow |
when cond_hi_c => valid_v := c_v and (not z_v); -- unisgned higher |
when cond_ls_c => valid_v := (not c_v) or z_v; -- unsigned lower or same |
when cond_ge_c => valid_v := n_v xnor o_v; -- greater than or equal |
when cond_lt_c => valid_v := n_v xor o_v; -- less than |
when cond_gt_c => valid_v := (not z_v) and (n_v xnor o_v); -- greater than |
when cond_le_c => valid_v := z_v or (n_v xor o_v); -- less than or equal |
when cond_ts_c => valid_v := t_v; -- transfer set |
when cond_al_c => valid_v := '1'; -- always |
when others => valid_v := '0'; -- undefined = never |
end case; |
|
-- Condition true output -- |
COND_TRUE_O <= valid_v; |
-- condition true output -- |
cond_true_o <= valid_v; |
|
-- Manual branch? -- |
manual_branch_v := EX_CTRL_BUS_I(ctrl_pc_wr_c); |
-- manual branch? -- |
manual_branch_v := ex_ctrl_bus_i(ctrl_pc_wr_c); |
|
-- Valid branch command? -- |
valid_branch_v := EX_CTRL_BUS_I(ctrl_en_c) and ((EX_CTRL_BUS_I(ctrl_branch_c) and valid_v) or manual_branch_v); |
-- valid branch command? -- |
valid_branch_v := ex_ctrl_bus_i(ctrl_en_c) and ((ex_ctrl_bus_i(ctrl_branch_c) and valid_v) or manual_branch_v); |
|
-- Output to cycle arbiter -- |
VALID_BRANCH <= valid_branch_v;-- or INT_REQ; -- internal signal, no INT_REQ since it is redundant |
VALID_BRANCH_O <= valid_branch_v or INT_REQ; -- external signal |
-- output to cycle arbiter -- |
valid_branch <= valid_branch_v;-- or int_req; -- internal signal, no int_req since it is redundant |
valid_branch_o <= valid_branch_v or int_req; -- external signal |
|
end process BRANCH_DETECTOR; |
end process branch_detector; |
|
|
|
end SR_STRUCTURE; |
end sr_structure; |
/atlas_core/trunk/rtl/ATLAS_CPU.vhd
4,7 → 4,7
-- # This is the top entity of the CPU core. # |
-- # All submodules are instantiated here. # |
-- # **************************************************** # |
-- # Last modified: 23.03.2014 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
16,351 → 16,349
library work; |
use work.atlas_core_package.all; |
|
entity ATLAS_CPU is |
port ( |
entity atlas_cpu is |
port ( |
-- ############################################################################################### |
-- ## Global Control ## |
-- ############################################################################################### |
|
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
CE_I : in std_logic; -- clock enable, high-active |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
ce_i : in std_logic; -- clock enable, high-active |
|
-- ############################################################################################### |
-- ## Instruction Interface ## |
-- ############################################################################################### |
|
INSTR_ADR_O : out std_logic_vector(data_width_c-1 downto 0); -- instruction byte adr |
INSTR_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
INSTR_EN_O : out std_logic; -- allow IR update |
instr_adr_o : out std_logic_vector(data_width_c-1 downto 0); -- instruction byte adr |
instr_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
|
-- ############################################################################################### |
-- ## Data Interface ## |
-- ############################################################################################### |
|
-- Memory Arbitration -- |
SYS_MODE_O : out std_logic; -- current operating mode |
SYS_INT_O : out std_logic; -- interrupt processing |
-- memory arbitration -- |
sys_mode_o : out std_logic; -- current operating mode |
sys_int_o : out std_logic; -- interrupt processing |
|
-- Memory System -- |
MEM_REQ_O : out std_logic; -- mem access in next cycle |
MEM_RW_O : out std_logic; -- read write |
MEM_ADR_O : out std_logic_vector(data_width_c-1 downto 0); -- data byte adr |
MEM_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- write data |
MEM_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- read data |
-- memory system -- |
mem_req_o : out std_logic; -- mem access in next cycle |
mem_rw_o : out std_logic; -- read write |
mem_adr_o : out std_logic_vector(data_width_c-1 downto 0); -- data byte adr |
mem_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- write data |
mem_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- read data |
|
-- ############################################################################################### |
-- ## Coprocessor Interface ## |
-- ############################################################################################### |
|
USR_CP_EN_O : out std_logic; -- access to cp0 |
SYS_CP_EN_O : out std_logic; -- access to cp1 |
CP_OP_O : out std_logic; -- data transfer/processing |
CP_RW_O : out std_logic; -- read/write access |
CP_CMD_O : out std_logic_vector(cp_cmd_width_c-1 downto 0); -- register addresses / cmd |
CP_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- write data |
CP_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- read data cp0 OR cp1 |
usr_cp_en_o : out std_logic; -- access to cp0 |
sys_cp_en_o : out std_logic; -- access to cp1 |
cp_op_o : out std_logic; -- data transfer/processing |
cp_rw_o : out std_logic; -- read/write access |
cp_cmd_o : out std_logic_vector(cp_cmd_width_c-1 downto 0); -- register addresses / cmd |
cp_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- write data |
cp_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- read data cp0 or cp1 |
|
-- ############################################################################################### |
-- ## External Interrupt Lines ## |
-- ############################################################################################### |
|
EXT_INT_0_I : in std_logic; -- external interrupt request 0 |
EXT_INT_1_I : in std_logic -- external interrupt request 1 |
); |
end ATLAS_CPU; |
ext_int_0_i : in std_logic; -- external interrupt request 0 |
ext_int_1_i : in std_logic -- external interrupt request 1 |
); |
end atlas_cpu; |
|
architecture ATLAS_CPU_BEHAV of ATLAS_CPU is |
architecture atlas_cpu_behav of atlas_cpu is |
|
-- Global Nets -- |
signal G_CLK : std_logic; -- global clock line |
signal G_RST : std_logic; -- global reset line |
signal G_CE : std_logic; -- global clock enable |
-- global nets -- |
signal g_clk : std_logic; -- global clock line |
signal g_rst : std_logic; -- global reset line |
signal g_ce : std_logic; -- global clock enable |
|
-- Control Lines -- |
signal OF_CTRL : std_logic_vector(ctrl_width_c-1 downto 0); |
signal EX_CTRL : std_logic_vector(ctrl_width_c-1 downto 0); |
signal MA_CTRL : std_logic_vector(ctrl_width_c-1 downto 0); |
signal WB_CTRL : std_logic_vector(ctrl_width_c-1 downto 0); |
-- control lines -- |
signal of_ctrl : std_logic_vector(ctrl_width_c-1 downto 0); |
signal ex_ctrl : std_logic_vector(ctrl_width_c-1 downto 0); |
signal ma_ctrl : std_logic_vector(ctrl_width_c-1 downto 0); |
signal wb_ctrl : std_logic_vector(ctrl_width_c-1 downto 0); |
|
-- Forwarding Paths -- |
signal MA_FWD : std_logic_vector(fwd_width_c-1 downto 0); |
signal WB_FWD : std_logic_vector(fwd_width_c-1 downto 0); |
-- forwarding paths -- |
signal ma_fwd : std_logic_vector(fwd_width_c-1 downto 0); |
signal wb_fwd : std_logic_vector(fwd_width_c-1 downto 0); |
|
-- Data Lines -- |
signal WB_DATA : std_logic_vector(data_width_c-1 downto 0); -- write back data |
signal OP_A_DATA : std_logic_vector(data_width_c-1 downto 0); -- operand A data |
signal OP_B_DATA : std_logic_vector(data_width_c-1 downto 0); -- operand B data |
signal OP_C_DATA : std_logic_vector(data_width_c-1 downto 0); -- operand C data |
signal BP_A_DATA : std_logic_vector(data_width_c-1 downto 0); -- operand A bypass |
signal BP_C_DATA : std_logic_vector(data_width_c-1 downto 0); -- operand C bypass |
signal ALU_RES : std_logic_vector(data_width_c-1 downto 0); -- alu result |
signal MUL_RES : std_logic_vector(2*data_width_c-1 downto 0); -- mul result |
signal IMMEDIATE : std_logic_vector(data_width_c-1 downto 0); -- immediate value |
signal T_FLAG : std_logic; -- transfer flag |
signal MA_DATA : std_logic_vector(data_width_c-1 downto 0); -- ma stage result |
signal MEM_ADR_FB : std_logic_vector(data_width_c-1 downto 0); -- mem adr feedback |
-- data lines -- |
signal wb_data : std_logic_vector(data_width_c-1 downto 0); -- write back data |
signal op_a_data : std_logic_vector(data_width_c-1 downto 0); -- operand a data |
signal op_b_data : std_logic_vector(data_width_c-1 downto 0); -- operand b data |
signal op_c_data : std_logic_vector(data_width_c-1 downto 0); -- operand c data |
signal bp_a_data : std_logic_vector(data_width_c-1 downto 0); -- operand a bypass |
signal bp_c_data : std_logic_vector(data_width_c-1 downto 0); -- operand c bypass |
signal alu_res : std_logic_vector(data_width_c-1 downto 0); -- alu result |
signal mul_res : std_logic_vector(2*data_width_c-1 downto 0); -- mul result |
signal immediate : std_logic_vector(data_width_c-1 downto 0); -- immediate value |
signal t_flag : std_logic; -- transfer flag |
signal ma_data : std_logic_vector(data_width_c-1 downto 0); -- ma stage result |
signal mem_adr_fb : std_logic_vector(data_width_c-1 downto 0); -- mem adr feedback |
|
-- Program Counter -- |
signal PC_1D : std_logic_vector(data_width_c-1 downto 0); -- 1x delayed pc |
signal STOP_PC : std_logic; -- freeze PC |
-- program counter -- |
signal pc_1d : std_logic_vector(data_width_c-1 downto 0); -- 1x delayed pc |
signal stop_pc : std_logic; -- freeze pc |
|
-- Flag Stuff -- |
signal ALU_FLAG_I : std_logic_vector(flag_bus_width_c-1 downto 0); -- alu flag input |
signal ALU_FLAG_O : std_logic_vector(flag_bus_width_c-1 downto 0); -- alu flag output |
signal MSR_W_DATA : std_logic_vector(data_width_c-1 downto 0); -- msr write data |
signal MSR_R_DATA : std_logic_vector(data_width_c-1 downto 0); -- msr read data |
-- flag stuff -- |
signal alu_flag_i : std_logic_vector(flag_bus_width_c-1 downto 0); -- alu flag input |
signal alu_flag_o : std_logic_vector(flag_bus_width_c-1 downto 0); -- alu flag output |
signal msr_w_data : std_logic_vector(data_width_c-1 downto 0); -- msr write data |
signal msr_r_data : std_logic_vector(data_width_c-1 downto 0); -- msr read data |
|
-- Control Signals -- |
signal VALID_BRANCH : std_logic; -- taken branch |
signal EXC_POS : std_logic; -- exception would be possible |
signal EXC_TAKEN : std_logic; -- async interrupt taken |
signal WAKE_UP_CALL : std_logic; -- wake up from sleep |
signal MODE : std_logic; -- current operating mode |
signal MODE_FF : std_logic; -- delayed current operating mode |
signal COND_TRUE : std_logic; -- condition is true |
-- control signals -- |
signal valid_branch : std_logic; -- taken branch |
signal exc_pos : std_logic; -- exception would be possible |
signal exc_taken : std_logic; -- async interrupt taken |
signal wake_up_call : std_logic; -- wake up from sleep |
signal mode : std_logic; -- current operating mode |
signal mode_ff : std_logic; -- delayed current operating mode |
signal cond_true : std_logic; -- condition is true |
|
-- Opcode Decoder -- |
signal OP_CTRL : std_logic_vector(ctrl_width_c-1 downto 0); -- decoder contorl output |
signal MULTI_CYC : std_logic; -- multi-cycle indicator |
signal MULTI_CYC_REQ : std_logic; -- multi-cycle reqest |
signal INSTR_REG : std_logic_vector(data_width_c-1 downto 0); -- instruction register |
-- opcode decoder -- |
signal op_ctrl : std_logic_vector(ctrl_width_c-1 downto 0); -- decoder contorl output |
signal multi_cyc : std_logic; -- multi-cycle indicator |
signal multi_cyc_req : std_logic; -- multi-cycle reqest |
signal instr_reg : std_logic_vector(data_width_c-1 downto 0); -- instruction register |
|
-- Coprocessor -- |
signal CP_PTC : std_logic; -- user coprocessor protection |
-- coprocessor -- |
signal cp_ptc : std_logic; -- user coprocessor protection |
|
begin |
|
-- Global Signals -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
G_CLK <= CLK_I; |
G_CE <= CE_I; |
G_RST <= RST_I; |
-- Global Signals -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
g_clk <= clk_i; |
g_ce <= ce_i; |
g_rst <= rst_i; |
|
|
|
-- Opcode Decoder -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
Opcode_Decoder: OP_DEC |
port map ( |
-- Decoder Interface Input -- |
INSTR_I => INSTR_REG, -- instruction input |
INSTR_ADR_I => PC_1D, -- corresponding address |
T_FLAG_I => T_FLAG, -- T-Flag input |
M_FLAG_I => MODE_FF, -- Mode flag input |
MULTI_CYC_I => MULTI_CYC, -- multi-cycle indicator |
CP_PTC_I => CP_PTC, -- coprocessor protection |
-- Opcode Decoder -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
opcode_decoder: op_dec |
port map ( |
-- decoder interface input -- |
instr_i => instr_reg, -- instruction input |
instr_adr_i => pc_1d, -- corresponding address |
t_flag_i => t_flag, -- t-flag input |
m_flag_i => mode_ff, -- mode flag input |
multi_cyc_i => multi_cyc, -- multi-cycle indicator |
cp_ptc_i => cp_ptc, -- coprocessor protection |
|
-- Decoder Interface Output -- |
MULTI_CYC_REQ_O => MULTI_CYC_REQ, -- multi-cycle reqest |
CTRL_O => OP_CTRL, -- decoder ctrl lines |
IMM_O => IMMEDIATE -- immediate |
); |
-- decoder interface output -- |
multi_cyc_req_o => multi_cyc_req, -- multi-cycle reqest |
ctrl_o => op_ctrl, -- decoder ctrl lines |
imm_o => immediate -- immediate |
); |
|
|
|
-- Control System -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
Control_Spine: CTRL |
port map ( |
-- Global Control -- |
CLK_I => G_CLK, -- global clock line |
CE_I => G_CE, -- clock enable |
RST_I => G_RST, -- global reset line, sync, high-active |
-- Control System -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
control_spine: ctrl |
port map ( |
-- global control -- |
clk_i => g_clk, -- global clock line |
ce_i => g_ce, -- clock enable |
rst_i => g_rst, -- global reset line, sync, high-active |
|
-- Decoder Interface -- |
OP_DEC_CTRL_I => OP_CTRL, -- decoder ctrl lines |
MULTI_CYC_O => MULTI_CYC, -- multi-cycle indicator |
MULTI_CYC_REQ_I => MULTI_CYC_REQ, -- multi-cycle request |
INSTR_I => INSTR_DAT_I, -- instruction input |
INSTR_REG_O => INSTR_REG, -- instruction register |
-- decoder interface -- |
op_dec_ctrl_i => op_ctrl, -- decoder ctrl lines |
multi_cyc_o => multi_cyc, -- multi-cycle indicator |
multi_cyc_req_i => multi_cyc_req, -- multi-cycle request |
instr_i => instr_dat_i, -- instruction input |
instr_reg_o => instr_reg, -- instruction register |
|
-- Control Lines -- |
OF_CTRL_BUS_O => OF_CTRL, -- of stage control |
EX_CTRL_BUS_O => EX_CTRL, -- ex stage control |
MA_CTRL_BUS_O => MA_CTRL, -- ma stage control |
WB_CTRL_BUS_O => WB_CTRL, -- wb stage control |
-- control lines -- |
of_ctrl_bus_o => of_ctrl, -- of stage control |
ex_ctrl_bus_o => ex_ctrl, -- ex stage control |
ma_ctrl_bus_o => ma_ctrl, -- ma stage control |
wb_ctrl_bus_o => wb_ctrl, -- wb stage control |
|
-- Function Control -- |
COND_TRUE_I => COND_TRUE, -- condition is true |
VALID_BRANCH_I => VALID_BRANCH, -- valid branch detected |
EXC_TAKEN_I => EXC_TAKEN, -- excation execute |
WAKE_UP_I => WAKE_UP_CALL, -- wake up from sleep |
EXC_POS_O => EXC_POS, -- exception would be possible |
STOP_PC_O => STOP_PC, -- freeze program counter |
IR_UPDATE_EN_O => INSTR_EN_O -- enable instruction reg update |
); |
-- function control -- |
cond_true_i => cond_true, -- condition is true |
valid_branch_i => valid_branch, -- valid branch detected |
exc_taken_i => exc_taken, -- excation execute |
wake_up_i => wake_up_call, -- wake up from sleep |
exc_pos_o => exc_pos, -- exception would be possible |
stop_pc_o => stop_pc -- freeze program counter |
); |
|
|
|
-- Machine Status System ------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
System_Reg: SYS_REG |
port map ( |
-- Global Control -- |
CLK_I => G_CLK, -- global clock line |
CE_I => G_CE, -- clock enable |
RST_I => G_RST, -- global reset line, asyc |
-- Machine Status System ------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
system_reg: sys_reg |
port map ( |
-- global control -- |
clk_i => g_clk, -- global clock line |
ce_i => g_ce, -- clock enable |
rst_i => g_rst, -- global reset line, asyc |
|
-- Function Control -- |
EX_CTRL_BUS_I => EX_CTRL, -- ex stage control |
MA_CTRL_BUS_I => MA_CTRL, -- ma stage control |
EXT_INT_REQ0_I => EXT_INT_0_I, -- external interrupt request 0 |
EXT_INT_REQ1_I => EXT_INT_1_I, -- external interrupt request 1 |
-- function control -- |
ex_ctrl_bus_i => ex_ctrl, -- ex stage control |
ma_ctrl_bus_i => ma_ctrl, -- ma stage control |
ext_int_req0_i => ext_int_0_i, -- external interrupt request 0 |
ext_int_req1_i => ext_int_1_i, -- external interrupt request 1 |
|
-- Data Input -- |
FLAG_BUS_I => ALU_FLAG_O, -- flag input |
EXC_POS_I => EXC_POS, -- exception would be possible |
STOP_PC => STOP_PC, -- freeze pc |
PC_DATA_I => ALU_RES, -- PC write data |
MSR_DATA_I => MSR_W_DATA, -- MSR write data |
-- data input -- |
flag_bus_i => alu_flag_o, -- flag input |
exc_pos_i => exc_pos, -- exception would be possible |
stop_pc => stop_pc, -- freeze pc |
pc_data_i => alu_res, -- pc write data |
msr_data_i => msr_w_data, -- msr write data |
|
-- Data Output -- |
FLAG_BUS_O => ALU_FLAG_I, -- flag output |
VALID_BRANCH_O => VALID_BRANCH, -- valid branch detected |
EXC_EXECUTED_O => EXC_TAKEN, -- executed exception |
WAKE_UP_O => WAKE_UP_CALL, -- wake-up signal |
RD_MSR_O => MSR_R_DATA, -- read data msr |
PC_O => INSTR_ADR_O, -- pc output |
PC_1D_O => PC_1D, -- pc 1x delayed |
CP_PTC_O => CP_PTC, -- coprocessor protection |
COND_TRUE_O => COND_TRUE, -- condition is true |
MODE_O => MODE, -- current mode |
MODE_FF_O => MODE_FF -- delayed current mode |
); |
-- data output -- |
flag_bus_o => alu_flag_i, -- flag output |
valid_branch_o => valid_branch, -- valid branch detected |
exc_executed_o => exc_taken, -- executed exception |
wake_up_o => wake_up_call, -- wake-up signal |
rd_msr_o => msr_r_data, -- read data msr |
pc_o => instr_adr_o, -- pc output |
pc_1d_o => pc_1d, -- pc 1x delayed |
cp_ptc_o => cp_ptc, -- coprocessor protection |
cond_true_o => cond_true, -- condition is true |
mode_o => mode, -- current mode |
mode_ff_o => mode_ff -- delayed current mode |
); |
|
-- Control Lines -- |
SYS_MODE_O <= MODE; -- current operating mode |
SYS_INT_O <= EXC_TAKEN; -- exception taken |
-- control lines -- |
sys_mode_o <= mode; -- current operating mode |
sys_int_o <= exc_taken; -- exception taken |
|
|
|
-- OF Stage -------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
Operand_Fetch: REG_FILE |
port map ( |
-- Global Control -- |
CLK_I => G_CLK, -- global clock line |
CE_I => G_CE, -- clock enable |
RST_I => G_RST, -- global reset line, sync, high-active |
-- OF Stage -------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
operand_fetch: reg_file |
port map ( |
-- global control -- |
clk_i => g_clk, -- global clock line |
ce_i => g_ce, -- clock enable |
rst_i => g_rst, -- global reset line, sync, high-active |
|
-- Function Control -- |
WB_CTRL_BUS_I => WB_CTRL, -- wb stage control |
OF_CTRL_BUS_I => OF_CTRL, -- of stage control |
-- function control -- |
wb_ctrl_bus_i => wb_ctrl, -- wb stage control |
of_ctrl_bus_i => of_ctrl, -- of stage control |
|
-- Data Input -- |
WB_DATA_I => WB_DATA, -- write back data |
IMMEDIATE_I => IMMEDIATE, -- immediates |
PC_1D_I => PC_1D, -- pc 1x delayed |
WB_FWD_I => WB_FWD, -- WB stage forwarding path |
-- data input -- |
wb_data_i => wb_data, -- write back data |
immediate_i => immediate, -- immediates |
pc_1d_i => pc_1d, -- pc 1x delayed |
wb_fwd_i => wb_fwd, -- wb stage forwarding path |
|
-- Data Output -- |
OP_A_DATA_O => OP_A_DATA, -- operand A output |
OP_B_DATA_O => OP_B_DATA, -- operand B output |
OP_C_DATA_O => OP_C_DATA -- operand C output |
); |
-- data output -- |
op_a_data_o => op_a_data, -- operand a output |
op_b_data_o => op_b_data, -- operand b output |
op_c_data_o => op_c_data -- operand c output |
); |
|
|
|
-- EX Stage -------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
Executor: ALU |
port map ( |
-- Global Control -- |
CLK_I => G_CLK, -- global clock line |
CE_I => G_CE, -- clock enable |
RST_I => G_RST, -- global reset line, sync, high-active |
-- EX Stage -------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
executor: alu |
port map ( |
-- global control -- |
clk_i => g_clk, -- global clock line |
ce_i => g_ce, -- clock enable |
rst_i => g_rst, -- global reset line, sync, high-active |
|
-- Function Control -- |
EX_CTRL_BUS_I => EX_CTRL, -- stage control |
FLAG_BUS_I => ALU_FLAG_I, -- flag input |
-- function control -- |
ex_ctrl_bus_i => ex_ctrl, -- stage control |
flag_bus_i => alu_flag_i, -- flag input |
|
-- Data Input -- |
OP_A_I => OP_A_DATA, -- operand A input |
OP_B_I => OP_B_DATA, -- operand B input |
OP_C_I => OP_C_DATA, -- operand C input |
PC_1D_I => PC_1D, -- 1x delayed PC |
MA_FWD_I => MA_FWD, -- MA stage forwarding path |
WB_FWD_I => WB_FWD, -- WB stage forwarding path |
-- data input -- |
op_a_i => op_a_data, -- operand a input |
op_b_i => op_b_data, -- operand b input |
op_c_i => op_c_data, -- operand c input |
pc_1d_i => pc_1d, -- 1x delayed pc |
ma_fwd_i => ma_fwd, -- ma stage forwarding path |
wb_fwd_i => wb_fwd, -- wb stage forwarding path |
|
-- Data Output -- |
FLAG_BUS_O => ALU_FLAG_O, -- flag output |
MASK_T_FLAG_O => T_FLAG, -- T-Flag for mask generation |
MSR_DATA_O => MSR_W_DATA, -- MSR write data |
ALU_RES_O => ALU_RES, -- ALU result |
MUL_RES_O => MUL_RES, -- MUL result |
BP_OPA_O => BP_A_DATA, -- operand A bypass |
BP_OPC_O => BP_C_DATA, -- operand C bypass |
-- data output -- |
flag_bus_o => alu_flag_o, -- flag output |
mask_t_flag_o => t_flag, -- t-flag for mask generation |
msr_data_o => msr_w_data, -- msr write data |
alu_res_o => alu_res, -- alu result |
mul_res_o => mul_res, -- mul result |
bp_opa_o => bp_a_data, -- operand a bypass |
bp_opc_o => bp_c_data, -- operand c bypass |
|
-- Coprocessor Interface -- |
CP_CP0_EN_O => USR_CP_EN_O, -- access to cp0 |
CP_CP1_EN_O => SYS_CP_EN_O, -- access to cp1 |
CP_OP_O => CP_OP_O, -- data transfer/operation |
CP_RW_O => CP_RW_O, -- read/write access |
CP_CMD_O => CP_CMD_O, -- register addresses / cmd |
CP_DAT_O => CP_DAT_O, -- write data |
-- coprocessor interface -- |
cp_cp0_en_o => usr_cp_en_o, -- access to cp0 |
cp_cp1_en_o => sys_cp_en_o, -- access to cp1 |
cp_op_o => cp_op_o, -- data transfer/operation |
cp_rw_o => cp_rw_o, -- read/write access |
cp_cmd_o => cp_cmd_o, -- register addresses / cmd |
cp_dat_o => cp_dat_o, -- write data |
|
-- Memory access -- |
MEM_REQ_O => MEM_REQ_O -- data memory access request for next cycle |
); |
-- memory access -- |
mem_req_o => mem_req_o -- data memory access request for next cycle |
); |
|
|
|
-- MA Stage -------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
Memory_Access: MEM_ACC |
port map ( |
-- Global Control -- |
CLK_I => G_CLK, -- global clock line |
CE_I => G_CE, -- clock enable |
RST_I => G_RST, -- global reset line, asyc |
-- MA Stage -------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
memory_access: mem_acc |
port map ( |
-- global control -- |
clk_i => g_clk, -- global clock line |
ce_i => g_ce, -- clock enable |
rst_i => g_rst, -- global reset line, asyc |
|
-- Function Control -- |
MA_CTRL_BUS_I => MA_CTRL, -- ma stage control |
-- function control -- |
ma_ctrl_bus_i => ma_ctrl, -- ma stage control |
|
-- Data Input -- |
ALU_RES_I => ALU_RES, -- alu result |
MUL_RES_I => MUL_RES, -- mul result |
ADR_BASE_I => BP_A_DATA, -- op_a bypass |
DATA_BP_I => BP_C_DATA, -- op_b bypass |
CP_DATA_I => CP_DAT_I, -- coprocessor rd data |
RD_MSR_I => MSR_R_DATA, -- read data msr |
WB_FWD_I => WB_FWD, -- WB stage forwarding path |
-- data input -- |
alu_res_i => alu_res, -- alu result |
mul_res_i => mul_res, -- mul result |
adr_base_i => bp_a_data, -- op_a bypass |
data_bp_i => bp_c_data, -- op_b bypass |
cp_data_i => cp_dat_i, -- coprocessor rd data |
rd_msr_i => msr_r_data, -- read data msr |
wb_fwd_i => wb_fwd, -- wb stage forwarding path |
|
-- Data Output -- |
DATA_O => MA_DATA, -- data output |
MEM_ADR_FB_O => MEM_ADR_FB, -- memory address feedback |
MA_FWD_O => MA_FWD, -- MA stage forwarding path |
-- data output -- |
data_o => ma_data, -- data output |
mem_adr_fb_o => mem_adr_fb, -- memory address feedback |
ma_fwd_o => ma_fwd, -- ma stage forwarding path |
|
-- Memory (w) Interface -- |
MEM_ADR_O => MEM_ADR_O, -- address output |
MEM_DAT_O => MEM_DAT_O, -- write data output |
MEM_RW_O => MEM_RW_O -- read write |
); |
-- memory (w) interface -- |
mem_adr_o => mem_adr_o, -- address output |
mem_dat_o => mem_dat_o, -- write data output |
mem_rw_o => mem_rw_o -- read write |
); |
|
|
|
-- WB Stage -------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
Write_Back: WB_UNIT |
port map ( |
-- Global Control -- |
CLK_I => G_CLK, -- global clock line |
CE_I => G_CE, -- clock enable |
RST_I => G_RST, -- global reset line, sync, high-active |
-- WB Stage -------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
write_back: wb_unit |
port map ( |
-- global control -- |
clk_i => g_clk, -- global clock line |
ce_i => g_ce, -- clock enable |
rst_i => g_rst, -- global reset line, sync, high-active |
|
-- Function Control -- |
WB_CTRL_BUS_I => WB_CTRL, -- wb stage control |
-- function control -- |
wb_ctrl_bus_i => wb_ctrl, -- wb stage control |
|
-- Data Input -- |
MEM_WB_DAT_I => MEM_DAT_I, -- memory read data |
ALU_WB_DAT_I => MA_DATA, -- alu read data |
MEM_ADR_FB_I => MEM_ADR_FB, -- memory address feedback |
-- data input -- |
mem_wb_dat_i => mem_dat_i, -- memory read data |
alu_wb_dat_i => ma_data, -- alu read data |
mem_adr_fb_i => mem_adr_fb, -- memory address feedback |
|
-- Data Output -- |
WB_DATA_O => WB_DATA, -- write back data |
WB_FWD_O => WB_FWD -- WB stage forwarding path |
); |
-- data output -- |
wb_data_o => wb_data, -- write back data |
wb_fwd_o => wb_fwd -- wb stage forwarding path |
); |
|
|
|
/atlas_core/trunk/rtl/ATLAS_2K_BASE_TOP.vhd
11,7 → 11,7
-- # declared in this section (in Hz). # |
-- # # |
-- # ***************************************************** # |
-- # Last modified: 16.05.2014 # |
-- # Last modified: 28.11.2014 # |
-- # ***************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################### |
23,273 → 23,269
library work; |
use work.atlas_core_package.all; |
|
entity ATLAS_2K_BASE_TOP is |
port ( |
entity atlas_2k_base_top is |
port ( |
-- ############################################################################################### |
-- ## Global Signals ## |
-- ############################################################################################### |
|
CLK_I : in std_logic; -- global clock line |
RSTN_I : in std_logic; -- global reset line, low-active |
clk_i : in std_logic; -- global clock line |
rstn_i : in std_logic; -- global reset line, low-active |
|
-- ############################################################################################### |
-- ## IO Interface ## |
-- ############################################################################################### |
|
-- UART -- |
UART_RXD_I : in std_logic; -- receiver input |
UART_TXD_O : out std_logic; -- UART transmitter output |
-- uart -- |
uart_rxd_i : in std_logic; -- receiver input |
uart_txd_o : out std_logic; -- uart transmitter output |
|
-- SPI -- |
SPI_MOSI_O : out std_logic_vector(07 downto 0); -- serial data out |
SPI_MISO_I : in std_logic_vector(07 downto 0); -- serial data in |
SPI_SCK_O : out std_logic_vector(07 downto 0); -- serial clock out |
SPI_CS_O : out std_logic_vector(07 downto 0); -- chip select (low active) |
-- spi -- |
spi_mosi_o : out std_logic_vector(07 downto 0); -- serial data out |
spi_miso_i : in std_logic_vector(07 downto 0); -- serial data in |
spi_sck_o : out std_logic_vector(07 downto 0); -- serial clock out |
spi_cs_o : out std_logic_vector(07 downto 0); -- chip select (low active) |
|
-- PIO -- |
PIO_OUT_O : out std_logic_vector(15 downto 0); -- parallel output |
PIO_IN_I : in std_logic_vector(15 downto 0); -- parallel input |
-- pio -- |
pio_out_o : out std_logic_vector(15 downto 0); -- parallel output |
pio_in_i : in std_logic_vector(15 downto 0); -- parallel input |
|
-- System IO (bootloader, NOS, ...) -- |
SYS_OUT_O : out std_logic_vector(07 downto 0); -- system output |
SYS_IN_I : in std_logic_vector(07 downto 0); -- system input |
-- system io (bootloader, nos, ...) -- |
sys_out_o : out std_logic_vector(07 downto 0); -- system output |
sys_in_i : in std_logic_vector(07 downto 0); -- system input |
|
-- ############################################################################################### |
-- ## Wishbone Bus ## |
-- ############################################################################################### |
|
WB_CLK_O : out std_logic; -- bus clock |
WB_RST_O : out std_logic; -- bus reset, sync, high active |
WB_ADR_O : out std_logic_vector(31 downto 0); -- address |
WB_SEL_O : out std_logic_vector(01 downto 0); -- byte select |
WB_DATA_O : out std_logic_vector(15 downto 0); -- data out |
WB_DATA_I : in std_logic_vector(15 downto 0); -- data in |
WB_WE_O : out std_logic; -- read/write |
WB_CYC_O : out std_logic; -- cycle enable |
WB_STB_O : out std_logic; -- strobe |
WB_ACK_I : in std_logic; -- acknowledge |
WB_ERR_I : in std_logic -- bus error |
); |
end ATLAS_2K_BASE_TOP; |
wb_clk_o : out std_logic; -- bus clock |
wb_rst_o : out std_logic; -- bus reset, sync, high active |
wb_adr_o : out std_logic_vector(31 downto 0); -- address |
wb_sel_o : out std_logic_vector(01 downto 0); -- byte select |
wb_data_o : out std_logic_vector(15 downto 0); -- data out |
wb_data_i : in std_logic_vector(15 downto 0); -- data in |
wb_we_o : out std_logic; -- read/write |
wb_cyc_o : out std_logic; -- cycle enable |
wb_stb_o : out std_logic; -- strobe |
wb_ack_i : in std_logic; -- acknowledge |
wb_err_i : in std_logic -- bus error |
); |
end atlas_2k_base_top; |
|
architecture ATLAS_2K_BASE_TOP_STRUCTURE of ATLAS_2K_BASE_TOP is |
architecture atlas_2k_base_top_structure of atlas_2k_base_top is |
|
-- Component: Atlas-2K Processor ---------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component ATLAS_2K_TOP |
generic ( |
CLK_SPEED_G : std_logic_vector(31 downto 0) := (others => '0') -- clock speed (in Hz) |
); |
port ( |
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
CE_I : in std_logic; -- global clock enable, high active |
CP_EN_O : out std_logic; -- access to cp0 |
CP_ICE_O : out std_logic; -- cp interface clock enable |
CP_OP_O : out std_logic; -- data transfer/processing |
CP_RW_O : out std_logic; -- read/write access |
CP_CMD_O : out std_logic_vector(08 downto 0); -- register addresses / cmd |
CP_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- write data |
CP_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- read data cp0 |
MEM_I_PAGE_O : out std_logic_vector(data_width_c-1 downto 0); -- instruction page |
MEM_I_ADR_O : out std_logic_vector(data_width_c-1 downto 0); -- instruction adr |
MEM_I_EN_O : out std_logic; -- IR update |
MEM_I_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
MEM_D_EN_O : out std_logic; -- access enable |
MEM_D_RW_O : out std_logic; -- read/write |
MEM_D_PAGE_O : out std_logic_vector(data_width_c-1 downto 0); -- data page |
MEM_D_ADR_O : out std_logic_vector(data_width_c-1 downto 0); -- data adr |
MEM_D_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- data out |
MEM_D_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- data in |
CRITICAL_IRQ_I : in std_logic; -- critical error IRQ |
UART_RXD_I : in std_logic; -- receiver input |
UART_TXD_O : out std_logic; -- UART transmitter output |
SPI_MOSI_O : out std_logic_vector(07 downto 0); -- serial data out |
SPI_MISO_I : in std_logic_vector(07 downto 0); -- serial data in |
SPI_SCK_O : out std_logic_vector(07 downto 0); -- serial clock out |
SPI_CS_O : out std_logic_vector(07 downto 0); -- chip select (low active) |
PIO_OUT_O : out std_logic_vector(15 downto 0); -- parallel output |
PIO_IN_I : in std_logic_vector(15 downto 0); -- parallel input |
SYS_OUT_O : out std_logic_vector(07 downto 0); -- system parallel output |
SYS_IN_I : in std_logic_vector(07 downto 0); -- system parallel input |
IRQ_I : in std_logic; -- IRQ |
WB_CLK_O : out std_logic; -- bus clock |
WB_RST_O : out std_logic; -- bus reset, sync, high active |
WB_ADR_O : out std_logic_vector(31 downto 0); -- address |
WB_SEL_O : out std_logic_vector(01 downto 0); -- byte select |
WB_DATA_O : out std_logic_vector(15 downto 0); -- data out |
WB_DATA_I : in std_logic_vector(15 downto 0); -- data in |
WB_WE_O : out std_logic; -- read/write |
WB_CYC_O : out std_logic; -- cycle enable |
WB_STB_O : out std_logic; -- strobe |
WB_ACK_I : in std_logic; -- acknowledge |
WB_ERR_I : in std_logic -- bus error |
); |
component atlas_2k_top |
generic ( |
clk_speed_g : std_logic_vector(31 downto 0) := (others => '0') -- clock speed (in hz) |
); |
port ( |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
ce_i : in std_logic; -- global clock enable, high active |
cp_en_o : out std_logic; -- access to cp0 |
cp_ice_o : out std_logic; -- cp interface clock enable |
cp_op_o : out std_logic; -- data transfer/processing |
cp_rw_o : out std_logic; -- read/write access |
cp_cmd_o : out std_logic_vector(08 downto 0); -- register addresses / cmd |
cp_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- write data |
cp_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- read data cp0 |
mem_i_page_o : out std_logic_vector(data_width_c-1 downto 0); -- instruction page |
mem_i_adr_o : out std_logic_vector(data_width_c-1 downto 0); -- instruction adr |
mem_i_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
mem_d_en_o : out std_logic; -- access enable |
mem_d_rw_o : out std_logic; -- read/write |
mem_d_page_o : out std_logic_vector(data_width_c-1 downto 0); -- data page |
mem_d_adr_o : out std_logic_vector(data_width_c-1 downto 0); -- data adr |
mem_d_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- data out |
mem_d_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- data in |
critical_irq_i : in std_logic; -- critical error irq |
uart_rxd_i : in std_logic; -- receiver input |
uart_txd_o : out std_logic; -- uart transmitter output |
spi_mosi_o : out std_logic_vector(07 downto 0); -- serial data out |
spi_miso_i : in std_logic_vector(07 downto 0); -- serial data in |
spi_sck_o : out std_logic_vector(07 downto 0); -- serial clock out |
spi_cs_o : out std_logic_vector(07 downto 0); -- chip select (low active) |
pio_out_o : out std_logic_vector(15 downto 0); -- parallel output |
pio_in_i : in std_logic_vector(15 downto 0); -- parallel input |
sys_out_o : out std_logic_vector(07 downto 0); -- system parallel output |
sys_in_i : in std_logic_vector(07 downto 0); -- system parallel input |
irq_i : in std_logic; -- irq |
wb_clk_o : out std_logic; -- bus clock |
wb_rst_o : out std_logic; -- bus reset, sync, high active |
wb_adr_o : out std_logic_vector(31 downto 0); -- address |
wb_sel_o : out std_logic_vector(01 downto 0); -- byte select |
wb_data_o : out std_logic_vector(15 downto 0); -- data out |
wb_data_i : in std_logic_vector(15 downto 0); -- data in |
wb_we_o : out std_logic; -- read/write |
wb_cyc_o : out std_logic; -- cycle enable |
wb_stb_o : out std_logic; -- strobe |
wb_ack_i : in std_logic; -- acknowledge |
wb_err_i : in std_logic -- bus error |
); |
end component; |
|
-- RAM ------------------------------------------------------------------------------------ |
-- ------------------------------------------------------------------------------------------- |
component INT_RAM |
generic ( |
MEM_SIZE_G : natural := 256 -- memory size in words |
); |
port ( |
-- Host Interface -- |
CLK_I : in std_logic; -- global clock line |
I_ADR_I : in std_logic_vector(31 downto 0); -- instruction adr |
I_EN_I : in std_logic; -- IR update |
I_DAT_O : out std_logic_vector(15 downto 0); -- instruction out |
D_EN_I : in std_logic; -- access enable |
D_RW_I : in std_logic; -- read/write |
D_ADR_I : in std_logic_vector(31 downto 0); -- data adr |
D_DAT_I : in std_logic_vector(15 downto 0); -- data in |
D_DAT_O : out std_logic_vector(15 downto 0) -- data out |
); |
component int_ram |
generic ( |
mem_size_g : natural := 256 -- memory size in words |
); |
port ( |
-- host interface -- |
clk_i : in std_logic; -- global clock line |
i_adr_i : in std_logic_vector(31 downto 0); -- instruction adr |
i_dat_o : out std_logic_vector(15 downto 0); -- instruction out |
d_en_i : in std_logic; -- access enable |
d_rw_i : in std_logic; -- read/write |
d_adr_i : in std_logic_vector(31 downto 0); -- data adr |
d_dat_i : in std_logic_vector(15 downto 0); -- data in |
d_dat_o : out std_logic_vector(15 downto 0) -- data out |
); |
end component; |
|
-- *** USER CONFIGURATION *** |
-- *********************************************************************************************** |
constant clk_speed_c : std_logic_vector(31 downto 0) := x"02FAF080"; -- clock speed in Hz (here =50MHz) |
constant num_pages_c : natural := 4; -- number of pages (must be a power of 2) |
constant page_size_c : natural := 4096; -- page size in bytes (must be a power of 2) |
constant clk_speed_c : std_logic_vector(31 downto 0) := x"02FAF080"; -- clock speed in Hz (here =50MHz) |
constant num_pages_c : natural := 4; -- number of pages (must be a power of 2) |
constant page_size_c : natural := 4096; -- page size in bytes (must be a power of 2) |
-- *********************************************************************************************** |
|
-- Internals... - |
constant ram_size_c : natural := num_pages_c*page_size_c; -- internal RAM size in bytes |
constant ld_pg_size_c : natural := log2(page_size_c); -- page select address width |
constant ld_num_pg_c : natural := log2(num_pages_c); -- page size address width |
-- internals... - |
constant ram_size_c : natural := num_pages_c*page_size_c; -- internal ram size in bytes |
constant ld_pg_size_c : natural := log2(page_size_c); -- page select address width |
constant ld_num_pg_c : natural := log2(num_pages_c); -- page size address width |
|
-- Global Signals -- |
signal G_CLK : std_logic; |
signal G_RST : std_logic; |
-- global signals -- |
signal g_clk : std_logic; |
signal g_rst : std_logic; |
|
-- Memory Interface -- |
signal I_ADR, D_ADR : std_logic_vector(data_width_c-1 downto 0); |
signal I_PAGE, D_PAGE : std_logic_vector(data_width_c-1 downto 0); |
signal I_EN, D_EN : std_logic; |
signal D_RW : std_logic; |
signal I_DAT_O, D_DAT_O : std_logic_vector(data_width_c-1 downto 0); |
signal D_DAT_I : std_logic_vector(data_width_c-1 downto 0); |
signal MEM_D_ADR : std_logic_vector(31 downto 0); |
signal MEM_I_ADR : std_logic_vector(31 downto 0); |
-- memory interface -- |
signal i_adr, d_adr : std_logic_vector(data_width_c-1 downto 0); |
signal i_page, d_page : std_logic_vector(data_width_c-1 downto 0); |
signal d_en : std_logic; |
signal d_rw : std_logic; |
signal i_dat_o, d_dat_o : std_logic_vector(data_width_c-1 downto 0); |
signal d_dat_i : std_logic_vector(data_width_c-1 downto 0); |
signal mem_d_adr : std_logic_vector(31 downto 0); |
signal mem_i_adr : std_logic_vector(31 downto 0); |
|
-- IRQ -- |
signal CRITICAL_IRQ : std_logic; |
-- irq -- |
signal critical_irq : std_logic; |
|
begin |
|
-- Clock/Reset ----------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
G_RST <= not RSTN_I; |
G_CLK <= CLK_I; |
-- Clock/Reset ----------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
g_rst <= not rstn_i; |
g_clk <= clk_i; |
|
|
|
-- Core ------------------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
the_core_of_the_problem: ATLAS_2K_TOP |
generic map ( |
CLK_SPEED_G => clk_speed_c -- clock speed (in Hz) |
) |
port map ( |
CLK_I => G_CLK, -- global clock line |
RST_I => G_RST, -- global reset line, sync, high-active |
CE_I => '1', -- global clock enable, high active |
-- Core ------------------------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
the_core_of_the_problem: atlas_2k_top |
generic map ( |
clk_speed_g => clk_speed_c -- clock speed (in hz) |
) |
port map ( |
clk_i => g_clk, -- global clock line |
rst_i => g_rst, -- global reset line, sync, high-active |
ce_i => '1', -- global clock enable, high active |
|
CP_EN_O => open, -- access to cp0 |
CP_ICE_O => open, -- cp interface clock enable |
CP_OP_O => open, -- data transfer/processing |
CP_RW_O => open, -- read/write access |
CP_CMD_O => open, -- register addresses / cmd |
CP_DAT_O => open, -- write data |
CP_DAT_I => x"0000", -- read data cp0 |
cp_en_o => open, -- access to cp0 |
cp_ice_o => open, -- cp interface clock enable |
cp_op_o => open, -- data transfer/processing |
cp_rw_o => open, -- read/write access |
cp_cmd_o => open, -- register addresses / cmd |
cp_dat_o => open, -- write data |
cp_dat_i => x"0000", -- read data cp0 |
|
MEM_I_PAGE_O => I_PAGE, -- instruction page |
MEM_I_ADR_O => I_ADR, -- instruction adr |
MEM_I_EN_O => I_EN, -- IR update |
MEM_I_DAT_I => I_DAT_O, -- instruction input |
MEM_D_EN_O => D_EN, -- access enable |
MEM_D_RW_O => D_RW, -- read/write |
MEM_D_PAGE_O => D_PAGE, -- data page |
MEM_D_ADR_O => D_ADR, -- data adr |
MEM_D_DAT_O => D_DAT_I, -- data out |
MEM_D_DAT_I => D_DAT_O, -- data in |
CRITICAL_IRQ_I => CRITICAL_IRQ, -- critical error IRQ |
mem_i_page_o => i_page, -- instruction page |
mem_i_adr_o => i_adr, -- instruction adr |
mem_i_dat_i => i_dat_o, -- instruction input |
mem_d_en_o => d_en, -- access enable |
mem_d_rw_o => d_rw, -- read/write |
mem_d_page_o => d_page, -- data page |
mem_d_adr_o => d_adr, -- data adr |
mem_d_dat_o => d_dat_i, -- data out |
mem_d_dat_i => d_dat_o, -- data in |
critical_irq_i => critical_irq, -- critical error irq |
|
UART_RXD_I => UART_RXD_I, -- receiver input |
UART_TXD_O => UART_TXD_O, -- UART transmitter output |
uart_rxd_i => uart_rxd_i, -- receiver input |
uart_txd_o => uart_txd_o, -- uart transmitter output |
|
SPI_SCK_O => SPI_SCK_O, -- serial clock output |
SPI_MOSI_O => SPI_MOSI_O, -- serial data output |
SPI_MISO_I => SPI_MISO_I, -- serial data input |
SPI_CS_O => SPI_CS_O, -- device select - low-active |
spi_sck_o => spi_sck_o, -- serial clock output |
spi_mosi_o => spi_mosi_o, -- serial data output |
spi_miso_i => spi_miso_i, -- serial data input |
spi_cs_o => spi_cs_o, -- device select - low-active |
|
PIO_OUT_O => PIO_OUT_O, -- parallel output |
PIO_IN_I => PIO_IN_I, -- parallel input |
pio_out_o => pio_out_o, -- parallel output |
pio_in_i => pio_in_i, -- parallel input |
|
SYS_OUT_O => SYS_OUT_O, -- system parallel output |
SYS_IN_I => SYS_IN_I, -- system parallel input |
sys_out_o => sys_out_o, -- system parallel output |
sys_in_i => sys_in_i, -- system parallel input |
|
IRQ_I => '0', -- IRQ - not used here |
irq_i => '0', -- irq - not used here |
|
WB_CLK_O => WB_CLK_O, -- bus clock |
WB_RST_O => WB_RST_O, -- bus reset, sync, high active |
WB_ADR_O => WB_ADR_O, -- address |
WB_SEL_O => WB_SEL_O, -- byte select |
WB_DATA_O => WB_DATA_O, -- data out |
WB_DATA_I => WB_DATA_I, -- data in |
WB_WE_O => WB_WE_O, -- read/write |
WB_CYC_O => WB_CYC_O, -- cycle enable |
WB_STB_O => WB_STB_O, -- strobe |
WB_ACK_I => WB_ACK_I, -- acknowledge |
WB_ERR_I => WB_ERR_I -- bus error |
); |
wb_clk_o => wb_clk_o, -- bus clock |
wb_rst_o => wb_rst_o, -- bus reset, sync, high active |
wb_adr_o => wb_adr_o, -- address |
wb_sel_o => wb_sel_o, -- byte select |
wb_data_o => wb_data_o, -- data out |
wb_data_i => wb_data_i, -- data in |
wb_we_o => wb_we_o, -- read/write |
wb_cyc_o => wb_cyc_o, -- cycle enable |
wb_stb_o => wb_stb_o, -- strobe |
wb_ack_i => wb_ack_i, -- acknowledge |
wb_err_i => wb_err_i -- bus error |
); |
|
|
|
-- Memory Mapping -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
MEMORY_MAPPING: process(I_PAGE, D_PAGE, I_ADR, D_ADR) |
begin |
-- default -- |
MEM_I_ADR <= (others => '0'); |
MEM_D_ADR <= (others => '0'); |
-- Memory Mapping -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
memory_mapping: process(i_page, d_page, i_adr, d_adr) |
begin |
-- default -- |
mem_i_adr <= (others => '0'); |
mem_d_adr <= (others => '0'); |
|
-- page address -- |
MEM_I_ADR(ld_pg_size_c-1 downto 0) <= I_ADR(ld_pg_size_c-1 downto 0); |
MEM_D_ADR(ld_pg_size_c-1 downto 0) <= D_ADR(ld_pg_size_c-1 downto 0); |
-- page address -- |
mem_i_adr(ld_pg_size_c-1 downto 0) <= i_adr(ld_pg_size_c-1 downto 0); |
mem_d_adr(ld_pg_size_c-1 downto 0) <= d_adr(ld_pg_size_c-1 downto 0); |
|
-- page number -- |
MEM_I_ADR((ld_pg_size_c+ld_num_pg_c)-1 downto ld_pg_size_c) <= I_PAGE(ld_num_pg_c-1 downto 0); |
MEM_D_ADR((ld_pg_size_c+ld_num_pg_c)-1 downto ld_pg_size_c) <= D_PAGE(ld_num_pg_c-1 downto 0); |
end process MEMORY_MAPPING; |
-- page number -- |
mem_i_adr((ld_pg_size_c+ld_num_pg_c)-1 downto ld_pg_size_c) <= i_page(ld_num_pg_c-1 downto 0); |
mem_d_adr((ld_pg_size_c+ld_num_pg_c)-1 downto ld_pg_size_c) <= d_page(ld_num_pg_c-1 downto 0); |
end process memory_mapping; |
|
|
|
-- Internal RAM ---------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
internal_ram: INT_RAM |
generic map ( |
MEM_SIZE_G => ram_size_c -- memory size in bytes |
) |
port map ( |
-- Host Interface -- |
CLK_I => G_CLK, -- global clock line |
I_ADR_I => MEM_I_ADR, -- instruction adr |
I_EN_I => I_EN, -- IR update |
I_DAT_O => I_DAT_O, -- instruction out |
D_EN_I => D_EN, -- access enable |
D_RW_I => D_RW, -- read/write |
D_ADR_I => MEM_D_ADR, -- data adr |
D_DAT_I => D_DAT_I, -- data in |
D_DAT_O => D_DAT_O -- data out |
); |
-- Internal RAM ---------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
internal_ram: int_ram |
generic map ( |
mem_size_g => ram_size_c -- memory size in bytes |
) |
port map ( |
-- host interface -- |
clk_i => g_clk, -- global clock line |
i_adr_i => mem_i_adr, -- instruction adr |
i_dat_o => i_dat_o, -- instruction out |
d_en_i => d_en, -- access enable |
d_rw_i => d_rw, -- read/write |
d_adr_i => mem_d_adr, -- data adr |
d_dat_i => d_dat_i, -- data in |
d_dat_o => d_dat_o -- data out |
); |
|
|
|
-- User Section ---------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
CRITICAL_IRQ <= '0'; |
-- User Section ---------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
critical_irq <= '0'; |
|
|
end ATLAS_2K_BASE_TOP_STRUCTURE; |
end atlas_2k_base_top_structure; |
/atlas_core/trunk/rtl/REG_FILE.vhd
5,7 → 5,7
-- # separated for each operating mode. Each bank holds # |
-- # 8 16-bit data registers. # |
-- # **************************************************** # |
-- # Last modified: 09.03.2013 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
17,95 → 17,95
library work; |
use work.atlas_core_package.all; |
|
entity REG_FILE is |
port ( |
entity reg_file is |
port ( |
-- ############################################################################################### |
-- ## Global Control ## |
-- ############################################################################################### |
|
CLK_I : in std_logic; -- global clock line |
CE_I : in std_logic; -- clock enable |
RST_I : in std_logic; -- global reset line, sync, high-active |
clk_i : in std_logic; -- global clock line |
ce_i : in std_logic; -- clock enable |
rst_i : in std_logic; -- global reset line, sync, high-active |
|
-- ############################################################################################### |
-- ## Function Control ## |
-- ############################################################################################### |
|
WB_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- wb stage control |
OF_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- of stage control |
wb_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- wb stage control |
of_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- of stage control |
|
-- ############################################################################################### |
-- ## Data Input ## |
-- ############################################################################################### |
|
WB_DATA_I : in std_logic_vector(data_width_c-1 downto 0); -- write back data |
IMMEDIATE_I : in std_logic_vector(data_width_c-1 downto 0); -- immediates |
PC_1D_I : in std_logic_vector(data_width_c-1 downto 0); -- pc 1x delayed |
WB_FWD_I : in std_logic_vector(fwd_width_c-1 downto 0); -- WB stage forwarding path |
wb_data_i : in std_logic_vector(data_width_c-1 downto 0); -- write back data |
immediate_i : in std_logic_vector(data_width_c-1 downto 0); -- immediates |
pc_1d_i : in std_logic_vector(data_width_c-1 downto 0); -- pc 1x delayed |
wb_fwd_i : in std_logic_vector(fwd_width_c-1 downto 0); -- WB stage forwarding path |
|
-- ############################################################################################### |
-- ## Data Output ## |
-- ############################################################################################### |
|
OP_A_DATA_O : out std_logic_vector(data_width_c-1 downto 0); -- operand A output |
OP_B_DATA_O : out std_logic_vector(data_width_c-1 downto 0); -- operand B output |
OP_C_DATA_O : out std_logic_vector(data_width_c-1 downto 0) -- operand C output |
); |
end REG_FILE; |
op_a_data_o : out std_logic_vector(data_width_c-1 downto 0); -- operand a output |
op_b_data_o : out std_logic_vector(data_width_c-1 downto 0); -- operand b output |
op_c_data_o : out std_logic_vector(data_width_c-1 downto 0) -- operand c output |
); |
end reg_file; |
|
architecture RF_STRUCTURE of REG_FILE is |
architecture rf_structure of reg_file is |
|
-- Register File -- |
type reg_file_mem_type is array (2*8-1 downto 0) of std_logic_vector(data_width_c-1 downto 0); |
signal REG_FILE_MEM : reg_file_mem_type := (others => (others => '0')); |
-- register file -- |
type reg_file_mem_type is array (2*8-1 downto 0) of std_logic_vector(data_width_c-1 downto 0); |
signal reg_file_mem : reg_file_mem_type := (others => (others => '0')); |
|
-- Operand Multiplexer -- |
signal OP_A_INT : std_logic_vector(data_width_c-1 downto 0); |
signal OP_B_INT : std_logic_vector(data_width_c-1 downto 0); |
-- operand multiplexer -- |
signal op_a_int : std_logic_vector(data_width_c-1 downto 0); |
signal op_b_int : std_logic_vector(data_width_c-1 downto 0); |
|
begin |
|
-- Data Register File ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
DATA_REGISTER_FILE: process(CLK_I) |
begin |
-- sync write access -- |
if rising_edge(CLK_I) then |
if (WB_CTRL_BUS_I(ctrl_wb_en_c) = '1') and (CE_I = '1') then -- valid write back |
REG_FILE_MEM(to_integer(unsigned(WB_CTRL_BUS_I(ctrl_rd_3_c downto ctrl_rd_0_c)))) <= WB_DATA_I; |
end if; |
end if; |
end process DATA_REGISTER_FILE; |
-- Data Register File ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
data_register_file: process(clk_i) |
begin |
-- sync write access -- |
if rising_edge(clk_i) then |
if (wb_ctrl_bus_i(ctrl_wb_en_c) = '1') and (ce_i = '1') then -- valid write back |
reg_file_mem(to_integer(unsigned(wb_ctrl_bus_i(ctrl_rd_3_c downto ctrl_rd_0_c)))) <= wb_data_i; |
end if; |
end if; |
end process data_register_file; |
|
|
|
-- Operand Fetch Forwarding Unit ----------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
OF_FWD: process(WB_FWD_I, OF_CTRL_BUS_I, REG_FILE_MEM) |
begin |
-- operand A forwarding -- |
if (WB_FWD_I(fwd_en_c) = '1') and (OF_CTRL_BUS_I(ctrl_ra_3_c downto ctrl_ra_0_c) = WB_FWD_I(fwd_adr_3_c downto fwd_adr_0_c)) then |
OP_A_INT <= WB_FWD_I(fwd_dat_msb_c downto fwd_dat_lsb_c); |
else |
OP_A_INT <= REG_FILE_MEM(to_integer(unsigned(OF_CTRL_BUS_I(ctrl_ra_3_c downto ctrl_ra_0_c)))); |
end if; |
-- Operand Fetch Forwarding Unit ----------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
of_fwd: process(wb_fwd_i, of_ctrl_bus_i, reg_file_mem) |
begin |
-- operand a forwarding -- |
if (wb_fwd_i(fwd_en_c) = '1') and (of_ctrl_bus_i(ctrl_ra_3_c downto ctrl_ra_0_c) = wb_fwd_i(fwd_adr_3_c downto fwd_adr_0_c)) then |
op_a_int <= wb_fwd_i(fwd_dat_msb_c downto fwd_dat_lsb_c); |
else |
op_a_int <= reg_file_mem(to_integer(unsigned(of_ctrl_bus_i(ctrl_ra_3_c downto ctrl_ra_0_c)))); |
end if; |
|
-- operand B forwarding -- |
if (WB_FWD_I(fwd_en_c) = '1') and (OF_CTRL_BUS_I(ctrl_rb_3_c downto ctrl_rb_0_c) = WB_FWD_I(fwd_adr_3_c downto fwd_adr_0_c)) then |
OP_B_INT <= WB_FWD_I(fwd_dat_msb_c downto fwd_dat_lsb_c); |
else |
OP_B_INT <= REG_FILE_MEM(to_integer(unsigned(OF_CTRL_BUS_I(ctrl_rb_3_c downto ctrl_rb_0_c)))); |
end if; |
end process OF_FWD; |
-- operand b forwarding -- |
if (wb_fwd_i(fwd_en_c) = '1') and (of_ctrl_bus_i(ctrl_rb_3_c downto ctrl_rb_0_c) = wb_fwd_i(fwd_adr_3_c downto fwd_adr_0_c)) then |
op_b_int <= wb_fwd_i(fwd_dat_msb_c downto fwd_dat_lsb_c); |
else |
op_b_int <= reg_file_mem(to_integer(unsigned(of_ctrl_bus_i(ctrl_rb_3_c downto ctrl_rb_0_c)))); |
end if; |
end process of_fwd; |
|
|
|
-- Operand Multiplexer --------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
OP_A_DATA_O <= PC_1D_I when (OF_CTRL_BUS_I(ctrl_ra_is_pc_c) = '1') else OP_A_INT; |
OP_B_DATA_O <= IMMEDIATE_I when (OF_CTRL_BUS_I(ctrl_rb_is_imm_c) = '1') else OP_B_INT; |
OP_C_DATA_O <= OP_B_INT; |
-- Operand Multiplexer --------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
op_a_data_o <= pc_1d_i when (of_ctrl_bus_i(ctrl_ra_is_pc_c) = '1') else op_a_int; |
op_b_data_o <= immediate_i when (of_ctrl_bus_i(ctrl_rb_is_imm_c) = '1') else op_b_int; |
op_c_data_o <= op_b_int; |
|
|
|
end RF_STRUCTURE; |
end rf_structure; |
/atlas_core/trunk/rtl/MEM_GATE.vhd
4,7 → 4,7
-- # Gateway between CPU instruction/data interface and # |
-- # bootloader ROM / memory/IO bus system. # |
-- # **************************************************** # |
-- # Last modified: 08.03.2014 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
16,95 → 16,90
library work; |
use work.atlas_core_package.all; |
|
entity MEM_GATE is |
port ( |
-- Host Interface -- |
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
entity mem_gate is |
port ( |
-- host interface -- |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
|
I_ADR_I : in std_logic_vector(15 downto 0); -- instruction adr |
I_EN_I : in std_logic; -- IR update |
I_DAT_O : out std_logic_vector(15 downto 0); -- instruction out |
D_REQ_I : in std_logic; -- request access in next cycle |
D_RW_I : in std_logic; -- read/write |
D_ADR_I : in std_logic_vector(15 downto 0); -- data adr |
D_DAT_I : in std_logic_vector(15 downto 0); -- data in |
D_DAT_O : out std_logic_vector(15 downto 0); -- data out |
MEM_IP_ADR_I : in std_logic_vector(15 downto 0); -- instruction page |
MEM_DP_ADR_I : in std_logic_vector(15 downto 0); -- data page |
i_adr_i : in std_logic_vector(15 downto 0); -- instruction adr |
i_dat_o : out std_logic_vector(15 downto 0); -- instruction out |
d_req_i : in std_logic; -- request access in next cycle |
d_rw_i : in std_logic; -- read/write |
d_adr_i : in std_logic_vector(15 downto 0); -- data adr |
d_dat_i : in std_logic_vector(15 downto 0); -- data in |
d_dat_o : out std_logic_vector(15 downto 0); -- data out |
mem_ip_adr_i : in std_logic_vector(15 downto 0); -- instruction page |
mem_dp_adr_i : in std_logic_vector(15 downto 0); -- data page |
|
-- Boot ROM Interface -- |
BOOT_I_ADR_O : out std_logic_vector(15 downto 0); -- instruction adr |
BOOT_I_EN_O : out std_logic; -- IR update |
BOOT_I_DAT_I : in std_logic_vector(15 downto 0); -- instruction out |
BOOT_D_EN_O : out std_logic; -- access enable |
BOOT_D_RW_O : out std_logic; -- read/write |
BOOT_D_ADR_O : out std_logic_vector(15 downto 0); -- data adr |
BOOT_D_DAT_O : out std_logic_vector(15 downto 0); -- data in |
BOOT_D_DAT_I : in std_logic_vector(15 downto 0); -- data out |
-- boot rom interface -- |
boot_i_adr_o : out std_logic_vector(15 downto 0); -- instruction adr |
boot_i_dat_i : in std_logic_vector(15 downto 0); -- instruction out |
boot_d_en_o : out std_logic; -- access enable |
boot_d_rw_o : out std_logic; -- read/write |
boot_d_adr_o : out std_logic_vector(15 downto 0); -- data adr |
boot_d_dat_o : out std_logic_vector(15 downto 0); -- data in |
boot_d_dat_i : in std_logic_vector(15 downto 0); -- data out |
|
-- Memory Interface -- |
MEM_I_PAGE_O : out std_logic_vector(15 downto 0); -- instruction page |
MEM_I_ADR_O : out std_logic_vector(15 downto 0); -- instruction adr |
MEM_I_EN_O : out std_logic; -- IR update |
MEM_I_DAT_I : in std_logic_vector(15 downto 0); -- instruction out |
MEM_D_EN_O : out std_logic; -- access enable |
MEM_D_RW_O : out std_logic; -- read/write |
MEM_D_PAGE_O : out std_logic_vector(15 downto 0); -- data page |
MEM_D_ADR_O : out std_logic_vector(15 downto 0); -- data adr |
MEM_D_DAT_O : out std_logic_vector(15 downto 0); -- data in |
MEM_D_DAT_I : in std_logic_vector(15 downto 0) -- data out |
); |
end MEM_GATE; |
-- memory interface -- |
mem_i_page_o : out std_logic_vector(15 downto 0); -- instruction page |
mem_i_adr_o : out std_logic_vector(15 downto 0); -- instruction adr |
mem_i_dat_i : in std_logic_vector(15 downto 0); -- instruction out |
mem_d_en_o : out std_logic; -- access enable |
mem_d_rw_o : out std_logic; -- read/write |
mem_d_page_o : out std_logic_vector(15 downto 0); -- data page |
mem_d_adr_o : out std_logic_vector(15 downto 0); -- data adr |
mem_d_dat_o : out std_logic_vector(15 downto 0); -- data in |
mem_d_dat_i : in std_logic_vector(15 downto 0) -- data out |
); |
end mem_gate; |
|
architecture MEM_GATE_BEHAV of MEM_GATE is |
architecture mem_gate_behav of mem_gate is |
|
-- local signals -- |
signal MEM_DACC_FF : std_logic; |
signal D_GATE_SEL : std_logic; |
signal I_GATE_SEL : std_logic; |
-- local signals -- |
signal mem_dacc_ff : std_logic; |
signal d_gate_sel : std_logic; |
signal i_gate_sel : std_logic; |
|
begin |
|
-- Gateway --------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
MEM_ACC_FLAG: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
MEM_DACC_FF <= '0'; |
else |
MEM_DACC_FF <= D_REQ_I; |
end if; |
end if; |
end process MEM_ACC_FLAG; |
-- Gateway --------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
mem_acc_flag: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
mem_dacc_ff <= '0'; |
else |
mem_dacc_ff <= d_req_i; |
end if; |
end if; |
end process mem_acc_flag; |
|
-- Switch -- |
I_GATE_SEL <= '1' when (MEM_IP_ADR_I(15) = boot_page_c(15)) else '0'; |
D_GATE_SEL <= '1' when (MEM_DP_ADR_I(15) = boot_page_c(15)) else '0'; |
-- switch -- |
i_gate_sel <= '1' when (mem_ip_adr_i(15) = boot_page_c(15)) else '0'; |
d_gate_sel <= '1' when (mem_dp_adr_i(15) = boot_page_c(15)) else '0'; |
|
-- Bootloader ROM -- |
BOOT_I_EN_O <= I_EN_I when (I_GATE_SEL = '1') else '0'; |
BOOT_I_ADR_O <= I_ADR_I; |
BOOT_D_EN_O <= MEM_DACC_FF when (D_GATE_SEL = '1') else '0'; |
BOOT_D_ADR_O <= D_ADR_I when (MEM_DACC_FF = '1') else (others => '0'); -- to reduce switching activity |
BOOT_D_DAT_O <= (others => '0'); -- boot MEM is read-only |
BOOT_D_RW_O <= D_RW_I; |
-- bootloader rom -- |
boot_i_adr_o <= i_adr_i; |
boot_d_en_o <= mem_dacc_ff when (d_gate_sel = '1') else '0'; |
boot_d_adr_o <= d_adr_i when (mem_dacc_ff = '1') and (d_gate_sel = '1') else (others => '0'); -- to reduce switching activity |
boot_d_dat_o <= d_dat_i when (mem_dacc_ff = '1') and (d_gate_sel = '1') else (others => '0'); -- to reduce switching activity |
boot_d_rw_o <= d_rw_i; |
|
-- Memory System -- |
MEM_I_EN_O <= I_EN_I when (I_GATE_SEL = '0') else '0'; |
MEM_I_PAGE_O <= '0' & MEM_IP_ADR_I(14 downto 0); |
MEM_I_ADR_O <= I_ADR_I; |
MEM_D_EN_O <= MEM_DACC_FF when (D_GATE_SEL = '0') else '0'; |
MEM_D_PAGE_O <= '0' & MEM_DP_ADR_I(14 downto 0); |
MEM_D_ADR_O <= D_ADR_I when (MEM_DACC_FF = '1') else (others => '0'); -- to reduce switching activity |
MEM_D_DAT_O <= D_DAT_I when (MEM_DACC_FF = '1') else (others => '0'); -- to reduce switching activity |
MEM_D_RW_O <= D_RW_I; |
-- memory system -- |
mem_i_page_o <= '0' & mem_ip_adr_i(14 downto 0); |
mem_i_adr_o <= i_adr_i; |
mem_d_en_o <= mem_dacc_ff when (d_gate_sel = '0') else '0'; |
mem_d_page_o <= '0' & mem_dp_adr_i(14 downto 0); |
mem_d_adr_o <= d_adr_i when (mem_dacc_ff = '1') and (d_gate_sel = '0') else (others => '0'); -- to reduce switching activity |
mem_d_dat_o <= d_dat_i when (mem_dacc_ff = '1') and (d_gate_sel = '0') else (others => '0'); -- to reduce switching activity |
mem_d_rw_o <= d_rw_i; |
|
-- CPU -- |
I_DAT_O <= BOOT_I_DAT_I when (I_GATE_SEL = '1') else MEM_I_DAT_I; |
D_DAT_O <= BOOT_D_DAT_I when (D_GATE_SEL = '1') else MEM_D_DAT_I; |
-- cpu -- |
i_dat_o <= boot_i_dat_i when (i_gate_sel = '1') else mem_i_dat_i; |
d_dat_o <= boot_d_dat_i when (d_gate_sel = '1') else mem_d_dat_i; |
|
|
|
end MEM_GATE_BEHAV; |
end mem_gate_behav; |
/atlas_core/trunk/rtl/ALU.vhd
4,7 → 4,7
-- # The main data processing is done here. Also the CP # |
-- # interface emerges from this unit. # |
-- # **************************************************** # |
-- # Last modified: 30.04.2014 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
16,447 → 16,447
library work; |
use work.atlas_core_package.all; |
|
entity ALU is |
port ( |
entity alu is |
port ( |
-- ############################################################################################### |
-- ## Global Control ## |
-- ############################################################################################### |
|
CLK_I : in std_logic; -- global clock line |
CE_I : in std_logic; -- clock enable |
RST_I : in std_logic; -- global reset line, sync, high-active |
clk_i : in std_logic; -- global clock line |
ce_i : in std_logic; -- clock enable |
rst_i : in std_logic; -- global reset line, sync, high-active |
|
-- ############################################################################################### |
-- ## Function Control ## |
-- ############################################################################################### |
|
EX_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- stage control |
FLAG_BUS_I : in std_logic_vector(flag_bus_width_c-1 downto 0); -- flag input |
ex_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- stage control |
flag_bus_i : in std_logic_vector(flag_bus_width_c-1 downto 0); -- flag input |
|
-- ############################################################################################### |
-- ## Data Input ## |
-- ############################################################################################### |
|
OP_A_I : in std_logic_vector(data_width_c-1 downto 0); -- operand A input |
OP_B_I : in std_logic_vector(data_width_c-1 downto 0); -- operand B input |
OP_C_I : in std_logic_vector(data_width_c-1 downto 0); -- operand C input |
op_a_i : in std_logic_vector(data_width_c-1 downto 0); -- operand a input |
op_b_i : in std_logic_vector(data_width_c-1 downto 0); -- operand b input |
op_c_i : in std_logic_vector(data_width_c-1 downto 0); -- operand c input |
|
PC_1D_I : in std_logic_vector(data_width_c-1 downto 0); -- 1x delayed PC |
pc_1d_i : in std_logic_vector(data_width_c-1 downto 0); -- 1x delayed pc |
|
MA_FWD_I : in std_logic_vector(fwd_width_c-1 downto 0); -- MA stage forwarding path |
WB_FWD_I : in std_logic_vector(fwd_width_c-1 downto 0); -- WB stage forwarding path |
ma_fwd_i : in std_logic_vector(fwd_width_c-1 downto 0); -- ma stage forwarding path |
wb_fwd_i : in std_logic_vector(fwd_width_c-1 downto 0); -- wb stage forwarding path |
|
-- ############################################################################################### |
-- ## Data Output ## |
-- ############################################################################################### |
|
FLAG_BUS_O : out std_logic_vector(flag_bus_width_c-1 downto 0); -- flag output |
MASK_T_FLAG_O : out std_logic; -- T-Flag for mask generation |
flag_bus_o : out std_logic_vector(flag_bus_width_c-1 downto 0); -- flag output |
mask_t_flag_o : out std_logic; -- t-flag for mask generation |
|
MSR_DATA_O : out std_logic_vector(data_width_c-1 downto 0); -- MSR write data |
ALU_RES_O : out std_logic_vector(data_width_c-1 downto 0); -- ALU result |
MUL_RES_O : out std_logic_vector(2*data_width_c-1 downto 0); -- MUL result |
BP_OPA_O : out std_logic_vector(data_width_c-1 downto 0); -- operand A bypass |
BP_OPC_O : out std_logic_vector(data_width_c-1 downto 0); -- operand C bypass |
msr_data_o : out std_logic_vector(data_width_c-1 downto 0); -- msr write data |
alu_res_o : out std_logic_vector(data_width_c-1 downto 0); -- alu result |
mul_res_o : out std_logic_vector(2*data_width_c-1 downto 0); -- mul result |
bp_opa_o : out std_logic_vector(data_width_c-1 downto 0); -- operand a bypass |
bp_opc_o : out std_logic_vector(data_width_c-1 downto 0); -- operand c bypass |
|
CP_CP0_EN_O : out std_logic; -- access to cp0 |
CP_CP1_EN_O : out std_logic; -- access to cp1 |
CP_OP_O : out std_logic; -- data transfer/operation |
CP_RW_O : out std_logic; -- read/write access |
CP_CMD_O : out std_logic_vector(cp_cmd_width_c-1 downto 0); -- register addresses / cmd |
CP_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- write data |
cp_cp0_en_o : out std_logic; -- access to cp0 |
cp_cp1_en_o : out std_logic; -- access to cp1 |
cp_op_o : out std_logic; -- data transfer/operation |
cp_rw_o : out std_logic; -- read/write access |
cp_cmd_o : out std_logic_vector(cp_cmd_width_c-1 downto 0); -- register addresses / cmd |
cp_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- write data |
|
MEM_REQ_O : out std_logic -- data memory access request for next cycle |
); |
end ALU; |
mem_req_o : out std_logic -- data memory access request for next cycle |
); |
end alu; |
|
architecture ALU_STRUCTURE of ALU is |
architecture alu_structure of alu is |
|
-- Pipeline register -- |
signal OP_A_FF : std_logic_vector(data_width_c-1 downto 0); |
signal OP_B_FF : std_logic_vector(data_width_c-1 downto 0); |
signal OP_C_FF : std_logic_vector(data_width_c-1 downto 0); |
-- pipeline register -- |
signal op_a_ff : std_logic_vector(data_width_c-1 downto 0); |
signal op_b_ff : std_logic_vector(data_width_c-1 downto 0); |
signal op_c_ff : std_logic_vector(data_width_c-1 downto 0); |
|
-- Functional Units Output -- |
signal FU_ARITH_RES : std_logic_vector(data_width_c-1 downto 0); |
signal FU_ARITH_FLG : std_logic_vector(1 downto 0); -- overflow & carry |
signal FU_LOGIC_RES : std_logic_vector(data_width_c-1 downto 0); |
signal FU_LOGIC_FLG : std_logic_vector(1 downto 0); |
signal FU_SHIFT_RES : std_logic_vector(data_width_c-1 downto 0); |
signal FU_SHIFT_FLG : std_logic_vector(1 downto 0); |
-- functional units output -- |
signal fu_arith_res : std_logic_vector(data_width_c-1 downto 0); |
signal fu_arith_flg : std_logic_vector(1 downto 0); -- overflow & carry |
signal fu_logic_res : std_logic_vector(data_width_c-1 downto 0); |
signal fu_logic_flg : std_logic_vector(1 downto 0); |
signal fu_shift_res : std_logic_vector(data_width_c-1 downto 0); |
signal fu_shift_flg : std_logic_vector(1 downto 0); |
|
-- Internal data lines -- |
signal OP_A_INT : std_logic_vector(data_width_c-1 downto 0); |
signal OP_B_INT : std_logic_vector(data_width_c-1 downto 0); |
signal OP_C_INT : std_logic_vector(data_width_c-1 downto 0); |
signal ALU_RES_INT : std_logic_vector(data_width_c-1 downto 0); |
signal T_FLAG_FUNC : std_logic; |
signal PARITY_BIT : std_logic; |
signal TRANSF_INT : std_logic; |
signal SEL_BIT : std_logic; |
signal INV_BIT : std_logic; |
signal IS_ZERO : std_logic; |
signal EXTND_ZERO : std_logic; |
-- internal data lines -- |
signal op_a_int : std_logic_vector(data_width_c-1 downto 0); |
signal op_b_int : std_logic_vector(data_width_c-1 downto 0); |
signal op_c_int : std_logic_vector(data_width_c-1 downto 0); |
signal alu_res_int : std_logic_vector(data_width_c-1 downto 0); |
signal t_flag_func : std_logic; |
signal parity_bit : std_logic; |
signal transf_int : std_logic; |
signal sel_bit : std_logic; |
signal inv_bit : std_logic; |
signal is_zero : std_logic; |
signal extnd_zero : std_logic; |
|
-- Multiplier -- |
signal MUL_OP_A : std_logic_vector(data_width_c-1 downto 0); |
signal MUL_OP_B : std_logic_vector(data_width_c-1 downto 0); |
-- multiplier -- |
signal mul_op_a : std_logic_vector(data_width_c-1 downto 0); |
signal mul_op_b : std_logic_vector(data_width_c-1 downto 0); |
|
begin |
|
-- Pipeline Register ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
PIPE_REG: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
OP_A_FF <= (others => '0'); |
OP_B_FF <= (others => '0'); |
op_c_ff <= (others => '0'); |
elsif (CE_I = '1') then |
OP_A_FF <= OP_A_I; |
OP_B_FF <= OP_B_I; |
OP_C_FF <= OP_C_I; |
end if; |
end if; |
end process PIPE_REG; |
-- Pipeline Register ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
pipe_reg: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
op_a_ff <= (others => '0'); |
op_b_ff <= (others => '0'); |
op_c_ff <= (others => '0'); |
elsif (ce_i = '1') then |
op_a_ff <= op_a_i; |
op_b_ff <= op_b_i; |
op_c_ff <= op_c_i; |
end if; |
end if; |
end process pipe_reg; |
|
|
|
-- Execution Forwarding Unit --------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
EX_FWD: process(MA_FWD_I, WB_FWD_I, EX_CTRL_BUS_I, OP_A_FF, OP_B_FF, OP_C_FF) |
variable op_a_ma_match_v : std_logic; |
variable op_b_ma_match_v : std_logic; |
variable op_a_wb_match_v : std_logic; |
variable op_b_wb_match_v : std_logic; |
variable op_c_wb_match_v : std_logic; |
variable op_a_tmp_v : std_logic_vector(data_width_c-1 downto 0); |
begin |
-- Execution Forwarding Unit --------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
ex_fwd: process(ma_fwd_i, wb_fwd_i, ex_ctrl_bus_i, op_a_ff, op_b_ff, op_c_ff) |
variable op_a_ma_match_v : std_logic; |
variable op_b_ma_match_v : std_logic; |
variable op_a_wb_match_v : std_logic; |
variable op_b_wb_match_v : std_logic; |
variable op_c_wb_match_v : std_logic; |
variable op_a_tmp_v : std_logic_vector(data_width_c-1 downto 0); |
begin |
|
-- Data from early stages -> higher priority than data from later stages |
-- No forwarding when OP_A is the PC |
-- No forwarding when OP_B is an immediate |
-- data from early stages -> higher priority than data from later stages |
-- no forwarding when op_a is the pc |
-- no forwarding when op_b is an immediate |
|
-- Local data dependency detectors -- |
op_a_ma_match_v := '0'; |
if (MA_FWD_I(fwd_en_c) = '1') and (EX_CTRL_BUS_I(ctrl_ra_is_pc_c) = '0') and (EX_CTRL_BUS_I(ctrl_ra_3_c downto ctrl_ra_0_c) = MA_FWD_I(fwd_adr_3_c downto fwd_adr_0_c)) then |
op_a_ma_match_v := '1'; |
end if; |
op_a_wb_match_v := '0'; |
if (WB_FWD_I(fwd_en_c) = '1') and (EX_CTRL_BUS_I(ctrl_ra_is_pc_c) = '0') and (EX_CTRL_BUS_I(ctrl_ra_3_c downto ctrl_ra_0_c) = WB_FWD_I(fwd_adr_3_c downto fwd_adr_0_c)) then |
op_a_wb_match_v := '1'; |
end if; |
-- local data dependency detectors -- |
op_a_ma_match_v := '0'; |
if (ma_fwd_i(fwd_en_c) = '1') and (ex_ctrl_bus_i(ctrl_ra_is_pc_c) = '0') and (ex_ctrl_bus_i(ctrl_ra_3_c downto ctrl_ra_0_c) = ma_fwd_i(fwd_adr_3_c downto fwd_adr_0_c)) then |
op_a_ma_match_v := '1'; |
end if; |
op_a_wb_match_v := '0'; |
if (wb_fwd_i(fwd_en_c) = '1') and (ex_ctrl_bus_i(ctrl_ra_is_pc_c) = '0') and (ex_ctrl_bus_i(ctrl_ra_3_c downto ctrl_ra_0_c) = wb_fwd_i(fwd_adr_3_c downto fwd_adr_0_c)) then |
op_a_wb_match_v := '1'; |
end if; |
|
op_b_ma_match_v := '0'; |
if (MA_FWD_I(fwd_en_c) = '1') and (EX_CTRL_BUS_I(ctrl_rb_is_imm_c) = '0') and (EX_CTRL_BUS_I(ctrl_rb_3_c downto ctrl_rb_0_c) = MA_FWD_I(fwd_adr_3_c downto fwd_adr_0_c)) then |
op_b_ma_match_v := '1'; |
end if; |
op_b_wb_match_v := '0'; |
if (WB_FWD_I(fwd_en_c) = '1') and (EX_CTRL_BUS_I(ctrl_rb_is_imm_c) = '0') and (EX_CTRL_BUS_I(ctrl_rb_3_c downto ctrl_rb_0_c) = WB_FWD_I(fwd_adr_3_c downto fwd_adr_0_c)) then |
op_b_wb_match_v := '1'; |
end if; |
op_b_ma_match_v := '0'; |
if (ma_fwd_i(fwd_en_c) = '1') and (ex_ctrl_bus_i(ctrl_rb_is_imm_c) = '0') and (ex_ctrl_bus_i(ctrl_rb_3_c downto ctrl_rb_0_c) = ma_fwd_i(fwd_adr_3_c downto fwd_adr_0_c)) then |
op_b_ma_match_v := '1'; |
end if; |
op_b_wb_match_v := '0'; |
if (wb_fwd_i(fwd_en_c) = '1') and (ex_ctrl_bus_i(ctrl_rb_is_imm_c) = '0') and (ex_ctrl_bus_i(ctrl_rb_3_c downto ctrl_rb_0_c) = wb_fwd_i(fwd_adr_3_c downto fwd_adr_0_c)) then |
op_b_wb_match_v := '1'; |
end if; |
|
op_c_wb_match_v := '0'; |
if (WB_FWD_I(fwd_en_c) = '1') and (EX_CTRL_BUS_I(ctrl_rb_3_c downto ctrl_rb_0_c) = WB_FWD_I(fwd_adr_3_c downto fwd_adr_0_c)) then |
op_c_wb_match_v := '1'; |
end if; |
|
-- op_a_ma_match_v := MA_FWD_I(fwd_en_c) and EX_CTRL_BUS_I(ctrl_a_ex_ma_fw_c); |
-- op_a_wb_match_v := WB_FWD_I(fwd_en_c) and EX_CTRL_BUS_I(ctrl_a_ex_wb_fw_c); |
-- op_b_ma_match_v := MA_FWD_I(fwd_en_c) and EX_CTRL_BUS_I(ctrl_b_ex_ma_fw_c); |
-- op_b_wb_match_v := WB_FWD_I(fwd_en_c) and EX_CTRL_BUS_I(ctrl_b_ex_wb_fw_c); |
-- op_c_wb_match_v := WB_FWD_I(fwd_en_c) and EX_CTRL_BUS_I(ctrl_c_ex_wb_fw_c); |
op_c_wb_match_v := '0'; |
if (wb_fwd_i(fwd_en_c) = '1') and (ex_ctrl_bus_i(ctrl_rb_3_c downto ctrl_rb_0_c) = wb_fwd_i(fwd_adr_3_c downto fwd_adr_0_c)) then |
op_c_wb_match_v := '1'; |
end if; |
|
-- op_a_ma_match_v := ma_fwd_i(fwd_en_c) and ex_ctrl_bus_i(ctrl_a_ex_ma_fw_c); |
-- op_a_wb_match_v := wb_fwd_i(fwd_en_c) and ex_ctrl_bus_i(ctrl_a_ex_wb_fw_c); |
-- op_b_ma_match_v := ma_fwd_i(fwd_en_c) and ex_ctrl_bus_i(ctrl_b_ex_ma_fw_c); |
-- op_b_wb_match_v := wb_fwd_i(fwd_en_c) and ex_ctrl_bus_i(ctrl_b_ex_wb_fw_c); |
-- op_c_wb_match_v := wb_fwd_i(fwd_en_c) and ex_ctrl_bus_i(ctrl_c_ex_wb_fw_c); |
|
-- OP A Gating -- |
if (EX_CTRL_BUS_I(ctrl_en_c) = '1') then |
-- OP A Forwarding -- |
if (op_a_ma_match_v = '1') then |
op_a_tmp_v := MA_FWD_I(fwd_dat_msb_c downto fwd_dat_lsb_c); -- MA stage |
elsif (op_a_wb_match_v = '1') then |
op_a_tmp_v := WB_FWD_I(fwd_dat_msb_c downto fwd_dat_lsb_c); -- WB stage |
else |
op_a_tmp_v := OP_A_FF; |
end if; |
else |
op_a_tmp_v := (others => '0'); |
end if; |
-- op a gating -- |
if (ex_ctrl_bus_i(ctrl_en_c) = '1') then |
-- op a forwarding -- |
if (op_a_ma_match_v = '1') then |
op_a_tmp_v := ma_fwd_i(fwd_dat_msb_c downto fwd_dat_lsb_c); -- ma stage |
elsif (op_a_wb_match_v = '1') then |
op_a_tmp_v := wb_fwd_i(fwd_dat_msb_c downto fwd_dat_lsb_c); -- wb stage |
else |
op_a_tmp_v := op_a_ff; |
end if; |
else |
op_a_tmp_v := (others => '0'); |
end if; |
|
-- OP A Mask Unit -- |
OP_A_INT <= op_a_tmp_v; |
if (EX_CTRL_BUS_I(ctrl_clr_ha_c) = '1') then -- clear high half word |
OP_A_INT(data_width_c-1 downto data_width_c/2) <= (others => '0'); |
end if; |
if (EX_CTRL_BUS_I(ctrl_clr_la_c) = '1') then -- clear low half word |
OP_A_INT(data_width_c/2-1 downto 0) <= (others => '0'); |
end if; |
-- op a mask unit -- |
op_a_int <= op_a_tmp_v; |
if (ex_ctrl_bus_i(ctrl_clr_ha_c) = '1') then -- clear high half word |
op_a_int(data_width_c-1 downto data_width_c/2) <= (others => '0'); |
end if; |
if (ex_ctrl_bus_i(ctrl_clr_la_c) = '1') then -- clear low half word |
op_a_int(data_width_c/2-1 downto 0) <= (others => '0'); |
end if; |
|
-- OP B Gating -- |
if (EX_CTRL_BUS_I(ctrl_en_c) = '1') then |
-- OP B Forwarding -- |
if (op_b_ma_match_v = '1') then |
OP_B_INT <= MA_FWD_I(fwd_dat_msb_c downto fwd_dat_lsb_c); -- MA stage |
elsif (op_b_wb_match_v = '1') then |
OP_B_INT <= WB_FWD_I(fwd_dat_msb_c downto fwd_dat_lsb_c); -- WB stage |
else |
OP_B_INT <= OP_B_FF; |
end if; |
else |
OP_B_INT <= (others => '0'); |
end if; |
-- op b gating -- |
if (ex_ctrl_bus_i(ctrl_en_c) = '1') then |
-- op b forwarding -- |
if (op_b_ma_match_v = '1') then |
op_b_int <= ma_fwd_i(fwd_dat_msb_c downto fwd_dat_lsb_c); -- ma stage |
elsif (op_b_wb_match_v = '1') then |
op_b_int <= wb_fwd_i(fwd_dat_msb_c downto fwd_dat_lsb_c); -- wb stage |
else |
op_b_int <= op_b_ff; |
end if; |
else |
op_b_int <= (others => '0'); |
end if; |
|
-- OP C Forwarding -- |
if (op_c_wb_match_v = '1') then |
OP_C_INT <= WB_FWD_I(fwd_dat_msb_c downto fwd_dat_lsb_c); -- WB stage |
else |
OP_C_INT <= OP_C_FF; |
end if; |
-- op c forwarding -- |
if (op_c_wb_match_v = '1') then |
op_c_int <= wb_fwd_i(fwd_dat_msb_c downto fwd_dat_lsb_c); -- wb stage |
else |
op_c_int <= op_c_ff; |
end if; |
|
end process EX_FWD; |
end process ex_fwd; |
|
|
|
-- Functional Unit: Arithmetic Core -------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
FU_ARITHMETIC_CORE: process(EX_CTRL_BUS_I, OP_A_INT, OP_B_INT, FLAG_BUS_I) |
variable op_a_v, op_b_v : std_logic_vector(data_width_c-1 downto 0); |
variable cflag_v : std_logic; |
variable add_a_v, add_b_v : std_logic_vector(data_width_c downto 0); |
variable add_cf_in_v : std_logic_vector(0 downto 0); |
variable adder_c_sel_v : std_logic; |
variable adder_carry_in_v : std_logic; |
variable adder_tmp_v : std_logic_vector(data_width_c downto 0); |
begin |
-- Functional Unit: Arithmetic Core -------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
fu_arithmetic_core: process(ex_ctrl_bus_i, op_a_int, op_b_int, flag_bus_i) |
variable op_a_v, op_b_v : std_logic_vector(data_width_c-1 downto 0); |
variable cflag_v : std_logic; |
variable add_a_v, add_b_v : std_logic_vector(data_width_c downto 0); |
variable add_cf_in_v : std_logic_vector(0 downto 0); |
variable adder_c_sel_v : std_logic; |
variable adder_carry_in_v : std_logic; |
variable adder_tmp_v : std_logic_vector(data_width_c downto 0); |
begin |
|
-- Operand Insulation -- |
op_a_v := (others => '0'); |
op_b_v := (others => '0'); |
cflag_v := '0'; |
if (EX_CTRL_BUS_I(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) = alu_adc_c) or |
(EX_CTRL_BUS_I(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) = alu_sbc_c) then |
op_a_v := OP_A_INT; |
op_b_v := OP_B_INT; |
cflag_v := FLAG_BUS_I(flag_c_c); |
end if; |
-- operand insulation -- |
op_a_v := (others => '0'); |
op_b_v := (others => '0'); |
cflag_v := '0'; |
if (ex_ctrl_bus_i(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) = alu_adc_c) or |
(ex_ctrl_bus_i(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) = alu_sbc_c) then |
op_a_v := op_a_int; |
op_b_v := op_b_int; |
cflag_v := flag_bus_i(flag_c_c); |
end if; |
|
-- ADD/SUB Select -- |
if (EX_CTRL_BUS_I(ctrl_alu_cf_opt_c) = '0') then -- propagate carry_in |
adder_c_sel_v := cflag_v; |
else -- invert carry_in |
adder_c_sel_v := not cflag_v; |
end if; |
add_a_v := '0' & op_a_v; |
adder_carry_in_v := adder_c_sel_v and EX_CTRL_BUS_I(ctrl_alu_usec_c); |
case (EX_CTRL_BUS_I(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c)) is |
when alu_sbc_c => -- (+OP_A) + (-OP_B) {+ (-CARRY)} |
add_b_v := '0' & (not op_b_v); |
add_cf_in_v(0) := not adder_carry_in_v; |
when alu_adc_c => -- (+OP_A) + (+OP_B) {+ (+CARRY)} |
add_b_v := '0' & op_b_v; |
add_cf_in_v(0) := adder_carry_in_v; |
when others => -- other function set, adder irrelevant |
add_b_v := '0' & op_b_v; |
add_cf_in_v(0) := adder_carry_in_v; |
end case; |
-- add/sub select -- |
if (ex_ctrl_bus_i(ctrl_alu_cf_opt_c) = '0') then -- propagate carry_in |
adder_c_sel_v := cflag_v; |
else -- invert carry_in |
adder_c_sel_v := not cflag_v; |
end if; |
add_a_v := '0' & op_a_v; |
adder_carry_in_v := adder_c_sel_v and ex_ctrl_bus_i(ctrl_alu_usec_c); |
case (ex_ctrl_bus_i(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c)) is |
when alu_sbc_c => -- (+op_a) + (-op_b) {+ (-carry)} |
add_b_v := '0' & (not op_b_v); |
add_cf_in_v(0) := not adder_carry_in_v; |
when alu_adc_c => -- (+op_a) + (+op_b) {+ (+carry)} |
add_b_v := '0' & op_b_v; |
add_cf_in_v(0) := adder_carry_in_v; |
when others => -- other function set, adder irrelevant |
add_b_v := '0' & op_b_v; |
add_cf_in_v(0) := adder_carry_in_v; |
end case; |
|
-- adder core -- |
adder_tmp_v := std_logic_vector(unsigned(add_a_v) + unsigned(add_b_v) + unsigned(add_cf_in_v(0 downto 0))); |
FU_ARITH_RES <= adder_tmp_v(data_width_c-1 downto 0); -- result, MSB of adder_tmp_v is CARRY bit |
|
-- adder flag carry output logic -- |
case (EX_CTRL_BUS_I(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c)) is |
when alu_adc_c => -- add |
FU_ARITH_FLG(0) <= adder_tmp_v(data_width_c); |
when alu_sbc_c => -- sub |
FU_ARITH_FLG(0) <= not adder_tmp_v(data_width_c); |
when others => -- other function set, adder irrelevant |
FU_ARITH_FLG(0) <= adder_tmp_v(data_width_c); |
end case; |
-- adder core -- |
adder_tmp_v := std_logic_vector(unsigned(add_a_v) + unsigned(add_b_v) + unsigned(add_cf_in_v(0 downto 0))); |
fu_arith_res <= adder_tmp_v(data_width_c-1 downto 0); -- result, msb of adder_tmp_v is carry bit |
|
-- adder flag carry output logic -- |
case (ex_ctrl_bus_i(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c)) is |
when alu_adc_c => -- add |
fu_arith_flg(0) <= adder_tmp_v(data_width_c); |
when alu_sbc_c => -- sub |
fu_arith_flg(0) <= not adder_tmp_v(data_width_c); |
when others => -- other function set, adder irrelevant |
fu_arith_flg(0) <= adder_tmp_v(data_width_c); |
end case; |
|
-- Arithmetic overflow flag -- |
FU_ARITH_FLG(1) <= ((not add_a_v(data_width_c-1)) and (not add_b_v(data_width_c-1)) and ( adder_tmp_v(data_width_c-1))) or |
(( add_a_v(data_width_c-1)) and ( add_b_v(data_width_c-1)) and (not adder_tmp_v(data_width_c-1))); |
end process FU_ARITHMETIC_CORE; |
-- arithmetic overflow flag -- |
fu_arith_flg(1) <= ((not add_a_v(data_width_c-1)) and (not add_b_v(data_width_c-1)) and ( adder_tmp_v(data_width_c-1))) or |
(( add_a_v(data_width_c-1)) and ( add_b_v(data_width_c-1)) and (not adder_tmp_v(data_width_c-1))); |
end process fu_arithmetic_core; |
|
|
|
-- Functional Unit: Shifter Core ----------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
FU_SHIFTER_CORE: process(EX_CTRL_BUS_I, OP_A_INT, OP_B_FF, FLAG_BUS_I) |
variable op_a_v, op_b_v : std_logic_vector(data_width_c-1 downto 0); |
variable cflag_v : std_logic; |
variable shifter_dat_v : std_logic_vector(data_width_c-1 downto 0); |
variable shifter_carry_v : std_logic; |
variable shifter_ovf_v : std_logic; |
begin |
-- Functional Unit: Shifter Core ----------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
fu_shifter_core: process(ex_ctrl_bus_i, op_a_int, op_b_ff, flag_bus_i) |
variable op_a_v, op_b_v : std_logic_vector(data_width_c-1 downto 0); |
variable cflag_v : std_logic; |
variable shifter_dat_v : std_logic_vector(data_width_c-1 downto 0); |
variable shifter_carry_v : std_logic; |
variable shifter_ovf_v : std_logic; |
begin |
|
-- Operand Insulation -- |
op_a_v := (others => '0'); |
op_b_v := (others => '0'); |
cflag_v := '0'; |
if (EX_CTRL_BUS_I(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) = alu_sft_c) then |
op_a_v := OP_A_INT; |
op_b_v := OP_B_FF; |
cflag_v := FLAG_BUS_I(flag_c_c); |
end if; |
-- operand insulation -- |
op_a_v := (others => '0'); |
op_b_v := (others => '0'); |
cflag_v := '0'; |
if (ex_ctrl_bus_i(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) = alu_sft_c) then |
op_a_v := op_a_int; |
op_b_v := op_b_ff; |
cflag_v := flag_bus_i(flag_c_c); |
end if; |
|
-- Shifter Core -- |
case (op_b_v(2 downto 0)) is |
when sft_asr_c => -- arithmetical right shift |
shifter_dat_v := op_a_v(data_width_c-1) & op_a_v(data_width_c-1 downto 1); |
FU_SHIFT_FLG(0) <= op_a_v(0); |
when sft_rol_c => -- rotate left |
shifter_dat_v := op_a_v(data_width_c-2 downto 0) & op_a_v(data_width_c-1); |
FU_SHIFT_FLG(0) <= op_a_v(data_width_c-1); |
when sft_ror_c => -- rotate right |
shifter_dat_v := op_a_v(0) & op_a_v(data_width_c-1 downto 1); |
FU_SHIFT_FLG(0) <= op_a_v(0); |
when sft_lsl_c => -- logical shift left |
shifter_dat_v := op_a_v(data_width_c-2 downto 0) & '0'; |
FU_SHIFT_FLG(0) <= op_a_v(data_width_c-1); |
when sft_lsr_c => -- logical shift right |
shifter_dat_v := '0' & op_a_v(data_width_c-1 downto 1); |
FU_SHIFT_FLG(0) <= op_a_v(0); |
when sft_rlc_c => -- rotate left through carry |
shifter_dat_v := op_a_v(data_width_c-2 downto 0) & cflag_v; |
FU_SHIFT_FLG(0) <= op_a_v(data_width_c-1); |
when sft_rrc_c => -- rotate right through carry |
shifter_dat_v := cflag_v & op_a_v(data_width_c-1 downto 1); |
FU_SHIFT_FLG(0) <= op_a_v(0); |
when others => -- swap halfwords (sft_swp_c) |
shifter_dat_v := op_a_v(data_width_c/2-1 downto 0) & op_a_v(data_width_c-1 downto data_width_c/2); |
FU_SHIFT_FLG(0) <= op_a_v(data_width_c-1); |
end case; |
FU_SHIFT_RES <= shifter_dat_v; |
-- shifter core -- |
case (op_b_v(2 downto 0)) is |
when sft_asr_c => -- arithmetical right shift |
shifter_dat_v := op_a_v(data_width_c-1) & op_a_v(data_width_c-1 downto 1); |
fu_shift_flg(0) <= op_a_v(0); |
when sft_rol_c => -- rotate left |
shifter_dat_v := op_a_v(data_width_c-2 downto 0) & op_a_v(data_width_c-1); |
fu_shift_flg(0) <= op_a_v(data_width_c-1); |
when sft_ror_c => -- rotate right |
shifter_dat_v := op_a_v(0) & op_a_v(data_width_c-1 downto 1); |
fu_shift_flg(0) <= op_a_v(0); |
when sft_lsl_c => -- logical shift left |
shifter_dat_v := op_a_v(data_width_c-2 downto 0) & '0'; |
fu_shift_flg(0) <= op_a_v(data_width_c-1); |
when sft_lsr_c => -- logical shift right |
shifter_dat_v := '0' & op_a_v(data_width_c-1 downto 1); |
fu_shift_flg(0) <= op_a_v(0); |
when sft_rlc_c => -- rotate left through carry |
shifter_dat_v := op_a_v(data_width_c-2 downto 0) & cflag_v; |
fu_shift_flg(0) <= op_a_v(data_width_c-1); |
when sft_rrc_c => -- rotate right through carry |
shifter_dat_v := cflag_v & op_a_v(data_width_c-1 downto 1); |
fu_shift_flg(0) <= op_a_v(0); |
when others => -- swap halfwords (sft_swp_c) |
shifter_dat_v := op_a_v(data_width_c/2-1 downto 0) & op_a_v(data_width_c-1 downto data_width_c/2); |
fu_shift_flg(0) <= op_a_v(data_width_c-1); |
end case; |
fu_shift_res <= shifter_dat_v; |
|
-- Overflow flag -- |
FU_SHIFT_FLG(1) <= op_a_v(data_width_c-1) xor shifter_dat_v(data_width_c-1); |
-- overflow flag -- |
fu_shift_flg(1) <= op_a_v(data_width_c-1) xor shifter_dat_v(data_width_c-1); |
|
end process FU_SHIFTER_CORE; |
end process fu_shifter_core; |
|
|
|
-- Functional Unit: Logical Core ----------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
FU_LOGIC_CORE: process(EX_CTRL_BUS_I, OP_A_INT, OP_B_INT, FLAG_BUS_I) |
begin |
-- Keep Flags -- |
FU_LOGIC_FLG(0) <= FLAG_BUS_I(flag_c_c); |
FU_LOGIC_FLG(1) <= FLAG_BUS_I(flag_o_c); |
-- Functional Unit: Logical Core ----------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
fu_logic_core: process(ex_ctrl_bus_i, op_a_int, op_b_int, flag_bus_i) |
begin |
-- keep flags -- |
fu_logic_flg(0) <= flag_bus_i(flag_c_c); |
fu_logic_flg(1) <= flag_bus_i(flag_o_c); |
|
-- Logic Function -- |
case (EX_CTRL_BUS_I(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c)) is |
when alu_and_c => FU_LOGIC_RES <= OP_A_INT and OP_B_INT; |
when alu_nand_c => FU_LOGIC_RES <= OP_A_INT nand OP_B_INT; |
when alu_orr_c => FU_LOGIC_RES <= OP_A_INT or OP_B_INT; |
when alu_eor_c => FU_LOGIC_RES <= OP_A_INT xor OP_B_INT; |
when alu_bic_c => FU_LOGIC_RES <= OP_A_INT and (not OP_B_INT); |
when others => FU_LOGIC_RES <= (others => '0'); |
FU_LOGIC_FLG(0) <= '0'; |
FU_LOGIC_FLG(1) <= '0'; |
end case; |
end process FU_LOGIC_CORE; |
-- logic function -- |
case (ex_ctrl_bus_i(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c)) is |
when alu_and_c => fu_logic_res <= op_a_int and op_b_int; |
when alu_nand_c => fu_logic_res <= op_a_int nand op_b_int; |
when alu_orr_c => fu_logic_res <= op_a_int or op_b_int; |
when alu_eor_c => fu_logic_res <= op_a_int xor op_b_int; |
when alu_bic_c => fu_logic_res <= op_a_int and (not op_b_int); |
when others => fu_logic_res <= (others => '0'); |
fu_logic_flg(0) <= '0'; |
fu_logic_flg(1) <= '0'; |
end case; |
end process fu_logic_core; |
|
|
|
-- Function Selector ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
-- Data result -- |
ALU_RES_INT <= FU_ARITH_RES or FU_SHIFT_RES or FU_LOGIC_RES; |
-- Function Selector ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
-- data result -- |
alu_res_int <= fu_arith_res or fu_shift_res or fu_logic_res; |
|
-- Carry Flag -- |
FLAG_BUS_O(flag_c_c) <= FU_ARITH_FLG(0) or FU_SHIFT_FLG(0) or FU_LOGIC_FLG(0); |
-- carry flag -- |
flag_bus_o(flag_c_c) <= fu_arith_flg(0) or fu_shift_flg(0) or fu_logic_flg(0); |
|
-- Overflow Flag -- |
FLAG_BUS_O(flag_o_c) <= FU_ARITH_FLG(1) or FU_SHIFT_FLG(1) or FU_LOGIC_FLG(0); |
-- overflow flag -- |
flag_bus_o(flag_o_c) <= fu_arith_flg(1) or fu_shift_flg(1) or fu_logic_flg(0); |
|
|
|
-- Parity Computation ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
PARITY_GEN: process(OP_A_INT) |
variable par_v : std_logic; |
begin |
par_v := '0'; |
for i in 0 to data_width_c-1 loop |
par_v := par_v xor OP_A_INT(i); |
end loop; |
PARITY_BIT <= par_v; |
end process PARITY_GEN; |
-- Parity Computation ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
parity_gen: process(op_a_int) |
variable par_v : std_logic; |
begin |
par_v := '0'; |
for i in 0 to data_width_c-1 loop |
par_v := par_v xor op_a_int(i); |
end loop; |
parity_bit <= par_v; |
end process parity_gen; |
|
|
|
-- Additional Flag Computation ------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
-- Additional Flag Computation ------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
|
-- Zero detector -- |
-- Ladies and gentleman, the critical path! |
IS_ZERO <= '1' when (to_integer(unsigned(ALU_RES_INT)) = 0) else '0'; -- zero detector |
EXTND_ZERO <= (FLAG_BUS_I(flag_z_c) and IS_ZERO) when (EX_CTRL_BUS_I(ctrl_alu_zf_opt_c) = '0') else (FLAG_BUS_I(flag_z_c) or IS_ZERO); -- extended zero detector |
FLAG_BUS_O(flag_z_c) <= EXTND_ZERO when (EX_CTRL_BUS_I(ctrl_alu_usez_c) = '1') else IS_ZERO; -- (extended) zero flag |
-- zero detector -- |
-- ladies and gentleman, the critical path! |
is_zero <= '1' when (to_integer(unsigned(alu_res_int)) = 0) else '0'; -- zero detector |
extnd_zero <= (flag_bus_i(flag_z_c) and is_zero) when (ex_ctrl_bus_i(ctrl_alu_zf_opt_c) = '0') else (flag_bus_i(flag_z_c) or is_zero); -- extended zero detector |
flag_bus_o(flag_z_c) <= extnd_zero when (ex_ctrl_bus_i(ctrl_alu_usez_c) = '1') else is_zero; -- (extended) zero flag |
|
-- Negative flag -- |
FLAG_BUS_O(flag_n_c) <= ALU_RES_INT(data_width_c-1); -- negative flag |
-- negative flag -- |
flag_bus_o(flag_n_c) <= alu_res_int(data_width_c-1); -- negative flag |
|
-- T-Flag update -- |
SEL_BIT <= OP_A_INT(to_integer(unsigned(OP_B_INT(3 downto 0)))); -- selected bit |
T_FLAG_FUNC <= PARITY_BIT when (EX_CTRL_BUS_I(ctrl_get_par_c) = '1') else SEL_BIT; -- parity or selected bit |
INV_BIT <= (not T_FLAG_FUNC) when (EX_CTRL_BUS_I(ctrl_tf_inv_c) = '1') else T_FLAG_FUNC; -- invert bit? |
TRANSF_INT <= INV_BIT when (EX_CTRL_BUS_I(ctrl_tf_store_c) = '1') else FLAG_BUS_I(flag_t_c); -- transfer flag |
FLAG_BUS_O(flag_t_c) <= TRANSF_INT; |
-- t-flag update -- |
sel_bit <= op_a_int(to_integer(unsigned(op_b_int(3 downto 0)))); -- selected bit |
t_flag_func <= parity_bit when (ex_ctrl_bus_i(ctrl_get_par_c) = '1') else sel_bit; -- parity or selected bit |
inv_bit <= (not t_flag_func) when (ex_ctrl_bus_i(ctrl_tf_inv_c) = '1') else t_flag_func; -- invert bit? |
transf_int <= inv_bit when (ex_ctrl_bus_i(ctrl_tf_store_c) = '1') else flag_bus_i(flag_t_c); -- transfer flag |
flag_bus_o(flag_t_c) <= transf_int; |
|
-- T-Flag for mask generation (this is some kind of forwarding to the opcode decoder) -- |
MASK_T_FLAG_O <= TRANSF_INT when (EX_CTRL_BUS_I(ctrl_en_c) = '1') and (EX_CTRL_BUS_I(ctrl_tf_store_c) = '1') else FLAG_BUS_I(flag_t_c); |
-- t-flag for mask generation (this is some kind of forwarding to the opcode decoder) -- |
mask_t_flag_o <= transf_int when (ex_ctrl_bus_i(ctrl_en_c) = '1') and (ex_ctrl_bus_i(ctrl_tf_store_c) = '1') else flag_bus_i(flag_t_c); |
|
|
|
-- Multiplier Kernel (signed) -------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
-- Operand gating -- |
MUL_OP_A <= OP_A_INT when ((build_mul_c = true) and (EX_CTRL_BUS_I(ctrl_use_mul_c) = '1')) else (others => '0'); |
MUL_OP_B <= OP_B_INT when ((build_mul_c = true) and (EX_CTRL_BUS_I(ctrl_use_mul_c) = '1')) else (others => '0'); |
-- Multiplier Kernel (signed) -------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
-- operand gating -- |
mul_op_a <= op_a_int when ((build_mul_c = true) and (ex_ctrl_bus_i(ctrl_use_mul_c) = '1')) else (others => '0'); |
mul_op_b <= op_b_int when ((build_mul_c = true) and (ex_ctrl_bus_i(ctrl_use_mul_c) = '1')) else (others => '0'); |
|
-- Multiplier core (SIGNED!) -- |
MUL_BUFFER: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
MUL_RES_O <= (others => '0'); |
elsif (CE_I = '1') then |
if (signed_mul_c = true) then |
MUL_RES_O <= std_logic_vector(signed(MUL_OP_A) * signed(MUL_OP_B)); |
else |
MUL_RES_O <= std_logic_vector(unsigned(MUL_OP_A) * unsigned(MUL_OP_B)); |
end if; |
end if; |
end if; |
end process MUL_BUFFER; |
-- multiplier core (signed!) -- |
mul_buffer: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
mul_res_o <= (others => '0'); |
elsif (ce_i = '1') then |
if (signed_mul_c = true) then |
mul_res_o <= std_logic_vector(signed(mul_op_a) * signed(mul_op_b)); |
else |
mul_res_o <= std_logic_vector(unsigned(mul_op_a) * unsigned(mul_op_b)); |
end if; |
end if; |
end if; |
end process mul_buffer; |
|
|
|
-- Module Data Output ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
-- Module Data Output ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
|
-- Coprocessor Interface -- |
CP_CP0_EN_O <= EX_CTRL_BUS_I(ctrl_en_c) and EX_CTRL_BUS_I(ctrl_cp_acc_c) and (not EX_CTRL_BUS_I(ctrl_cp_id_c)); -- cp 0 access |
CP_CP1_EN_O <= EX_CTRL_BUS_I(ctrl_en_c) and EX_CTRL_BUS_I(ctrl_cp_acc_c) and EX_CTRL_BUS_I(ctrl_cp_id_c); -- cp 1 access |
CP_OP_O <= EX_CTRL_BUS_I(ctrl_cp_trans_c); -- data transfer / cp operation |
CP_DAT_O <= OP_A_INT; -- data output |
CP_RW_O <= EX_CTRL_BUS_I(ctrl_cp_wr_c); -- read/write transfer |
CP_CMD_O(cp_op_a_msb_c downto cp_op_a_lsb_c) <= EX_CTRL_BUS_I(ctrl_cp_rd_2_c downto ctrl_cp_rd_0_c) when (EX_CTRL_BUS_I(ctrl_cp_acc_c) = '1') else (others => '0'); -- cp destination / op A reg |
CP_CMD_O(cp_op_b_msb_c downto cp_op_b_lsb_c) <= EX_CTRL_BUS_I(ctrl_cp_ra_2_c downto ctrl_cp_ra_0_c) when (EX_CTRL_BUS_I(ctrl_cp_acc_c) = '1') else (others => '0'); -- cp op B reg |
CP_CMD_O(cp_cmd_msb_c downto cp_cmd_lsb_c) <= EX_CTRL_BUS_I(ctrl_cp_cmd_2_c downto ctrl_cp_cmd_0_c) when (EX_CTRL_BUS_I(ctrl_cp_acc_c) = '1') else (others => '0'); -- cp command |
-- coprocessor interface -- |
cp_cp0_en_o <= ex_ctrl_bus_i(ctrl_en_c) and ex_ctrl_bus_i(ctrl_cp_acc_c) and (not ex_ctrl_bus_i(ctrl_cp_id_c)); -- cp 0 access |
cp_cp1_en_o <= ex_ctrl_bus_i(ctrl_en_c) and ex_ctrl_bus_i(ctrl_cp_acc_c) and ex_ctrl_bus_i(ctrl_cp_id_c); -- cp 1 access |
cp_op_o <= ex_ctrl_bus_i(ctrl_cp_trans_c); -- data transfer / cp operation |
cp_dat_o <= op_a_int; -- data output |
cp_rw_o <= ex_ctrl_bus_i(ctrl_cp_wr_c); -- read/write transfer |
cp_cmd_o(cp_op_a_msb_c downto cp_op_a_lsb_c) <= ex_ctrl_bus_i(ctrl_cp_rd_2_c downto ctrl_cp_rd_0_c) when (ex_ctrl_bus_i(ctrl_cp_acc_c) = '1') else (others => '0'); -- cp destination / op a reg |
cp_cmd_o(cp_op_b_msb_c downto cp_op_b_lsb_c) <= ex_ctrl_bus_i(ctrl_cp_ra_2_c downto ctrl_cp_ra_0_c) when (ex_ctrl_bus_i(ctrl_cp_acc_c) = '1') else (others => '0'); -- cp op b reg |
cp_cmd_o(cp_cmd_msb_c downto cp_cmd_lsb_c) <= ex_ctrl_bus_i(ctrl_cp_cmd_2_c downto ctrl_cp_cmd_0_c) when (ex_ctrl_bus_i(ctrl_cp_acc_c) = '1') else (others => '0'); -- cp command |
|
-- Data Output -- |
MSR_DATA_O <= OP_B_INT; -- MSR write data |
ALU_RES_O <= ALU_RES_INT; -- ALU result |
BP_OPA_O <= OP_A_INT; -- operand A bypass out (address base for mem access) |
-- data output -- |
msr_data_o <= op_b_int; -- msr write data |
alu_res_o <= alu_res_int; -- alu result |
bp_opa_o <= op_a_int; -- operand a bypass out (address base for mem access) |
|
-- Link_address/mem_w_data port -- |
BP_OPC_O <= PC_1D_I when (EX_CTRL_BUS_I(ctrl_link_c) = '1') else OP_C_INT; -- operand C bypass out (data for mem write access) or link address |
-- link_address/mem_w_data port -- |
bp_opc_o <= pc_1d_i when (ex_ctrl_bus_i(ctrl_link_c) = '1') else op_c_int; -- operand c bypass out (data for mem write access) or link address |
|
-- Memory system -- |
MEM_REQ_O <= EX_CTRL_BUS_I(ctrl_en_c) and EX_CTRL_BUS_I(ctrl_mem_acc_c); -- mem access in next cycle |
-- memory system -- |
mem_req_o <= ex_ctrl_bus_i(ctrl_en_c) and ex_ctrl_bus_i(ctrl_mem_acc_c); -- mem access in next cycle |
|
|
|
/atlas_core/trunk/rtl/ATLAS_2K_TOP.vhd
4,7 → 4,7
-- # This is the top entity oth ATLAS 2k processor. # |
-- # See the core's data sheet for more information. # |
-- # **************************************************** # |
-- # Last modified: 09.04.2014 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
16,324 → 16,316
library work; |
use work.atlas_core_package.all; |
|
entity ATLAS_2K_TOP is |
entity atlas_2k_top is |
-- ############################################################################################### |
-- ## Configuration ## |
-- ############################################################################################### |
generic ( |
CLK_SPEED_G : std_logic_vector(31 downto 0) := x"00000000" -- clock speed (in Hz) |
); |
generic ( |
clk_speed_g : std_logic_vector(31 downto 0) := x"00000000" -- clock speed (in Hz) |
); |
-- ############################################################################################### |
-- ## Global Control ## |
-- ############################################################################################### |
port ( |
CLK_I : in std_logic; -- global clock line |
RST_I : in std_logic; -- global reset line, sync, high-active |
CE_I : in std_logic; -- global clock enable, high active |
port ( |
clk_i : in std_logic; -- global clock line |
rst_i : in std_logic; -- global reset line, sync, high-active |
ce_i : in std_logic; -- global clock enable, high active |
|
-- ############################################################################################### |
-- ## Coprocessor Interface ## |
-- ############################################################################################### |
|
CP_EN_O : out std_logic; -- access to cp0 |
CP_ICE_O : out std_logic; -- cp interface clock enable |
CP_OP_O : out std_logic; -- data transfer/processing |
CP_RW_O : out std_logic; -- read/write access |
CP_CMD_O : out std_logic_vector(08 downto 0); -- register addresses / cmd |
CP_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- write data |
CP_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- read data cp0 |
cp_en_o : out std_logic; -- access to cp0 |
cp_ice_o : out std_logic; -- cp interface clock enable |
cp_op_o : out std_logic; -- data transfer/processing |
cp_rw_o : out std_logic; -- read/write access |
cp_cmd_o : out std_logic_vector(08 downto 0); -- register addresses / cmd |
cp_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- write data |
cp_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- read data cp0 |
|
-- ############################################################################################### |
-- ## Memory Interface ## |
-- ############################################################################################### |
|
MEM_I_PAGE_O : out std_logic_vector(data_width_c-1 downto 0); -- instruction page |
MEM_I_ADR_O : out std_logic_vector(data_width_c-1 downto 0); -- instruction adr |
MEM_I_EN_O : out std_logic; -- IR update |
MEM_I_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
mem_i_page_o : out std_logic_vector(data_width_c-1 downto 0); -- instruction page |
mem_i_adr_o : out std_logic_vector(data_width_c-1 downto 0); -- instruction adr |
mem_i_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
|
MEM_D_EN_O : out std_logic; -- access enable |
MEM_D_RW_O : out std_logic; -- read/write |
MEM_D_PAGE_O : out std_logic_vector(data_width_c-1 downto 0); -- data page |
MEM_D_ADR_O : out std_logic_vector(data_width_c-1 downto 0); -- data adr |
MEM_D_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- data out |
MEM_D_DAT_I : in std_logic_vector(data_width_c-1 downto 0); -- data in |
mem_d_en_o : out std_logic; -- access enable |
mem_d_rw_o : out std_logic; -- read/write |
mem_d_page_o : out std_logic_vector(data_width_c-1 downto 0); -- data page |
mem_d_adr_o : out std_logic_vector(data_width_c-1 downto 0); -- data adr |
mem_d_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- data out |
mem_d_dat_i : in std_logic_vector(data_width_c-1 downto 0); -- data in |
|
CRITICAL_IRQ_I : in std_logic; -- critical error IRQ |
critical_irq_i : in std_logic; -- critical error irq |
|
-- ############################################################################################### |
-- ## IO Interface ## |
-- ############################################################################################### |
|
-- UART -- |
UART_RXD_I : in std_logic; -- UART receiver input |
UART_TXD_O : out std_logic; -- UART transmitter output |
-- uart -- |
uart_rxd_i : in std_logic; -- uart receiver input |
uart_txd_o : out std_logic; -- uart transmitter output |
|
-- SPI -- |
SPI_MOSI_O : out std_logic_vector(07 downto 0); -- serial data out |
SPI_MISO_I : in std_logic_vector(07 downto 0); -- serial data in |
SPI_SCK_O : out std_logic_vector(07 downto 0); -- serial clock out |
SPI_CS_O : out std_logic_vector(07 downto 0); -- chip select (low active) |
-- spi -- |
spi_mosi_o : out std_logic_vector(07 downto 0); -- serial data out |
spi_miso_i : in std_logic_vector(07 downto 0); -- serial data in |
spi_sck_o : out std_logic_vector(07 downto 0); -- serial clock out |
spi_cs_o : out std_logic_vector(07 downto 0); -- chip select (low active) |
|
-- Parallel IO -- |
PIO_OUT_O : out std_logic_vector(15 downto 0); -- parallel output |
PIO_IN_I : in std_logic_vector(15 downto 0); -- parallel input |
-- parallel io -- |
pio_out_o : out std_logic_vector(15 downto 0); -- parallel output |
pio_in_i : in std_logic_vector(15 downto 0); -- parallel input |
|
-- System IO -- |
SYS_OUT_O : out std_logic_vector(07 downto 0); -- system output |
SYS_IN_I : in std_logic_vector(07 downto 0); -- system input |
-- system io -- |
sys_out_o : out std_logic_vector(07 downto 0); -- system output |
sys_in_i : in std_logic_vector(07 downto 0); -- system input |
|
-- IRQs -- |
IRQ_I : in std_logic; -- IRQ |
-- irqs -- |
irq_i : in std_logic; -- irq |
|
-- ############################################################################################### |
-- ## Wishbone Bus ## |
-- ############################################################################################### |
|
WB_CLK_O : out std_logic; -- bus clock |
WB_RST_O : out std_logic; -- bus reset, sync, high active |
WB_ADR_O : out std_logic_vector(31 downto 0); -- address |
WB_SEL_O : out std_logic_vector(01 downto 0); -- byte select |
WB_DATA_O : out std_logic_vector(15 downto 0); -- data out |
WB_DATA_I : in std_logic_vector(15 downto 0); -- data in |
WB_WE_O : out std_logic; -- read/write |
WB_CYC_O : out std_logic; -- cycle enable |
WB_STB_O : out std_logic; -- strobe |
WB_ACK_I : in std_logic; -- acknowledge |
WB_ERR_I : in std_logic -- bus error |
); |
end ATLAS_2K_TOP; |
wb_clk_o : out std_logic; -- bus clock |
wb_rst_o : out std_logic; -- bus reset, sync, high active |
wb_adr_o : out std_logic_vector(31 downto 0); -- address |
wb_sel_o : out std_logic_vector(01 downto 0); -- byte select |
wb_data_o : out std_logic_vector(15 downto 0); -- data out |
wb_data_i : in std_logic_vector(15 downto 0); -- data in |
wb_we_o : out std_logic; -- read/write |
wb_cyc_o : out std_logic; -- cycle enable |
wb_stb_o : out std_logic; -- strobe |
wb_ack_i : in std_logic; -- acknowledge |
wb_err_i : in std_logic -- bus error |
); |
end atlas_2k_top; |
|
architecture ATLAS_2K_TOP_BEHAV of ATLAS_2K_TOP is |
architecture atlas_2k_top_behav of atlas_2k_top is |
|
-- Global Control -- |
signal SYS_MODE : std_logic; -- current processor mode |
signal SYS_INT_EXE : std_logic; -- processing IRQ |
-- global control -- |
signal sys_mode : std_logic; -- current processor mode |
signal sys_int_exe : std_logic; -- processing irq |
|
-- Coprocessor Signals -- |
signal USR_CP_EN : std_logic; -- access user coprocessor |
signal SYS_CP_EN : std_logic; -- access system coprocessor |
signal CP_OP : std_logic; -- transfer/data processing |
signal CP_RW : std_logic; -- read/write access |
signal CP_CMD : std_logic_vector(08 downto 0); -- register addresses / cmd |
signal CP_W_DATA : std_logic_vector(data_width_c-1 downto 0); -- write data |
signal SYS_CP_DRB : std_logic_vector(data_width_c-1 downto 0); -- system coprocessor data readback |
signal CP_DATA_RB : std_logic_vector(data_width_c-1 downto 0); -- coprocessor data readback |
-- coprocessor signals -- |
signal usr_cp_en : std_logic; -- access user coprocessor |
signal sys_cp_en : std_logic; -- access system coprocessor |
signal cp_op : std_logic; -- transfer/data processing |
signal cp_rw : std_logic; -- read/write access |
signal cp_cmd : std_logic_vector(08 downto 0); -- register addresses / cmd |
signal cp_w_data : std_logic_vector(data_width_c-1 downto 0); -- write data |
signal sys_cp_drb : std_logic_vector(data_width_c-1 downto 0); -- system coprocessor data readback |
signal cp_data_rb : std_logic_vector(data_width_c-1 downto 0); -- coprocessor data readback |
|
-- CPU Bus -- |
signal CPU_D_REQ : std_logic; -- data access request |
signal CPU_D_RW : std_logic; -- read/write access |
signal CPU_D_ADR : std_logic_vector(data_width_c-1 downto 0); -- access address |
signal CPU_D_W_DATA : std_logic_vector(data_width_c-1 downto 0); -- write data |
signal CPU_D_R_DATA : std_logic_vector(data_width_c-1 downto 0); -- read data |
signal CPU_I_EN : std_logic; -- instruction reg enable |
signal CPU_I_ADR : std_logic_vector(data_width_c-1 downto 0); -- instruction address |
signal CPU_I_DATA : std_logic_vector(data_width_c-1 downto 0); -- instruction word |
signal CP_DAT_I_SYNC : std_logic_vector(data_width_c-1 downto 0); -- external input sync |
-- cpu bus -- |
signal cpu_d_req : std_logic; -- data access request |
signal cpu_d_rw : std_logic; -- read/write access |
signal cpu_d_adr : std_logic_vector(data_width_c-1 downto 0); -- access address |
signal cpu_d_w_data : std_logic_vector(data_width_c-1 downto 0); -- write data |
signal cpu_d_r_data : std_logic_vector(data_width_c-1 downto 0); -- read data |
signal cpu_i_adr : std_logic_vector(data_width_c-1 downto 0); -- instruction address |
signal cpu_i_data : std_logic_vector(data_width_c-1 downto 0); -- instruction word |
signal cp_dat_i_sync : std_logic_vector(data_width_c-1 downto 0); -- external input sync |
|
-- MMU -- |
signal I_PAGE : std_logic_vector(data_width_c-1 downto 0); -- instruction page |
signal D_PAGE : std_logic_vector(data_width_c-1 downto 0); -- data page |
-- mmu -- |
signal i_page : std_logic_vector(data_width_c-1 downto 0); -- instruction page |
signal d_page : std_logic_vector(data_width_c-1 downto 0); -- data page |
|
-- Boot Mem -- |
signal BOOT_I_ADR : std_logic_vector(15 downto 0); -- instruction adr |
signal BOOT_I_EN : std_logic; -- IR update |
signal BOOT_I_DAT : std_logic_vector(15 downto 0); -- instruction out |
signal BOOT_D_EN : std_logic; -- access enable |
signal BOOT_D_RW : std_logic; -- read/write |
signal BOOT_D_ADR : std_logic_vector(15 downto 0); -- data adr |
signal BOOT_D_DAT_O : std_logic_vector(15 downto 0); -- data in |
signal BOOT_D_DAT_I : std_logic_vector(15 downto 0); -- data out |
-- boot mem -- |
signal boot_i_adr : std_logic_vector(15 downto 0); -- instruction adr |
signal boot_i_dat : std_logic_vector(15 downto 0); -- instruction out |
signal boot_d_en : std_logic; -- access enable |
signal boot_d_rw : std_logic; -- read/write |
signal boot_d_adr : std_logic_vector(15 downto 0); -- data adr |
signal boot_d_dat_o : std_logic_vector(15 downto 0); -- data in |
signal boot_d_dat_i : std_logic_vector(15 downto 0); -- data out |
|
-- IRQ Lines -- |
signal SYS_CP_IRQ : std_logic; -- IRQ from system coprocessor |
-- irq lines -- |
signal sys_cp_irq : std_logic; -- irq from system coprocessor |
|
begin |
|
-- Atlas CPU Core -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
cpu_core: ATLAS_CPU |
port map ( |
-- Global Control -- |
CLK_I => CLK_I, -- global clock line |
RST_I => RST_I, -- global reset line, sync, high-active |
CE_I => CE_I, -- clock enable |
-- Atlas CPU Core -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
cpu_core: atlas_cpu |
port map ( |
-- global control -- |
clk_i => clk_i, -- global clock line |
rst_i => rst_i, -- global reset line, sync, high-active |
ce_i => ce_i, -- clock enable |
|
-- Instruction Interface -- |
INSTR_ADR_O => CPU_I_ADR, -- instruction byte adr |
INSTR_DAT_I => CPU_I_DATA, -- instruction input |
INSTR_EN_O => CPU_I_EN, -- allow IR update |
-- instruction interface -- |
instr_adr_o => cpu_i_adr, -- instruction byte adr |
instr_dat_i => cpu_i_data, -- instruction input |
|
-- Data Interface -- |
SYS_MODE_O => SYS_MODE, -- current operating mode |
SYS_INT_O => SYS_INT_EXE, -- interrupt processing |
MEM_REQ_O => CPU_D_REQ, -- mem access in next cycle |
MEM_RW_O => CPU_D_RW, -- read write |
MEM_ADR_O => CPU_D_ADR, -- data byte adr |
MEM_DAT_O => CPU_D_W_DATA, -- write data |
MEM_DAT_I => CPU_D_R_DATA, -- read data |
-- data interface -- |
sys_mode_o => sys_mode, -- current operating mode |
sys_int_o => sys_int_exe, -- interrupt processing |
mem_req_o => cpu_d_req, -- mem access in next cycle |
mem_rw_o => cpu_d_rw, -- read write |
mem_adr_o => cpu_d_adr, -- data byte adr |
mem_dat_o => cpu_d_w_data, -- write data |
mem_dat_i => cpu_d_r_data, -- read data |
|
-- Coprocessor Interface -- |
USR_CP_EN_O => USR_CP_EN, -- access to cp0 |
SYS_CP_EN_O => SYS_CP_EN, -- access to cp1 |
CP_OP_O => CP_OP, -- data transfer/processing |
CP_RW_O => CP_RW, -- read/write access |
CP_CMD_O => CP_CMD, -- register addresses / cmd |
CP_DAT_O => CP_W_DATA, -- write data |
CP_DAT_I => CP_DATA_RB, -- read data cp0 OR cp1 |
-- coprocessor interface -- |
usr_cp_en_o => usr_cp_en, -- access to cp0 |
sys_cp_en_o => sys_cp_en, -- access to cp1 |
cp_op_o => cp_op, -- data transfer/processing |
cp_rw_o => cp_rw, -- read/write access |
cp_cmd_o => cp_cmd, -- register addresses / cmd |
cp_dat_o => cp_w_data, -- write data |
cp_dat_i => cp_data_rb, -- read data cp0 or cp1 |
|
-- Interrupt Lines -- |
EXT_INT_0_I => CRITICAL_IRQ_I, -- critical error irq |
EXT_INT_1_I => SYS_CP_IRQ -- sys cp irq |
); |
-- interrupt lines -- |
ext_int_0_i => critical_irq_i, -- critical error irq |
ext_int_1_i => sys_cp_irq -- sys cp irq |
); |
|
-- External CP data in sync -- |
CP_DAT_IN_SYNC: process (CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
CP_DAT_I_SYNC <= (others => '0'); |
elsif (CE_I = '1') then |
if (USR_CP_EN = '1') then |
CP_DAT_I_SYNC <= CP_DAT_I; |
else |
CP_DAT_I_SYNC <= (others => '0'); |
end if; |
end if; |
end if; |
end process CP_DAT_IN_SYNC; |
-- external cp data in sync -- |
cp_dat_in_sync: process (clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
cp_dat_i_sync <= (others => '0'); |
elsif (ce_i = '1') then |
if (usr_cp_en = '1') then |
cp_dat_i_sync <= cp_dat_i; |
else |
cp_dat_i_sync <= (others => '0'); |
end if; |
end if; |
end if; |
end process cp_dat_in_sync; |
|
-- External Coprocessor Interface -- |
CP_EN_O <= USR_CP_EN; |
CP_OP_O <= CP_OP; |
CP_RW_O <= CP_RW; |
CP_CMD_O <= CP_CMD; |
CP_DAT_O <= CP_W_DATA; |
CP_DATA_RB <= SYS_CP_DRB or CP_DAT_I_SYNC; |
CP_ICE_O <= CE_I; |
-- external coprocessor interface -- |
cp_en_o <= usr_cp_en; |
cp_op_o <= cp_op; |
cp_rw_o <= cp_rw; |
cp_cmd_o <= cp_cmd; |
cp_dat_o <= cp_w_data; |
cp_data_rb <= sys_cp_drb or cp_dat_i_sync; |
cp_ice_o <= ce_i; |
|
|
|
-- System Coprocessor ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
system_coprocessor: SYSTEM_CP |
generic map ( |
CLOCK_SPEED_G => CLK_SPEED_G -- clock speed in Hz |
) |
port map ( |
-- Global Control -- |
CLK_I => CLK_I, -- global clock line |
RST_I => RST_I, -- global reset line, sync, high-active |
ICE_I => CE_I, -- interface clock enable, high-active |
-- System Coprocessor ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
system_coprocessor: system_cp |
generic map ( |
clock_speed_g => clk_speed_g -- clock speed in hz |
) |
port map ( |
-- global control -- |
clk_i => clk_i, -- global clock line |
rst_i => rst_i, -- global reset line, sync, high-active |
ice_i => ce_i, -- interface clock enable, high-active |
|
-- Processor Interface -- |
CP_EN_I => SYS_CP_EN, -- access coprocessor |
CP_OP_I => CP_OP, -- data transfer/processing |
CP_RW_I => CP_RW, -- read/write access |
CP_CMD_I => CP_CMD, -- register addresses / cmd |
CP_DAT_I => CP_W_DATA, -- write data |
CP_DAT_O => SYS_CP_DRB, -- read data |
CP_IRQ_O => SYS_CP_IRQ, -- unit interrupt request |
-- processor interface -- |
cp_en_i => sys_cp_en, -- access coprocessor |
cp_op_i => cp_op, -- data transfer/processing |
cp_rw_i => cp_rw, -- read/write access |
cp_cmd_i => cp_cmd, -- register addresses / cmd |
cp_dat_i => cp_w_data, -- write data |
cp_dat_o => sys_cp_drb, -- read data |
cp_irq_o => sys_cp_irq, -- unit interrupt request |
|
SYS_MODE_I => SYS_MODE, -- current operating mode |
INT_EXE_I => SYS_INT_EXE, -- interrupt beeing executed |
sys_mode_i => sys_mode, -- current operating mode |
int_exe_i => sys_int_exe, -- interrupt beeing executed |
|
-- Memory Interface -- |
MEM_IP_ADR_O => I_PAGE, -- instruction page |
MEM_DP_ADR_O => D_PAGE, -- data page |
-- memory interface -- |
mem_ip_adr_o => i_page, -- instruction page |
mem_dp_adr_o => d_page, -- data page |
|
-- IO Interface -- |
UART_RXD_I => UART_RXD_I, -- receiver input |
UART_TXD_O => UART_TXD_O, -- UART transmitter output |
SPI_SCK_O => SPI_SCK_O, -- serial clock output |
SPI_MOSI_O => SPI_MOSI_O, -- serial data output |
SPI_MISO_I => SPI_MISO_I, -- serial data input |
SPI_CS_O => SPI_CS_O, -- device select |
PIO_OUT_O => PIO_OUT_O, -- parallel output |
PIO_IN_I => PIO_IN_I, -- parallel input |
-- io interface -- |
uart_rxd_i => uart_rxd_i, -- receiver input |
uart_txd_o => uart_txd_o, -- uart transmitter output |
spi_sck_o => spi_sck_o, -- serial clock output |
spi_mosi_o => spi_mosi_o, -- serial data output |
spi_miso_i => spi_miso_i, -- serial data input |
spi_cs_o => spi_cs_o, -- device select |
pio_out_o => pio_out_o, -- parallel output |
pio_in_i => pio_in_i, -- parallel input |
|
-- System IO -- |
SYS_OUT_O => SYS_OUT_O, -- system parallel output |
SYS_IN_I => SYS_IN_I, -- system parallel input |
-- system io -- |
sys_out_o => sys_out_o, -- system parallel output |
sys_in_i => sys_in_i, -- system parallel input |
|
-- IRQ Lines -- |
IRQ_I => IRQ_I, -- external IRQ |
-- irq lines -- |
irq_i => irq_i, -- external irq |
|
-- Wishbone Bus -- |
WB_CLK_O => WB_CLK_O, -- bus clock |
WB_RST_O => WB_RST_O, -- bus reset, sync, high active |
WB_ADR_O => WB_ADR_O, -- address |
WB_SEL_O => WB_SEL_O, -- byte select |
WB_DATA_O => WB_DATA_O, -- data out |
WB_DATA_I => WB_DATA_I, -- data in |
WB_WE_O => WB_WE_O, -- read/write |
WB_CYC_O => WB_CYC_O, -- cycle enable |
WB_STB_O => WB_STB_O, -- strobe |
WB_ACK_I => WB_ACK_I, -- acknowledge |
WB_ERR_I => WB_ERR_I -- bus error |
); |
-- wishbone bus -- |
wb_clk_o => wb_clk_o, -- bus clock |
wb_rst_o => wb_rst_o, -- bus reset, sync, high active |
wb_adr_o => wb_adr_o, -- address |
wb_sel_o => wb_sel_o, -- byte select |
wb_data_o => wb_data_o, -- data out |
wb_data_i => wb_data_i, -- data in |
wb_we_o => wb_we_o, -- read/write |
wb_cyc_o => wb_cyc_o, -- cycle enable |
wb_stb_o => wb_stb_o, -- strobe |
wb_ack_i => wb_ack_i, -- acknowledge |
wb_err_i => wb_err_i -- bus error |
); |
|
|
-- Memory Gate ----------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
memory_gate: MEM_GATE |
port map ( |
-- Host Interface -- |
CLK_I => CLK_I, -- global clock line |
RST_I => RST_I, -- global reset line, sync, high-active |
-- Memory Gate ----------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
memory_gate: mem_gate |
port map ( |
-- host interface -- |
clk_i => clk_i, -- global clock line |
rst_i => rst_i, -- global reset line, sync, high-active |
|
I_ADR_I => CPU_I_ADR, -- instruction adr |
I_EN_I => CPU_I_EN, -- IR update |
I_DAT_O => CPU_I_DATA, -- instruction out |
D_REQ_I => CPU_D_REQ, -- request access in next cycle |
D_RW_I => CPU_D_RW, -- read/write |
D_ADR_I => CPU_D_ADR, -- data adr |
D_DAT_I => CPU_D_W_DATA, -- data in |
D_DAT_O => CPU_D_R_DATA, -- data out |
MEM_IP_ADR_I => I_PAGE, -- instruction page |
MEM_DP_ADR_I => D_PAGE, -- data page |
i_adr_i => cpu_i_adr, -- instruction adr |
i_dat_o => cpu_i_data, -- instruction out |
d_req_i => cpu_d_req, -- request access in next cycle |
d_rw_i => cpu_d_rw, -- read/write |
d_adr_i => cpu_d_adr, -- data adr |
d_dat_i => cpu_d_w_data, -- data in |
d_dat_o => cpu_d_r_data, -- data out |
mem_ip_adr_i => i_page, -- instruction page |
mem_dp_adr_i => d_page, -- data page |
|
-- Boot ROM Interface -- |
BOOT_I_ADR_O => BOOT_I_ADR, -- instruction adr |
BOOT_I_EN_O => BOOT_I_EN, -- IR update |
BOOT_I_DAT_I => BOOT_I_DAT, -- instruction out |
BOOT_D_EN_O => BOOT_D_EN, -- access enable |
BOOT_D_RW_O => BOOT_D_RW, -- read/write |
BOOT_D_ADR_O => BOOT_D_ADR, -- data adr |
BOOT_D_DAT_O => BOOT_D_DAT_O, -- data in |
BOOT_D_DAT_I => BOOT_D_DAT_I, -- data out |
-- boot rom interface -- |
boot_i_adr_o => boot_i_adr, -- instruction adr |
boot_i_dat_i => boot_i_dat, -- instruction out |
boot_d_en_o => boot_d_en, -- access enable |
boot_d_rw_o => boot_d_rw, -- read/write |
boot_d_adr_o => boot_d_adr, -- data adr |
boot_d_dat_o => boot_d_dat_o, -- data in |
boot_d_dat_i => boot_d_dat_i, -- data out |
|
-- Memory Interface -- |
MEM_I_PAGE_O => MEM_I_PAGE_O, -- instruction page |
MEM_I_ADR_O => MEM_I_ADR_O, -- instruction adr |
MEM_I_EN_O => MEM_I_EN_O, -- IR update |
MEM_I_DAT_I => MEM_I_DAT_I, -- instruction out |
MEM_D_EN_O => MEM_D_EN_O, -- access enable |
MEM_D_RW_O => MEM_D_RW_O, -- read/write |
MEM_D_PAGE_O => MEM_D_PAGE_O, -- instruction page |
MEM_D_ADR_O => MEM_D_ADR_O, -- data adr |
MEM_D_DAT_O => MEM_D_DAT_O, -- data in |
MEM_D_DAT_I => MEM_D_DAT_I -- data out |
); |
-- memory interface -- |
mem_i_page_o => mem_i_page_o, -- instruction page |
mem_i_adr_o => mem_i_adr_o, -- instruction adr |
mem_i_dat_i => mem_i_dat_i, -- instruction out |
mem_d_en_o => mem_d_en_o, -- access enable |
mem_d_rw_o => mem_d_rw_o, -- read/write |
mem_d_page_o => mem_d_page_o, -- instruction page |
mem_d_adr_o => mem_d_adr_o, -- data adr |
mem_d_dat_o => mem_d_dat_o, -- data in |
mem_d_dat_i => mem_d_dat_i -- data out |
); |
|
|
|
-- Bootloader Memory ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
bootloader_mem: BOOT_MEM |
port map ( |
-- Host Interface -- |
CLK_I => CLK_I, -- global clock line |
I_ADR_I => BOOT_I_ADR, -- instruction adr |
I_EN_I => BOOT_I_EN, -- IR update |
I_DAT_O => BOOT_I_DAT, -- instruction out |
D_EN_I => BOOT_D_EN, -- access enable |
D_RW_I => BOOT_D_RW, -- read/write |
D_ADR_I => BOOT_D_ADR, -- data adr |
D_DAT_I => BOOT_D_DAT_O, -- data in |
D_DAT_O => BOOT_D_DAT_I -- data out |
); |
-- Bootloader Memory ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
bootloader_mem: boot_mem |
port map ( |
-- host interface -- |
clk_i => clk_i, -- global clock line |
i_adr_i => boot_i_adr, -- instruction adr |
i_dat_o => boot_i_dat, -- instruction out |
d_en_i => boot_d_en, -- access enable |
d_rw_i => boot_d_rw, -- read/write |
d_adr_i => boot_d_adr, -- data adr |
d_dat_i => boot_d_dat_o, -- data in |
d_dat_o => boot_d_dat_i -- data out |
); |
|
|
|
end ATLAS_2K_TOP_BEHAV; |
end atlas_2k_top_behav; |
/atlas_core/trunk/rtl/MEM_ACC.vhd
5,7 → 5,7
-- # data memory interface. Furthermore, internal data # |
-- # switching networks are located here. # |
-- # **************************************************** # |
-- # Last modified: 08.05.2014 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
18,188 → 18,188
use work.atlas_core_package.all; |
|
entity MEM_ACC is |
port ( |
port ( |
-- ############################################################################################### |
-- ## Global Control ## |
-- ############################################################################################### |
|
CLK_I : in std_logic; -- global clock line |
CE_I : in std_logic; -- clock enable |
RST_I : in std_logic; -- global reset line, sync, high-active |
clk_i : in std_logic; -- global clock line |
ce_i : in std_logic; -- clock enable |
rst_i : in std_logic; -- global reset line, sync, high-active |
|
-- ############################################################################################### |
-- ## Function Control ## |
-- ############################################################################################### |
|
MA_CTRL_BUS_I : in std_logic_vector(ctrl_width_c-1 downto 0); -- ma stage control |
ma_ctrl_bus_i : in std_logic_vector(ctrl_width_c-1 downto 0); -- ma stage control |
|
-- ############################################################################################### |
-- ## Data Input ## |
-- ############################################################################################### |
|
ALU_RES_I : in std_logic_vector(data_width_c-1 downto 0); -- alu result |
MUL_RES_I : in std_logic_vector(2*data_width_c-1 downto 0); -- mul result |
ADR_BASE_I : in std_logic_vector(data_width_c-1 downto 0); -- op_a bypass |
DATA_BP_I : in std_logic_vector(data_width_c-1 downto 0); -- op_b bypass |
CP_DATA_I : in std_logic_vector(data_width_c-1 downto 0); -- coprocessor rd data |
RD_MSR_I : in std_logic_vector(data_width_c-1 downto 0); -- read data msr |
alu_res_i : in std_logic_vector(data_width_c-1 downto 0); -- alu result |
mul_res_i : in std_logic_vector(2*data_width_c-1 downto 0); -- mul result |
adr_base_i : in std_logic_vector(data_width_c-1 downto 0); -- op_a bypass |
data_bp_i : in std_logic_vector(data_width_c-1 downto 0); -- op_b bypass |
cp_data_i : in std_logic_vector(data_width_c-1 downto 0); -- coprocessor rd data |
rd_msr_i : in std_logic_vector(data_width_c-1 downto 0); -- read data msr |
|
WB_FWD_I : in std_logic_vector(fwd_width_c-1 downto 0); -- WB stage forwarding path |
wb_fwd_i : in std_logic_vector(fwd_width_c-1 downto 0); -- wb stage forwarding path |
|
-- ############################################################################################### |
-- ## Data Output ## |
-- ############################################################################################### |
|
DATA_O : out std_logic_vector(data_width_c-1 downto 0); -- data output |
MEM_ADR_FB_O : out std_logic_vector(data_width_c-1 downto 0); -- memory address feedback |
data_o : out std_logic_vector(data_width_c-1 downto 0); -- data output |
mem_adr_fb_o : out std_logic_vector(data_width_c-1 downto 0); -- memory address feedback |
|
MA_FWD_O : out std_logic_vector(fwd_width_c-1 downto 0); -- MA stage forwarding path |
ma_fwd_o : out std_logic_vector(fwd_width_c-1 downto 0); -- ma stage forwarding path |
|
-- ############################################################################################### |
-- ## Memory (w) Interface ## |
-- ############################################################################################### |
|
MEM_ADR_O : out std_logic_vector(data_width_c-1 downto 0); -- address output |
MEM_DAT_O : out std_logic_vector(data_width_c-1 downto 0); -- write data output |
MEM_RW_O : out std_logic -- read write |
); |
end MEM_ACC; |
mem_adr_o : out std_logic_vector(data_width_c-1 downto 0); -- address output |
mem_dat_o : out std_logic_vector(data_width_c-1 downto 0); -- write data output |
mem_rw_o : out std_logic -- read write |
); |
end mem_acc; |
|
architecture MA_STRUCTURE of MEM_ACC is |
architecture ma_structure of mem_acc is |
|
-- Pipeline register -- |
signal ALU_RES_FF : std_logic_vector(data_width_c-1 downto 0); |
signal ADR_BASE_FF : std_logic_vector(data_width_c-1 downto 0); |
signal DATA_BP_FF : std_logic_vector(data_width_c-1 downto 0); |
-- pipeline register -- |
signal alu_res_ff : std_logic_vector(data_width_c-1 downto 0); |
signal adr_base_ff : std_logic_vector(data_width_c-1 downto 0); |
signal data_bp_ff : std_logic_vector(data_width_c-1 downto 0); |
|
-- ALU data buffer -- |
signal ALU_RES_BUF : std_logic_vector(data_width_c-1 downto 0); |
-- alu data buffer -- |
signal alu_res_buf : std_logic_vector(data_width_c-1 downto 0); |
|
-- Internal signals -- |
signal DATA_BP_INT : std_logic_vector(data_width_c-1 downto 0); |
signal ALU_MAC_DAT : std_logic_vector(data_width_c-1 downto 0); |
signal SYS_CP_R_DAT : std_logic_vector(data_width_c-1 downto 0); |
signal SYS_CP_ALU_R_DAT : std_logic_vector(data_width_c-1 downto 0); |
signal MUL_RES_INT : std_logic_vector(data_width_c-1 downto 0); |
-- internal signals -- |
signal data_bp_int : std_logic_vector(data_width_c-1 downto 0); |
signal alu_mac_dat : std_logic_vector(data_width_c-1 downto 0); |
signal sys_cp_r_dat : std_logic_vector(data_width_c-1 downto 0); |
signal sys_cp_alu_r_dat : std_logic_vector(data_width_c-1 downto 0); |
signal mul_res_int : std_logic_vector(data_width_c-1 downto 0); |
|
begin |
|
-- Pipeline Register ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
PIPE_REG: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
if (RST_I = '1') then |
ALU_RES_FF <= (others => '0'); |
ADR_BASE_FF <= (others => '0'); |
DATA_BP_FF <= (others => '0'); |
ALU_RES_BUF <= (others => '0'); |
elsif (CE_I = '1') then |
ALU_RES_FF <= ALU_RES_I; |
ADR_BASE_FF <= ADR_BASE_I; |
DATA_BP_FF <= DATA_BP_I; |
ALU_RES_BUF <= ALU_RES_FF; |
end if; |
end if; |
end process PIPE_REG; |
-- Pipeline Register ----------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
pipe_reg: process(clk_i) |
begin |
if rising_edge(clk_i) then |
if (rst_i = '1') then |
alu_res_ff <= (others => '0'); |
adr_base_ff <= (others => '0'); |
data_bp_ff <= (others => '0'); |
alu_res_buf <= (others => '0'); |
elsif (ce_i = '1') then |
alu_res_ff <= alu_res_i; |
adr_base_ff <= adr_base_i; |
data_bp_ff <= data_bp_i; |
alu_res_buf <= alu_res_ff; |
end if; |
end if; |
end process pipe_reg; |
|
|
|
-- Memory Access Forwarding Unit ----------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
MA_FWD: process(WB_FWD_I, MA_CTRL_BUS_I, DATA_BP_FF) |
begin |
-- Memory write data (OP_B) forwarding -- |
if (WB_FWD_I(fwd_en_c) = '1') and (MA_CTRL_BUS_I(ctrl_mcyc_c) = '0') and (MA_CTRL_BUS_I(ctrl_rb_3_c downto ctrl_rb_0_c) = WB_FWD_I(fwd_adr_3_c downto fwd_adr_0_c)) then |
DATA_BP_INT <= WB_FWD_I(fwd_dat_msb_c downto fwd_dat_lsb_c); -- WB stage |
else |
DATA_BP_INT <= DATA_BP_FF; |
end if; |
end process MA_FWD; |
-- Memory Access Forwarding Unit ----------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
ma_fwd: process(wb_fwd_i, ma_ctrl_bus_i, data_bp_ff) |
begin |
-- memory write data (op_b) forwarding -- |
if (wb_fwd_i(fwd_en_c) = '1') and (ma_ctrl_bus_i(ctrl_mcyc_c) = '0') and (ma_ctrl_bus_i(ctrl_rb_3_c downto ctrl_rb_0_c) = wb_fwd_i(fwd_adr_3_c downto fwd_adr_0_c)) then |
data_bp_int <= wb_fwd_i(fwd_dat_msb_c downto fwd_dat_lsb_c); -- wb stage |
else |
data_bp_int <= data_bp_ff; |
end if; |
end process ma_fwd; |
|
|
|
-- Memory Address Generator and Data Alignment --------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
W_MEM_ACC: process(MA_CTRL_BUS_I, ALU_RES_BUF, ADR_BASE_FF, ALU_RES_FF, DATA_BP_INT) |
variable mem_adr_v : std_logic_vector(data_width_c-1 downto 0); |
variable dat_end_v : std_logic_vector(data_width_c-1 downto 0); |
begin |
-- address origin -- |
if (MA_CTRL_BUS_I(ctrl_mem_daa_c) = '1') then |
mem_adr_v := ALU_RES_BUF; -- use delayed address |
elsif (MA_CTRL_BUS_I(ctrl_mem_bpba_c) = '1') then |
mem_adr_v := ADR_BASE_FF; -- use bypassed address |
else |
mem_adr_v := ALU_RES_FF; |
end if; |
MEM_ADR_FB_O <= mem_adr_v; -- data alignment address |
MEM_ADR_O <= mem_adr_v; -- memory address output |
-- Memory Address Generator and Data Alignment --------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
w_mem_acc: process(ma_ctrl_bus_i, alu_res_buf, adr_base_ff, alu_res_ff, data_bp_int) |
variable mem_adr_v : std_logic_vector(data_width_c-1 downto 0); |
variable dat_end_v : std_logic_vector(data_width_c-1 downto 0); |
begin |
-- address origin -- |
if (ma_ctrl_bus_i(ctrl_mem_daa_c) = '1') then |
mem_adr_v := alu_res_buf; -- use delayed address |
elsif (ma_ctrl_bus_i(ctrl_mem_bpba_c) = '1') then |
mem_adr_v := adr_base_ff; -- use bypassed address |
else |
mem_adr_v := alu_res_ff; |
end if; |
mem_adr_fb_o <= mem_adr_v; -- data alignment address |
mem_adr_o <= mem_adr_v; -- memory address output |
|
-- Endianness converter -- |
if (big_endian_c = false) then |
dat_end_v := DATA_BP_INT(data_width_c/2-1 downto 0) & DATA_BP_INT(data_width_c-1 downto data_width_c/2); |
else |
dat_end_v := DATA_BP_INT; |
end if; |
-- endianness converter -- |
if (big_endian_c = false) then |
dat_end_v := data_bp_int(data_width_c/2-1 downto 0) & data_bp_int(data_width_c-1 downto data_width_c/2); |
else |
dat_end_v := data_bp_int; |
end if; |
|
-- data alignment -- |
if (word_mode_en_c = false) then -- byte-addressed memory |
if (mem_adr_v(0) = '1') then -- unaligned? -> swap bytes |
MEM_DAT_O <= dat_end_v(data_width_c/2-1 downto 0) & dat_end_v(data_width_c-1 downto data_width_c/2); |
else -- aligned |
MEM_DAT_O <= dat_end_v; |
end if; |
else -- word-addressed memory |
MEM_DAT_O <= dat_end_v; |
end if; |
end process W_MEM_ACC; |
-- data alignment -- |
if (word_mode_en_c = false) then -- byte-addressed memory |
if (mem_adr_v(0) = '1') then -- unaligned? -> swap bytes |
mem_dat_o <= dat_end_v(data_width_c/2-1 downto 0) & dat_end_v(data_width_c-1 downto data_width_c/2); |
else -- aligned |
mem_dat_o <= dat_end_v; |
end if; |
else -- word-addressed memory |
mem_dat_o <= dat_end_v; |
end if; |
end process w_mem_acc; |
|
-- R/W Control -- |
MEM_RW_O <= MA_CTRL_BUS_I(ctrl_mem_wr_c) and MA_CTRL_BUS_I(ctrl_en_c); |
-- r/w control -- |
mem_rw_o <= ma_ctrl_bus_i(ctrl_mem_wr_c) and ma_ctrl_bus_i(ctrl_en_c); |
|
|
|
-- Stage Data Multiplexer ------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
no_mul_unit: -- syntheszie no MUL unit at all |
if (build_mul_c = false) generate |
MUL_RES_INT <= (others => '0'); |
ALU_MAC_DAT <= ALU_RES_FF; |
end generate no_mul_unit; |
-- Stage Data Multiplexer ------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
no_mul_unit: -- syntheszie no mul unit at all |
if (build_mul_c = false) generate |
mul_res_int <= (others => '0'); |
alu_mac_dat <= alu_res_ff; |
end generate no_mul_unit; |
|
synhesize_mul16_unit: -- synthesize 16-bit MUL unit |
if (build_mul_c = true) and (build_mul32_c = false) generate |
MUL_RES_INT <= (others => '0'); |
ALU_MAC_DAT <= MUL_RES_I(15 downto 0) when (MA_CTRL_BUS_I(ctrl_use_mul_c) = '1') else ALU_RES_FF; |
end generate synhesize_mul16_unit; |
synhesize_mul16_unit: -- synthesize 16-bit mul unit |
if (build_mul_c = true) and (build_mul32_c = false) generate |
mul_res_int <= (others => '0'); |
alu_mac_dat <= mul_res_i(15 downto 0) when (ma_ctrl_bus_i(ctrl_use_mul_c) = '1') else alu_res_ff; |
end generate synhesize_mul16_unit; |
|
synhesize_mul32_unit: -- synthesize 32-bit MUL unit |
if (build_mul_c = true) and (build_mul32_c = true) generate |
MUL_RES_INT <= MUL_RES_I(31 downto 16) when (MA_CTRL_BUS_I(ctrl_ext_mul_c) = '1') else MUL_RES_I(15 downto 0); |
ALU_MAC_DAT <= MUL_RES_INT when (MA_CTRL_BUS_I(ctrl_use_mul_c) = '1') else ALU_RES_FF; |
end generate synhesize_mul32_unit; |
synhesize_mul32_unit: -- synthesize 32-bit mul unit |
if (build_mul_c = true) and (build_mul32_c = true) generate |
mul_res_int <= mul_res_i(31 downto 16) when (ma_ctrl_bus_i(ctrl_ext_mul_c) = '1') else mul_res_i(15 downto 0); |
alu_mac_dat <= mul_res_int when (ma_ctrl_bus_i(ctrl_use_mul_c) = '1') else alu_res_ff; |
end generate synhesize_mul32_unit; |
|
-- Coprocessor input -- |
SYS_CP_R_DAT <= CP_DATA_I when (MA_CTRL_BUS_I(ctrl_rd_cp_acc_c) = '1') else RD_MSR_I; |
-- coprocessor input -- |
sys_cp_r_dat <= cp_data_i when (ma_ctrl_bus_i(ctrl_rd_cp_acc_c) = '1') else rd_msr_i; |
|
-- Multiplexers -- |
SYS_CP_ALU_R_DAT <= SYS_CP_R_DAT when (MA_CTRL_BUS_I(ctrl_cp_msr_rd_c) = '1') else ALU_MAC_DAT; |
DATA_O <= DATA_BP_FF when (MA_CTRL_BUS_I(ctrl_link_c) = '1') else SYS_CP_ALU_R_DAT; |
-- multiplexers -- |
sys_cp_alu_r_dat <= sys_cp_r_dat when (ma_ctrl_bus_i(ctrl_cp_msr_rd_c) = '1') else alu_mac_dat; |
data_o <= data_bp_ff when (ma_ctrl_bus_i(ctrl_link_c) = '1') else sys_cp_alu_r_dat; |
|
|
|
-- Forwarding Path Output ------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
-- Forwarding Path Output ------------------------------------------------------------------------------ |
-- -------------------------------------------------------------------------------------------------------- |
|
-- forwarding data -- |
MA_FWD_O(fwd_dat_msb_c downto fwd_dat_lsb_c) <= SYS_CP_ALU_R_DAT; |
-- forwarding data -- |
ma_fwd_o(fwd_dat_msb_c downto fwd_dat_lsb_c) <= sys_cp_alu_r_dat; |
|
-- destination address -- |
MA_FWD_O(fwd_adr_3_c downto fwd_adr_0_c) <= MA_CTRL_BUS_I(ctrl_rd_3_c downto ctrl_rd_0_c); |
-- destination address -- |
ma_fwd_o(fwd_adr_3_c downto fwd_adr_0_c) <= ma_ctrl_bus_i(ctrl_rd_3_c downto ctrl_rd_0_c); |
|
-- valid forwarding -- |
MA_FWD_O(fwd_en_c) <= MA_CTRL_BUS_I(ctrl_wb_en_c); |
-- valid forwarding -- |
ma_fwd_o(fwd_en_c) <= ma_ctrl_bus_i(ctrl_wb_en_c); |
|
|
|
/atlas_core/trunk/rtl/OP_DEC.vhd
3,7 → 3,7
-- # **************************************************** # |
-- # OpCode (instruction) decoding unit. # |
-- # **************************************************** # |
-- # Last modified: 08.05.2014 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
15,512 → 15,512
library work; |
use work.atlas_core_package.all; |
|
entity OP_DEC is |
port ( |
entity op_dec is |
port ( |
-- ############################################################################################### |
-- ## Decoder Interface Input ## |
-- ############################################################################################### |
|
INSTR_I : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
INSTR_ADR_I : in std_logic_vector(data_width_c-1 downto 0); -- corresponding address |
T_FLAG_I : in std_logic; -- T-Flag input |
M_FLAG_I : in std_logic; -- Mode flag input |
MULTI_CYC_I : in std_logic; -- multi-cycle indicator |
CP_PTC_I : in std_logic; -- user coprocessor protection |
instr_i : in std_logic_vector(data_width_c-1 downto 0); -- instruction input |
instr_adr_i : in std_logic_vector(data_width_c-1 downto 0); -- corresponding address |
t_flag_i : in std_logic; -- t-flag input |
m_flag_i : in std_logic; -- mode flag input |
multi_cyc_i : in std_logic; -- multi-cycle indicator |
cp_ptc_i : in std_logic; -- user coprocessor protection |
|
-- ############################################################################################### |
-- ## Decoder Interface Output ## |
-- ############################################################################################### |
|
MULTI_CYC_REQ_O : out std_logic; -- multi-cycle reqest |
CTRL_O : out std_logic_vector(ctrl_width_c-1 downto 0); -- decoder ctrl lines |
IMM_O : out std_logic_vector(data_width_c-1 downto 0) -- immediate |
); |
end OP_DEC; |
MULTI_CYC_REQ_O : OUT STD_LOGIC; -- MULTI-CYCLE REQEST |
CTRL_O : OUT STD_LOGIC_VECTOR(CTRL_WIDTH_C-1 DOWNTO 0); -- DECODER CTRL LINES |
IMM_O : OUT STD_LOGIC_VECTOR(DATA_WIDTH_C-1 DOWNTO 0) -- IMMEDIATE |
); |
END OP_DEC; |
|
architecture OP_DEC_STRUCTURE of OP_DEC is |
ARCHITECTURE OP_DEC_STRUCTURE OF OP_DEC IS |
|
-- formated instruction -- |
signal INSTR_INT : std_logic_vector(15 downto 0); |
-- FORMATED INSTRUCTION -- |
SIGNAL INSTR_INT : STD_LOGIC_VECTOR(15 DOWNTO 0); |
|
begin |
BEGIN |
|
-- Data Format Converter ------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
DATA_CONV: process(INSTR_I, INSTR_ADR_I) |
variable instr_sel_v : std_logic_vector(31 downto 0); |
variable instr_tmp_v : std_logic_vector(15 downto 0); |
begin |
instr_sel_v := (others => '0'); |
for i in 0 to data_width_c-1 loop |
instr_sel_v(i) := INSTR_I(i); |
end loop; |
if (data_width_c = 16) then -- 16-bit mode |
instr_tmp_v := instr_sel_v(15 downto 0); |
else -- 32-bit mode |
if (INSTR_ADR_I(1) = '0') then |
instr_tmp_v := instr_sel_v(15 downto 0); |
else |
instr_tmp_v := instr_sel_v(31 downto 16); |
end if; |
end if; |
if (big_endian_c = false) then -- endian converter |
INSTR_INT <= instr_tmp_v(7 downto 0) & instr_tmp_v(15 downto 8); |
else |
INSTR_INT <= instr_tmp_v; |
end if; |
end process DATA_CONV; |
-- Data Format Converter ------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
data_conv: process(instr_i, instr_adr_i) |
variable instr_sel_v : std_logic_vector(31 downto 0); |
variable instr_tmp_v : std_logic_vector(15 downto 0); |
begin |
instr_sel_v := (others => '0'); |
for i in 0 to data_width_c-1 loop |
instr_sel_v(i) := instr_i(i); |
end loop; |
if (data_width_c = 16) then -- 16-bit mode |
instr_tmp_v := instr_sel_v(15 downto 0); |
else -- 32-bit mode |
if (instr_adr_i(1) = '0') then |
instr_tmp_v := instr_sel_v(15 downto 0); |
else |
instr_tmp_v := instr_sel_v(31 downto 16); |
end if; |
end if; |
if (big_endian_c = false) then -- endian converter |
instr_int <= instr_tmp_v(7 downto 0) & instr_tmp_v(15 downto 8); |
else |
instr_int <= instr_tmp_v; |
end if; |
end process data_conv; |
|
|
|
-- Opcode Decoder -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
OPCODE_DECODER: process(INSTR_INT, MULTI_CYC_I, T_FLAG_I, M_FLAG_I, CP_PTC_I) |
variable mem_acc_temp_v : std_logic_vector(3 downto 0); |
variable redundant_reg_v : std_logic; |
begin |
-- Opcode Decoder -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
opcode_decoder: process(instr_int, multi_cyc_i, t_flag_i, m_flag_i, cp_ptc_i) |
variable mem_acc_temp_v : std_logic_vector(3 downto 0); |
variable redundant_reg_v : std_logic; |
begin |
|
-- defaults -- |
IMM_O <= (others => '0'); -- zero immediate |
MULTI_CYC_REQ_O <= '0'; -- no multi-cycle operation |
CTRL_O <= (others => '0'); -- all signals disabled |
CTRL_O(ctrl_en_c) <= '1'; -- but we're enabled ^^ |
CTRL_O(ctrl_cp_id_c) <= INSTR_INT(10); -- coprocessor ID |
CTRL_O(ctrl_ra_3_c downto ctrl_ra_0_c) <= M_FLAG_I & INSTR_INT(6 downto 4); -- operand A register |
CTRL_O(ctrl_rb_3_c downto ctrl_rb_0_c) <= M_FLAG_I & INSTR_INT(2 downto 0); -- operand B register |
CTRL_O(ctrl_rd_3_c downto ctrl_rd_0_c) <= M_FLAG_I & INSTR_INT(9 downto 7); -- destination register |
CTRL_O(ctrl_cond_3_c downto ctrl_cond_0_c) <= INSTR_INT(13 downto 10); -- branch condition |
-- defaults -- |
imm_o <= (others => '0'); -- zero immediate |
multi_cyc_req_o <= '0'; -- no multi-cycle operation |
ctrl_o <= (others => '0'); -- all signals disabled |
ctrl_o(ctrl_en_c) <= '1'; -- but we're enabled ^^ |
ctrl_o(ctrl_cp_id_c) <= instr_int(10); -- coprocessor id |
ctrl_o(ctrl_ra_3_c downto ctrl_ra_0_c) <= m_flag_i & instr_int(6 downto 4); -- operand a register |
ctrl_o(ctrl_rb_3_c downto ctrl_rb_0_c) <= m_flag_i & instr_int(2 downto 0); -- operand b register |
ctrl_o(ctrl_rd_3_c downto ctrl_rd_0_c) <= m_flag_i & instr_int(9 downto 7); -- destination register |
ctrl_o(ctrl_cond_3_c downto ctrl_cond_0_c) <= instr_int(13 downto 10); -- branch condition |
|
-- both operands have same addresses? -- |
redundant_reg_v := '0'; |
if (INSTR_INT(6 downto 4) = INSTR_INT(2 downto 0)) then |
redundant_reg_v := '1'; |
end if; |
-- both operands have same addresses? -- |
redundant_reg_v := '0'; |
if (instr_int(6 downto 4) = instr_int(2 downto 0)) then |
redundant_reg_v := '1'; |
end if; |
|
-- decoder -- |
case (INSTR_INT(15 downto 14)) is |
-- decoder -- |
case (instr_int(15 downto 14)) is |
|
when "00" => -- Class 0: ALU data processing // Bank / PC / MSR transfer |
-- ============================================================================== |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- allow write back |
CTRL_O(ctrl_fupdate_c) <= INSTR_INT(3); -- flag update |
IMM_O(2 downto 0) <= INSTR_INT(2 downto 0); -- 3-bit immediate |
if (INSTR_INT(13 downto 10) = fs_inc_c) or (INSTR_INT(13 downto 10) = fs_dec_c) or (INSTR_INT(13 downto 10) = fs_sft_c) then |
CTRL_O(ctrl_rb_is_imm_c) <= '1'; -- yes, this is an immediate |
end if; |
-- mapping to alu elementary operation -- |
case (INSTR_INT(13 downto 10)) is |
when "00" => -- class 0: alu data processing // bank / pc / msr transfer |
-- ============================================================================== |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- allow write back |
ctrl_o(ctrl_fupdate_c) <= instr_int(3); -- flag update |
imm_o(2 downto 0) <= instr_int(2 downto 0); -- 3-bit immediate |
if (instr_int(13 downto 10) = fs_inc_c) or (instr_int(13 downto 10) = fs_dec_c) or (instr_int(13 downto 10) = fs_sft_c) then |
ctrl_o(ctrl_rb_is_imm_c) <= '1'; -- yes, this is an immediate |
end if; |
-- mapping to alu elementary operation -- |
case (instr_int(13 downto 10)) is |
|
when fs_orr_c => -- logical or // load from user bank register if redundant |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_orr_c; -- logical or |
if (redundant_reg_v = '1') then -- user bank load |
CTRL_O(ctrl_ra_3_c) <= user_mode_c; -- load from user bank |
CTRL_O(ctrl_rb_3_c) <= user_mode_c; -- load from user bank |
if (M_FLAG_I = user_mode_c) then -- unauthorized access |
CTRL_O(ctrl_cmd_err_c) <= '1'; -- access violation - cmd_err trap |
end if; |
end if; |
when fs_orr_c => -- logical or // load from user bank register if redundant |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_orr_c; -- logical or |
if (redundant_reg_v = '1') then -- user bank load |
ctrl_o(ctrl_ra_3_c) <= user_mode_c; -- load from user bank |
ctrl_o(ctrl_rb_3_c) <= user_mode_c; -- load from user bank |
if (m_flag_i = user_mode_c) then -- unauthorized access |
ctrl_o(ctrl_cmd_err_c) <= '1'; -- access violation - cmd_err trap |
end if; |
end if; |
|
when fs_and_c => -- logical and // store to user bank register if redundant |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_and_c; -- logical and |
if (redundant_reg_v = '1') then -- user bank store |
CTRL_O(ctrl_rd_3_c) <= user_mode_c; -- store to user bank |
if (M_FLAG_I = user_mode_c) then -- unauthorized access |
CTRL_O(ctrl_cmd_err_c) <= '1'; -- access violation - cmd_err trap |
end if; |
end if; |
when fs_and_c => -- logical and // store to user bank register if redundant |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_and_c; -- logical and |
if (redundant_reg_v = '1') then -- user bank store |
ctrl_o(ctrl_rd_3_c) <= user_mode_c; -- store to user bank |
if (m_flag_i = user_mode_c) then -- unauthorized access |
ctrl_o(ctrl_cmd_err_c) <= '1'; -- access violation - cmd_err trap |
end if; |
end if; |
|
when fs_cmp_c => -- compare by sbtraction // load from msr if s = 0 |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sbc_c; -- compare by subtraction |
CTRL_O(ctrl_rd_wb_c) <= '0'; -- disable write back |
CTRL_O(ctrl_msr_am_1_c) <= INSTR_INT(6); |
CTRL_O(ctrl_msr_am_0_c) <= INSTR_INT(5); |
if (INSTR_INT(3) = '0') then -- load from MSR |
if (INSTR_INT(6 downto 5) /= "11") and (M_FLAG_I = user_mode_c) then |
CTRL_O(ctrl_cmd_err_c) <= '1'; -- access violation - cmd_err trap |
end if; |
CTRL_O(ctrl_msr_rd_c) <= '1'; -- read msr |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- re-enable write back |
end if; |
when fs_cmp_c => -- compare by sbtraction // load from msr if s = 0 |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sbc_c; -- compare by subtraction |
ctrl_o(ctrl_rd_wb_c) <= '0'; -- disable write back |
ctrl_o(ctrl_msr_am_1_c) <= instr_int(6); |
ctrl_o(ctrl_msr_am_0_c) <= instr_int(5); |
if (instr_int(3) = '0') then -- load from msr |
if (instr_int(6 downto 5) /= "11") and (m_flag_i = user_mode_c) then |
ctrl_o(ctrl_cmd_err_c) <= '1'; -- access violation - cmd_err trap |
end if; |
ctrl_o(ctrl_msr_rd_c) <= '1'; -- read msr |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- re-enable write back |
end if; |
|
when fs_cpx_c => -- extended compare with flags // store to msr if s = 0 |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sbc_c; -- compare by subtraction with flags |
CTRL_O(ctrl_alu_usec_c) <= '1'; -- use carry input |
CTRL_O(ctrl_alu_usez_c) <= '1'; -- use zero input |
CTRL_O(ctrl_rd_wb_c) <= '0'; -- disable write back |
CTRL_O(ctrl_msr_am_1_c) <= INSTR_INT(6); -- only for MSR immediate write access |
CTRL_O(ctrl_msr_am_0_c) <= INSTR_INT(5); -- only for MSR immediate write access |
CTRL_O(ctrl_alu_cf_opt_c) <= INSTR_INT(9); -- invert carry flag option? |
CTRL_O(ctrl_alu_zf_opt_c) <= INSTR_INT(8); -- use old zero flag option? |
IMM_O(msr_sys_z_flag_c) <= INSTR_INT(0); -- only for MSR immediate write access |
IMM_O(msr_usr_z_flag_c) <= INSTR_INT(0); -- only for MSR immediate write access |
IMM_O(msr_sys_c_flag_c) <= INSTR_INT(1); -- only for MSR immediate write access |
IMM_O(msr_usr_c_flag_c) <= INSTR_INT(1); -- only for MSR immediate write access |
IMM_O(msr_sys_o_flag_c) <= INSTR_INT(2); -- only for MSR immediate write access |
IMM_O(msr_usr_o_flag_c) <= INSTR_INT(2); -- only for MSR immediate write access |
IMM_O(msr_sys_n_flag_c) <= INSTR_INT(7); -- only for MSR immediate write access |
IMM_O(msr_usr_n_flag_c) <= INSTR_INT(7); -- only for MSR immediate write access |
IMM_O(msr_sys_t_flag_c) <= INSTR_INT(8); -- only for MSR immediate write access |
IMM_O(msr_usr_t_flag_c) <= INSTR_INT(8); -- only for MSR immediate write access |
if (INSTR_INT(3) = '0') then -- store to MSR |
if ((M_FLAG_I = user_mode_c) and (INSTR_INT(6 downto 5) /= "11")) then |
CTRL_O(ctrl_cmd_err_c) <= '1'; -- access violation -> cmd_err trap |
end if; |
if(MULTI_CYC_I = '0') then |
CTRL_O(ctrl_msr_wr_c) <= '1'; -- write msr |
MULTI_CYC_REQ_O <= '1'; -- we need a dummy cycle afterwards |
CTRL_O(ctrl_rb_is_imm_c) <= INSTR_INT(4); -- store immediate |
else |
CTRL_O(ctrl_en_c) <= '0'; -- insert empty cycle |
end if; |
end if; |
when fs_cpx_c => -- extended compare with flags // store to msr if s = 0 |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sbc_c; -- compare by subtraction with flags |
ctrl_o(ctrl_alu_usec_c) <= '1'; -- use carry input |
ctrl_o(ctrl_alu_usez_c) <= '1'; -- use zero input |
ctrl_o(ctrl_rd_wb_c) <= '0'; -- disable write back |
ctrl_o(ctrl_msr_am_1_c) <= instr_int(6); -- only for msr immediate write access |
ctrl_o(ctrl_msr_am_0_c) <= instr_int(5); -- only for msr immediate write access |
ctrl_o(ctrl_alu_cf_opt_c) <= instr_int(9); -- invert carry flag option? |
ctrl_o(ctrl_alu_zf_opt_c) <= instr_int(8); -- use old zero flag option? |
imm_o(msr_sys_z_flag_c) <= instr_int(0); -- only for msr immediate write access |
imm_o(msr_usr_z_flag_c) <= instr_int(0); -- only for msr immediate write access |
imm_o(msr_sys_c_flag_c) <= instr_int(1); -- only for msr immediate write access |
imm_o(msr_usr_c_flag_c) <= instr_int(1); -- only for msr immediate write access |
imm_o(msr_sys_o_flag_c) <= instr_int(2); -- only for msr immediate write access |
imm_o(msr_usr_o_flag_c) <= instr_int(2); -- only for msr immediate write access |
imm_o(msr_sys_n_flag_c) <= instr_int(7); -- only for msr immediate write access |
imm_o(msr_usr_n_flag_c) <= instr_int(7); -- only for msr immediate write access |
imm_o(msr_sys_t_flag_c) <= instr_int(8); -- only for msr immediate write access |
imm_o(msr_usr_t_flag_c) <= instr_int(8); -- only for msr immediate write access |
if (instr_int(3) = '0') then -- store to msr |
if ((m_flag_i = user_mode_c) and (instr_int(6 downto 5) /= "11")) then |
ctrl_o(ctrl_cmd_err_c) <= '1'; -- access violation -> cmd_err trap |
end if; |
if(multi_cyc_i = '0') then |
ctrl_o(ctrl_msr_wr_c) <= '1'; -- write msr |
multi_cyc_req_o <= '1'; -- we need a dummy cycle afterwards |
ctrl_o(ctrl_rb_is_imm_c) <= instr_int(4); -- store immediate |
else |
ctrl_o(ctrl_en_c) <= '0'; -- insert empty cycle |
end if; |
end if; |
|
when fs_tst_c => -- compare by logical xor // load from pc if s = 0 |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_eor_c; -- compare by logical xor |
CTRL_O(ctrl_rd_wb_c) <= '0'; -- disable write back |
if (INSTR_INT(3) = '0') then -- load from PC |
CTRL_O(ctrl_ra_is_pc_c) <= '1'; -- read pc |
CTRL_O(ctrl_rb_is_imm_c) <= INSTR_INT(3); -- this is an immediate |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- re-enable write back |
end if; |
when fs_tst_c => -- compare by logical xor // load from pc if s = 0 |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_eor_c; -- compare by logical xor |
ctrl_o(ctrl_rd_wb_c) <= '0'; -- disable write back |
if (instr_int(3) = '0') then -- load from pc |
ctrl_o(ctrl_ra_is_pc_c) <= '1'; -- read pc |
ctrl_o(ctrl_rb_is_imm_c) <= instr_int(3); -- this is an immediate |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- re-enable write back |
end if; |
|
when fs_teq_c => -- compare by logical and // store to pc if s = 0 |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_and_c; -- compare by logical and |
CTRL_O(ctrl_rd_3_c downto ctrl_rd_0_c) <= M_FLAG_I & link_reg_adr_c; -- link register |
CTRL_O(ctrl_rd_wb_c) <= '0'; -- disable write back |
if (INSTR_INT(3) = '0') then -- store to PC |
if ((M_FLAG_I = user_mode_c) and ((INSTR_INT(1 downto 0) /= "00") or (INSTR_INT(7) = '1'))) then |
CTRL_O(ctrl_cmd_err_c) <= '1'; -- access violation - cmd_err trap |
end if; |
CTRL_O(ctrl_pc_wr_c) <= '1'; -- write pc |
CTRL_O(ctrl_rb_is_imm_c) <= '1'; -- this is an immediate |
IMM_O <= (others => '0'); -- zero |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_orr_c; -- logical or with 0 |
CTRL_O(ctrl_ctx_down_c) <= INSTR_INT(0); -- goto user mode when bit 0 = '1' |
CTRL_O(ctrl_re_xint_c) <= INSTR_INT(1); -- re-enable global xint flag |
CTRL_O(ctrl_link_c) <= INSTR_INT(2); -- link |
CTRL_O(ctrl_rd_wb_c) <= INSTR_INT(2); -- allow write back for linking |
CTRL_O(ctrl_restsm_c) <= INSTR_INT(7); -- restore saved mode |
end if; |
when fs_teq_c => -- compare by logical and // store to pc if s = 0 |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_and_c; -- compare by logical and |
ctrl_o(ctrl_rd_3_c downto ctrl_rd_0_c) <= m_flag_i & link_reg_adr_c; -- link register |
ctrl_o(ctrl_rd_wb_c) <= '0'; -- disable write back |
if (instr_int(3) = '0') then -- store to pc |
if ((m_flag_i = user_mode_c) and ((instr_int(1 downto 0) /= "00") or (instr_int(7) = '1'))) then |
ctrl_o(ctrl_cmd_err_c) <= '1'; -- access violation - cmd_err trap |
end if; |
ctrl_o(ctrl_pc_wr_c) <= '1'; -- write pc |
ctrl_o(ctrl_rb_is_imm_c) <= '1'; -- this is an immediate |
imm_o <= (others => '0'); -- zero |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_orr_c; -- logical or with 0 |
ctrl_o(ctrl_ctx_down_c) <= instr_int(0); -- goto user mode when bit 0 = '1' |
ctrl_o(ctrl_re_xint_c) <= instr_int(1); -- re-enable global xint flag |
ctrl_o(ctrl_link_c) <= instr_int(2); -- link |
ctrl_o(ctrl_rd_wb_c) <= instr_int(2); -- allow write back for linking |
ctrl_o(ctrl_restsm_c) <= instr_int(7); -- restore saved mode |
end if; |
|
when fs_inc_c | fs_add_c => -- immediate addition // addition |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_adc_c; |
when fs_inc_c | fs_add_c => -- immediate addition // addition |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_adc_c; |
|
when fs_dec_c => -- immediate subtraction |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sbc_c; |
when fs_dec_c => -- immediate subtraction |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sbc_c; |
|
when fs_sub_c => -- subtraction |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sbc_c; |
if (redundant_reg_v = '1') then -- SUB instruction with Ra = Rb: Rd = 0 - Ra (NEG Rd, Ra) |
CTRL_O(ctrl_clr_la_c) <= '1'; -- set low byte of A to 0 |
CTRL_O(ctrl_clr_ha_c) <= '1'; -- set high byte of A to 0 |
end if; |
when fs_sub_c => -- subtraction |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sbc_c; |
if (redundant_reg_v = '1') then -- sub instruction with ra = rb: rd = 0 - ra (neg rd, ra) |
ctrl_o(ctrl_clr_la_c) <= '1'; -- set low byte of a to 0 |
ctrl_o(ctrl_clr_ha_c) <= '1'; -- set high byte of a to 0 |
end if; |
|
when fs_adc_c => -- addition with carry |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_adc_c; |
CTRL_O(ctrl_alu_usec_c) <= '1'; -- use carry input |
when fs_adc_c => -- addition with carry |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_adc_c; |
ctrl_o(ctrl_alu_usec_c) <= '1'; -- use carry input |
|
when fs_sbc_c => -- subtraction with carry |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sbc_c; |
CTRL_O(ctrl_alu_usec_c) <= '1'; -- use carry input |
if (redundant_reg_v = '1') then -- SBC instruction with Ra = Rb: Rd = 0 - Ra - C (NEC Rd, Ra) |
CTRL_O(ctrl_clr_la_c) <= '1'; -- set low byte of A to 0 |
CTRL_O(ctrl_clr_ha_c) <= '1'; -- set high byte of A to 0 |
end if; |
when fs_sbc_c => -- subtraction with carry |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sbc_c; |
ctrl_o(ctrl_alu_usec_c) <= '1'; -- use carry input |
if (redundant_reg_v = '1') then -- sbc instruction with ra = rb: rd = 0 - ra - c (nec rd, ra) |
ctrl_o(ctrl_clr_la_c) <= '1'; -- set low byte of a to 0 |
ctrl_o(ctrl_clr_ha_c) <= '1'; -- set high byte of a to 0 |
end if; |
|
when fs_eor_c => -- logical xor |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_eor_c; |
when fs_eor_c => -- logical xor |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_eor_c; |
|
when fs_nand_c => -- logical not-and |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_nand_c; |
when fs_nand_c => -- logical not-and |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_nand_c; |
|
when fs_bic_c => -- bit clear |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_bic_c; |
when fs_bic_c => -- bit clear |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_bic_c; |
|
when fs_sft_c => -- shift operation |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sft_c; |
when fs_sft_c => -- shift operation |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sft_c; |
|
when others => -- undefined |
NULL; -- use defaults |
when others => -- undefined |
null; -- use defaults |
|
end case; |
end case; |
|
|
when "01" => -- Class 1: Memory Access |
-- ============================================================================== |
IMM_O(2 downto 0) <= INSTR_INT(2 downto 0); -- immediate offset |
if (INSTR_INT(12) = '1') then |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_adc_c; -- add index |
else |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sbc_c; -- sub index |
end if; |
mem_acc_temp_v := INSTR_INT(10) & INSTR_INT(3) & INSTR_INT(13) & INSTR_INT(11); -- L,I,P,W |
case (mem_acc_temp_v) is |
when "01" => -- class 1: memory access |
-- ============================================================================== |
imm_o(2 downto 0) <= instr_int(2 downto 0); -- immediate offset |
if (instr_int(12) = '1') then |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_adc_c; -- add index |
else |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_sbc_c; -- sub index |
end if; |
mem_acc_temp_v := instr_int(10) & instr_int(3) & instr_int(13) & instr_int(11); -- l,i,p,w |
case (mem_acc_temp_v) is |
|
when "0000" | "0100" => -- load, imm/reg offset, pre, no wb |
CTRL_O(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
CTRL_O(ctrl_rb_is_imm_c) <= INSTR_INT(3); -- this is an immediate |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- allow data write back |
when "0000" | "0100" => -- load, imm/reg offset, pre, no wb |
ctrl_o(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
ctrl_o(ctrl_rb_is_imm_c) <= instr_int(3); -- this is an immediate |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- allow data write back |
|
when "0001" | "0101" => -- load, imm/reg offset, pre, do wb |
CTRL_O(ctrl_rb_is_imm_c) <= INSTR_INT(3); -- this is an immediate |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- allow data write back |
if (MULTI_CYC_I = '0') then -- fist cycle: ADD/SUB R_base, R_base, Offset |
CTRL_O(ctrl_rd_3_c downto ctrl_rd_0_c) <= M_FLAG_I & INSTR_INT(6 downto 4); -- base adr |
MULTI_CYC_REQ_O <= '1'; -- prepare second cycle |
else -- second cycle: LD R_data, [R_base] |
CTRL_O(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
CTRL_O(ctrl_mem_bpba_c) <= '1'; -- use bypassed adr from prev cycle |
end if; |
when "0001" | "0101" => -- load, imm/reg offset, pre, do wb |
ctrl_o(ctrl_rb_is_imm_c) <= instr_int(3); -- this is an immediate |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- allow data write back |
if (multi_cyc_i = '0') then -- fist cycle: add/sub r_base, r_base, offset |
ctrl_o(ctrl_rd_3_c downto ctrl_rd_0_c) <= m_flag_i & instr_int(6 downto 4); -- base adr |
multi_cyc_req_o <= '1'; -- prepare second cycle |
else -- second cycle: ld r_data, [r_base] |
ctrl_o(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
ctrl_o(ctrl_mem_bpba_c) <= '1'; -- use bypassed adr from prev cycle |
end if; |
|
when "0011" | "0111" => -- load, imm/reg offset, post, do wb |
CTRL_O(ctrl_rb_is_imm_c) <= INSTR_INT(3); -- this is an immediate |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- allow data write back |
if (MULTI_CYC_I = '0') then -- fist cycle: LD R_data, [R_base] |
CTRL_O(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
CTRL_O(ctrl_mem_bpba_c) <= '1'; -- use bypassed adr from prev cycle |
MULTI_CYC_REQ_O <= '1'; -- prepare second cycle |
else -- second cycle: ADD/SUB R_base, R_base, Offset |
CTRL_O(ctrl_rd_3_c downto ctrl_rd_0_c) <= M_FLAG_I & INSTR_INT(6 downto 4); -- base adr |
end if; |
when "0011" | "0111" => -- load, imm/reg offset, post, do wb |
ctrl_o(ctrl_rb_is_imm_c) <= instr_int(3); -- this is an immediate |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- allow data write back |
if (multi_cyc_i = '0') then -- fist cycle: ld r_data, [r_base] |
ctrl_o(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
ctrl_o(ctrl_mem_bpba_c) <= '1'; -- use bypassed adr from prev cycle |
multi_cyc_req_o <= '1'; -- prepare second cycle |
else -- second cycle: add/sub r_base, r_base, offset |
ctrl_o(ctrl_rd_3_c downto ctrl_rd_0_c) <= m_flag_i & instr_int(6 downto 4); -- base adr |
end if; |
|
when "1000" | "1001" => -- store, reg offset, pre, (no) wb |
if (MULTI_CYC_I = '0') then -- fist cycle: ADD/SUB R_base, R_base, R_offset |
CTRL_O(ctrl_rd_3_c downto ctrl_rd_0_c) <= M_FLAG_I & INSTR_INT(6 downto 4); -- base adr |
CTRL_O(ctrl_rd_wb_c) <= INSTR_INT(11); -- write back base? |
MULTI_CYC_REQ_O <= '1'; -- prepare second cycle |
else -- second cycle: ST R_data, [R_base] |
CTRL_O(ctrl_rb_3_c downto ctrl_rb_0_c) <= M_FLAG_I & INSTR_INT(9 downto 7); -- store data |
CTRL_O(ctrl_mem_daa_c) <= '1'; -- use delayed adr from prev cycle |
CTRL_O(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
CTRL_O(ctrl_mem_wr_c) <= '1'; -- write access |
end if; |
when "1000" | "1001" => -- store, reg offset, pre, (no) wb |
if (multi_cyc_i = '0') then -- fist cycle: add/sub r_base, r_base, r_offset |
ctrl_o(ctrl_rd_3_c downto ctrl_rd_0_c) <= m_flag_i & instr_int(6 downto 4); -- base adr |
ctrl_o(ctrl_rd_wb_c) <= instr_int(11); -- write back base? |
multi_cyc_req_o <= '1'; -- prepare second cycle |
else -- second cycle: st r_data, [r_base] |
ctrl_o(ctrl_rb_3_c downto ctrl_rb_0_c) <= m_flag_i & instr_int(9 downto 7); -- store data |
ctrl_o(ctrl_mem_daa_c) <= '1'; -- use delayed adr from prev cycle |
ctrl_o(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
ctrl_o(ctrl_mem_wr_c) <= '1'; -- write access |
end if; |
|
when "1011" => -- store, reg offset, post, do wb |
if (MULTI_CYC_I = '0') then -- fist cycle: ST R_data, [R_base] |
CTRL_O(ctrl_rb_3_c downto ctrl_rb_0_c) <= M_FLAG_I & INSTR_INT(9 downto 7); -- store data |
CTRL_O(ctrl_mem_bpba_c) <= '1'; -- use bypassed adr from prev cycle |
CTRL_O(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
CTRL_O(ctrl_mem_wr_c) <= '1'; -- write access |
MULTI_CYC_REQ_O <= '1'; -- prepare second cycle |
else -- second cycle: ADD/SUB R_base, R_base, R_offset |
CTRL_O(ctrl_rd_3_c downto ctrl_rd_0_c) <= M_FLAG_I & INSTR_INT(6 downto 4); -- base adr |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- write back base |
end if; |
when "1011" => -- store, reg offset, post, do wb |
if (multi_cyc_i = '0') then -- fist cycle: st r_data, [r_base] |
ctrl_o(ctrl_rb_3_c downto ctrl_rb_0_c) <= m_flag_i & instr_int(9 downto 7); -- store data |
ctrl_o(ctrl_mem_bpba_c) <= '1'; -- use bypassed adr from prev cycle |
ctrl_o(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
ctrl_o(ctrl_mem_wr_c) <= '1'; -- write access |
multi_cyc_req_o <= '1'; -- prepare second cycle |
else -- second cycle: add/sub r_base, r_base, r_offset |
ctrl_o(ctrl_rd_3_c downto ctrl_rd_0_c) <= m_flag_i & instr_int(6 downto 4); -- base adr |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- write back base |
end if; |
|
when "1100" | "1101" | "1111" => -- store, imm offset, pre/post, (no) wb |
CTRL_O(ctrl_rd_3_c downto ctrl_rd_0_c) <= M_FLAG_I & INSTR_INT(6 downto 4); -- base adr |
CTRL_O(ctrl_rb_3_c downto ctrl_rb_0_c) <= M_FLAG_I & INSTR_INT(9 downto 7); -- store data |
CTRL_O(ctrl_rb_is_imm_c) <= '1'; -- this is an immediate |
CTRL_O(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
CTRL_O(ctrl_mem_wr_c) <= '1'; -- write access |
CTRL_O(ctrl_mem_bpba_c) <= INSTR_INT(13); -- use bypassed adr base |
CTRL_O(ctrl_rd_wb_c) <= INSTR_INT(11); -- write back base |
when "1100" | "1101" | "1111" => -- store, imm offset, pre/post, (no) wb |
ctrl_o(ctrl_rd_3_c downto ctrl_rd_0_c) <= m_flag_i & instr_int(6 downto 4); -- base adr |
ctrl_o(ctrl_rb_3_c downto ctrl_rb_0_c) <= m_flag_i & instr_int(9 downto 7); -- store data |
ctrl_o(ctrl_rb_is_imm_c) <= '1'; -- this is an immediate |
ctrl_o(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
ctrl_o(ctrl_mem_wr_c) <= '1'; -- write access |
ctrl_o(ctrl_mem_bpba_c) <= instr_int(13); -- use bypassed adr base |
ctrl_o(ctrl_rd_wb_c) <= instr_int(11); -- write back base |
|
-- Data Swap Operations R_b => M[R_a] => R_d -------------------------------- |
when "0010" | "0110" | "1010" | "1110" => -- load/store, imm/reg offset, post, no wb [REDUNDANT!] |
CTRL_O(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
CTRL_O(ctrl_mem_bpba_c) <= '1'; -- use bypassed adr from prev cycle |
CTRL_O(ctrl_rb_is_imm_c) <= '1'; -- this is an immediate (pseudo) |
if (MULTI_CYC_I = '0') then -- first cycle: LD R_d, [R_a] |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- write back base |
MULTI_CYC_REQ_O <= '1'; -- prepare second cycle |
else -- second cycle: ST R_b, [R_a] |
CTRL_O(ctrl_mem_wr_c) <= '1'; -- write access |
end if; |
-- data swap operations r_b => m[r_a] => r_d -------------------------------- |
when "0010" | "0110" | "1010" | "1110" => -- load/store, imm/reg offset, post, no wb [redundant!] |
ctrl_o(ctrl_mem_acc_c) <= '1'; -- this is a memory access |
ctrl_o(ctrl_mem_bpba_c) <= '1'; -- use bypassed adr from prev cycle |
ctrl_o(ctrl_rb_is_imm_c) <= '1'; -- this is an immediate (pseudo) |
if (multi_cyc_i = '0') then -- first cycle: ld r_d, [r_a] |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- write back base |
multi_cyc_req_o <= '1'; -- prepare second cycle |
else -- second cycle: st r_b, [r_a] |
ctrl_o(ctrl_mem_wr_c) <= '1'; -- write access |
end if; |
|
when others => -- undefined |
NULL; -- wayne ^^ |
when others => -- undefined |
null; -- wayne ^^ |
|
end case; |
end case; |
|
|
when "10" => -- Class 2: Branch and Link |
-- ============================================================================== |
CTRL_O(ctrl_branch_c) <= '1'; -- this is a branch |
CTRL_O(ctrl_link_c) <= INSTR_INT(9); -- link? |
CTRL_O(ctrl_ra_is_pc_c) <= '1'; -- operand A is the pc |
CTRL_O(ctrl_rb_is_imm_c) <= '1'; -- operand B is an immediate |
CTRL_O(ctrl_rd_wb_c) <= INSTR_INT(9); -- allow write back for linking |
CTRL_O(ctrl_rd_3_c downto ctrl_rd_0_c) <= M_FLAG_I & link_reg_adr_c; -- link register |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_adc_c; -- add offset (without carry) |
if (word_mode_en_c = false) then -- byte addressing mode |
IMM_O(9 downto 0) <= INSTR_INT(8 downto 0) & '0'; -- offset = offset * 2 (byte offset) |
for i in 10 to data_width_c-1 loop |
IMM_O(i) <= INSTR_INT(8); -- sign extension |
end loop; |
else -- word addressing mode |
IMM_O(8 downto 0) <= INSTR_INT(8 downto 0); -- offset = offset (word offset) |
for i in 9 to data_width_c-1 loop |
IMM_O(i) <= INSTR_INT(8); -- sign extension |
end loop; |
end if; |
when "10" => -- class 2: branch and link |
-- ============================================================================== |
ctrl_o(ctrl_branch_c) <= '1'; -- this is a branch |
ctrl_o(ctrl_link_c) <= instr_int(9); -- link? |
ctrl_o(ctrl_ra_is_pc_c) <= '1'; -- operand a is the pc |
ctrl_o(ctrl_rb_is_imm_c) <= '1'; -- operand b is an immediate |
ctrl_o(ctrl_rd_wb_c) <= instr_int(9); -- allow write back for linking |
ctrl_o(ctrl_rd_3_c downto ctrl_rd_0_c) <= m_flag_i & link_reg_adr_c; -- link register |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_adc_c; -- add offset (without carry) |
if (word_mode_en_c = false) then -- byte addressing mode |
imm_o(9 downto 0) <= instr_int(8 downto 0) & '0'; -- offset = offset * 2 (byte offset) |
for i in 10 to data_width_c-1 loop |
imm_o(i) <= instr_int(8); -- sign extension |
end loop; |
else -- word addressing mode |
imm_o(8 downto 0) <= instr_int(8 downto 0); -- offset = offset (word offset) |
for i in 9 to data_width_c-1 loop |
imm_o(i) <= instr_int(8); -- sign extension |
end loop; |
end if; |
|
|
when "11" => -- Class 3: Sub Classes |
-- ============================================================================== |
case (INSTR_INT(13 downto 12)) is |
when "11" => -- class 3: sub classes |
-- ============================================================================== |
case (instr_int(13 downto 12)) is |
|
when "00" => -- Class 3a: Load Immediate |
-- -------------------------------------------------------------------------------- |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- allow write back |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_orr_c; -- logical OR |
CTRL_O(ctrl_ra_3_c downto ctrl_ra_0_c) <= M_FLAG_I & INSTR_INT(9 downto 7); -- op A = source & destination |
CTRL_O(ctrl_rb_is_imm_c) <= '1'; -- B is an immediate |
if (INSTR_INT(11) = '0') then -- load and expand low part |
CTRL_O(ctrl_clr_la_c) <= '1'; -- set low byte of A to 0 |
IMM_O(7 downto 0) <= INSTR_INT(10) & INSTR_INT(6 downto 0); |
if (ldil_sign_ext_c = true) then -- use sign extension |
for i in 8 to data_width_c-1 loop -- sign extension |
IMM_O(i) <= INSTR_INT(10); |
end loop; |
CTRL_O(ctrl_clr_ha_c) <= '1'; -- set high byte of A to 0 |
end if; |
else -- load high part |
IMM_O(15 downto 8) <= INSTR_INT(10) & INSTR_INT(6 downto 0); |
CTRL_O(ctrl_clr_ha_c) <= '1'; -- set high byte of A to 0 |
end if; |
|
when "00" => -- class 3a: load immediate |
-- -------------------------------------------------------------------------------- |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- allow write back |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_orr_c; -- logical or |
ctrl_o(ctrl_ra_3_c downto ctrl_ra_0_c) <= m_flag_i & instr_int(9 downto 7); -- op a = source & destination |
ctrl_o(ctrl_rb_is_imm_c) <= '1'; -- b is an immediate |
if (instr_int(11) = '0') then -- load and expand low part |
ctrl_o(ctrl_clr_la_c) <= '1'; -- set low byte of a to 0 |
imm_o(7 downto 0) <= instr_int(10) & instr_int(6 downto 0); |
if (ldil_sign_ext_c = true) then -- use sign extension |
for i in 8 to data_width_c-1 loop -- sign extension |
imm_o(i) <= instr_int(10); |
end loop; |
ctrl_o(ctrl_clr_ha_c) <= '1'; -- set high byte of a to 0 |
end if; |
else -- load high part |
imm_o(15 downto 8) <= instr_int(10) & instr_int(6 downto 0); |
ctrl_o(ctrl_clr_ha_c) <= '1'; -- set high byte of a to 0 |
end if; |
|
|
when "01" => -- Class 3b: Bit Transfer |
-- -------------------------------------------------------------------------------- |
CTRL_O(ctrl_rb_is_imm_c) <= '1'; -- B is an immediate |
case (INSTR_INT(11 downto 10)) is |
when "00" => -- modifiy bit -> clear bit |
IMM_O(to_integer(unsigned(INSTR_INT(3 downto 0)))) <= '1'; |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_bic_c; -- bit clear |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- allow write back |
when "01" => -- modify bit -> set bit |
IMM_O(to_integer(unsigned(INSTR_INT(3 downto 0)))) <= '1'; |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_orr_c; -- logical or |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- allow write back |
when "10" => -- T-flag transfer, load from T |
IMM_O(to_integer(unsigned(INSTR_INT(3 downto 0)))) <= '1'; |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- allow write back |
if (T_FLAG_I = '0') then |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_bic_c; -- bit clear |
else |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_orr_c; -- logical or |
end if; |
when others => -- "11" -- T-flag transfer, store to T |
IMM_O(3 downto 0) <= INSTR_INT(3 downto 0); |
CTRL_O(ctrl_rb_is_imm_c) <= not INSTR_INT(9); -- B is an immediate or REG |
CTRL_O(ctrl_tf_store_c) <= '1'; -- store to t-flag |
CTRL_O(ctrl_tf_inv_c) <= INSTR_INT(7); -- invert bit to be transfered to T-flag |
CTRL_O(ctrl_get_par_c) <= INSTR_INT(8); -- get parity bit of OP_A |
end case; |
when "01" => -- class 3b: bit transfer |
-- -------------------------------------------------------------------------------- |
ctrl_o(ctrl_rb_is_imm_c) <= '1'; -- b is an immediate |
case (instr_int(11 downto 10)) is |
when "00" => -- modifiy bit -> clear bit |
imm_o(to_integer(unsigned(instr_int(3 downto 0)))) <= '1'; |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_bic_c; -- bit clear |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- allow write back |
when "01" => -- modify bit -> set bit |
imm_o(to_integer(unsigned(instr_int(3 downto 0)))) <= '1'; |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_orr_c; -- logical or |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- allow write back |
when "10" => -- t-flag transfer, load from t |
imm_o(to_integer(unsigned(instr_int(3 downto 0)))) <= '1'; |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- allow write back |
if (t_flag_i = '0') then |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_bic_c; -- bit clear |
else |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_orr_c; -- logical or |
end if; |
when others => -- "11" -- t-flag transfer, store to t |
imm_o(3 downto 0) <= instr_int(3 downto 0); |
ctrl_o(ctrl_rb_is_imm_c) <= not instr_int(9); -- b is an immediate or reg |
ctrl_o(ctrl_tf_store_c) <= '1'; -- store to t-flag |
ctrl_o(ctrl_tf_inv_c) <= instr_int(7); -- invert bit to be transfered to t-flag |
ctrl_o(ctrl_get_par_c) <= instr_int(8); -- get parity bit of op_a |
end case; |
|
|
when "10" => -- Class 3c: Coprocessor Access |
-- -------------------------------------------------------------------------------- |
CTRL_O(ctrl_cp_acc_c) <= '1'; -- this is a cp access |
CTRL_O(ctrl_cp_trans_c) <= INSTR_INT(11); -- data transfer/access |
if (INSTR_INT(11) = '1') then -- data transfer |
CTRL_O(ctrl_cp_wr_c) <= INSTR_INT(3); -- read / write |
CTRL_O(ctrl_rd_wb_c) <= not INSTR_INT(3); -- allow write back |
end if; |
if (M_FLAG_I = user_mode_c) then -- access violation? |
if ((CP_PTC_I = '1') and (INSTR_INT(10) = '0')) or (INSTR_INT(10) = '1') then -- unauthorized acces? |
CTRL_O(ctrl_cmd_err_c) <= '1'; -- access violation/undefined instruction - cmd_err trap |
end if; |
end if; |
when "10" => -- class 3c: coprocessor access |
-- -------------------------------------------------------------------------------- |
ctrl_o(ctrl_cp_acc_c) <= '1'; -- this is a cp access |
ctrl_o(ctrl_cp_trans_c) <= instr_int(11); -- data transfer/access |
if (instr_int(11) = '1') then -- data transfer |
ctrl_o(ctrl_cp_wr_c) <= instr_int(3); -- read / write |
ctrl_o(ctrl_rd_wb_c) <= not instr_int(3); -- allow write back |
end if; |
if (m_flag_i = user_mode_c) then -- access violation? |
if ((cp_ptc_i = '1') and (instr_int(10) = '0')) or (instr_int(10) = '1') then -- unauthorized acces? |
ctrl_o(ctrl_cmd_err_c) <= '1'; -- access violation/undefined instruction - cmd_err trap |
end if; |
end if; |
|
|
when others => -- Class 3d: Sub Sub Classes |
-- ============================================================================== |
case (INSTR_INT(11 downto 10)) is |
when others => -- class 3d: sub sub classes |
-- ============================================================================== |
case (instr_int(11 downto 10)) is |
|
when "00" => -- Class 3c0: Multiplication |
-- -------------------------------------------------------------------------------- |
if (INSTR_INT(3) = '1') then -- MUL32 |
if (build_mul_c = true) and (build_mul32_c = true) then -- unit present? |
CTRL_O(ctrl_ext_mul_c) <= '1'; -- use high result |
CTRL_O(ctrl_use_mul_c) <= '1'; -- use mul unit |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- allow write back |
else -- not present |
CTRL_O(ctrl_cmd_err_c) <= '1'; -- invalid instruction - cmd_err trap |
end if; |
else -- MUL16 |
if (build_mul_c = true) then -- unit present? |
CTRL_O(ctrl_use_mul_c) <= '1'; -- use mul unit |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- allow write back |
else -- not present |
CTRL_O(ctrl_cmd_err_c) <= '1'; -- invalid instruction - cmd_err trap |
end if; |
end if; |
when "00" => -- class 3c0: multiplication |
-- -------------------------------------------------------------------------------- |
if (instr_int(3) = '1') then -- mul32 |
if (build_mul_c = true) and (build_mul32_c = true) then -- unit present? |
ctrl_o(ctrl_ext_mul_c) <= '1'; -- use high result |
ctrl_o(ctrl_use_mul_c) <= '1'; -- use mul unit |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- allow write back |
else -- not present |
ctrl_o(ctrl_cmd_err_c) <= '1'; -- invalid instruction - cmd_err trap |
end if; |
else -- mul16 |
if (build_mul_c = true) then -- unit present? |
ctrl_o(ctrl_use_mul_c) <= '1'; -- use mul unit |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- allow write back |
else -- not present |
ctrl_o(ctrl_cmd_err_c) <= '1'; -- invalid instruction - cmd_err trap |
end if; |
end if; |
|
if (INSTR_INT(3) = '1') then -- MUL32 |
if (build_mul_c = true) and (build_mul32_c = true) then -- unit present? |
CTRL_O(ctrl_ext_mul_c) <= '1'; -- use high result |
CTRL_O(ctrl_use_mul_c) <= '1'; -- use mul unit |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- allow write back |
else -- not present |
CTRL_O(ctrl_cmd_err_c) <= '1'; -- invalid instruction - cmd_err trap |
end if; |
else -- MUL16 |
if (build_mul_c = true) then -- unit present? |
CTRL_O(ctrl_use_mul_c) <= '1'; -- use mul unit |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- allow write back |
else -- not present |
CTRL_O(ctrl_cmd_err_c) <= '1'; -- invalid instruction - cmd_err trap |
end if; |
end if; |
if (instr_int(3) = '1') then -- mul32 |
if (build_mul_c = true) and (build_mul32_c = true) then -- unit present? |
ctrl_o(ctrl_ext_mul_c) <= '1'; -- use high result |
ctrl_o(ctrl_use_mul_c) <= '1'; -- use mul unit |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- allow write back |
else -- not present |
ctrl_o(ctrl_cmd_err_c) <= '1'; -- invalid instruction - cmd_err trap |
end if; |
else -- mul16 |
if (build_mul_c = true) then -- unit present? |
ctrl_o(ctrl_use_mul_c) <= '1'; -- use mul unit |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- allow write back |
else -- not present |
ctrl_o(ctrl_cmd_err_c) <= '1'; -- invalid instruction - cmd_err trap |
end if; |
end if; |
|
|
when "01" => -- Class 3c1: Special (Sleep, Reg-based branch) |
-- -------------------------------------------------------------------------------- |
if (INSTR_INT(9) = '0') then -- SLEEP mode |
if (M_FLAG_I = user_mode_c) then -- access violation? |
CTRL_O(ctrl_cmd_err_c) <= '1'; -- access violation - cmd_err trap |
when "01" => -- class 3c1: special (sleep, reg-based branch) |
-- -------------------------------------------------------------------------------- |
if (instr_int(9) = '0') then -- sleep mode |
if (m_flag_i = user_mode_c) then -- access violation? |
ctrl_o(ctrl_cmd_err_c) <= '1'; -- access violation - cmd_err trap |
else |
CTRL_O(ctrl_sleep_c) <= '1'; -- go to sleep |
ctrl_o(ctrl_sleep_c) <= '1'; -- go to sleep |
end if; |
elsif (reg_branches_en_c = true) then -- register-based branches enabled |
CTRL_O(ctrl_cond_3_c downto ctrl_cond_0_c) <= INSTR_INT(6 downto 3); -- branch condition |
CTRL_O(ctrl_rd_3_c downto ctrl_rd_0_c) <= M_FLAG_I & link_reg_adr_c; -- link register |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_adc_c; -- add offset (without carry) |
CTRL_O(ctrl_branch_c) <= '1'; -- this is a branch |
CTRL_O(ctrl_link_c) <= INSTR_INT(7); -- link? |
CTRL_O(ctrl_rd_wb_c) <= INSTR_INT(7); -- allow write back for linking |
CTRL_O(ctrl_ra_is_pc_c) <= '1'; -- operand A is the pc |
CTRL_O(ctrl_clr_la_c) <= INSTR_INT(8); -- set low byte of A to 0 |
CTRL_O(ctrl_clr_ha_c) <= INSTR_INT(8); -- set high byte of A to 0 |
else |
CTRL_O(ctrl_cmd_err_c) <= '1'; -- undefined instruction - cmd_err trap |
end if; |
elsif (reg_branches_en_c = true) then -- register-based branches enabled |
ctrl_o(ctrl_cond_3_c downto ctrl_cond_0_c) <= instr_int(6 downto 3); -- branch condition |
ctrl_o(ctrl_rd_3_c downto ctrl_rd_0_c) <= m_flag_i & link_reg_adr_c; -- link register |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_adc_c; -- add offset (without carry) |
ctrl_o(ctrl_branch_c) <= '1'; -- this is a branch |
ctrl_o(ctrl_link_c) <= instr_int(7); -- link? |
ctrl_o(ctrl_rd_wb_c) <= instr_int(7); -- allow write back for linking |
ctrl_o(ctrl_ra_is_pc_c) <= '1'; -- operand a is the pc |
ctrl_o(ctrl_clr_la_c) <= instr_int(8); -- set low byte of a to 0 |
ctrl_o(ctrl_clr_ha_c) <= instr_int(8); -- set high byte of a to 0 |
else |
ctrl_o(ctrl_cmd_err_c) <= '1'; -- undefined instruction - cmd_err trap |
end if; |
|
|
when "10" => -- Class 3c2: Conditional MOVE = if (COND=TRUE) then Rd <= Rb |
-- -------------------------------------------------------------------------------- |
when "10" => -- class 3c2: conditional move = if (cond=true) then rd <= rb |
-- -------------------------------------------------------------------------------- |
if (cond_moves_en_c = true) then -- conditional moves enabled |
CTRL_O(ctrl_cond_3_c downto ctrl_cond_0_c) <= INSTR_INT(6 downto 3); -- branch condition |
CTRL_O(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_orr_c; -- logical OR |
CTRL_O(ctrl_rd_wb_c) <= '1'; -- allow write back |
CTRL_O(ctrl_clr_la_c) <= '1'; -- set low byte of A to 0 |
CTRL_O(ctrl_clr_ha_c) <= '1'; -- set high byte of A to 0 |
CTRL_O(ctrl_cond_wb_c) <= '1'; -- is conditional write back |
else |
CTRL_O(ctrl_cmd_err_c) <= '1'; -- undefined instruction - cmd_err trap |
end if; |
ctrl_o(ctrl_cond_3_c downto ctrl_cond_0_c) <= instr_int(6 downto 3); -- branch condition |
ctrl_o(ctrl_alu_fs_2_c downto ctrl_alu_fs_0_c) <= alu_orr_c; -- logical or |
ctrl_o(ctrl_rd_wb_c) <= '1'; -- allow write back |
ctrl_o(ctrl_clr_la_c) <= '1'; -- set low byte of a to 0 |
ctrl_o(ctrl_clr_ha_c) <= '1'; -- set high byte of a to 0 |
ctrl_o(ctrl_cond_wb_c) <= '1'; -- is conditional write back |
else |
ctrl_o(ctrl_cmd_err_c) <= '1'; -- undefined instruction - cmd_err trap |
end if; |
|
|
when others => -- Class 3c3: System Call with 10-bit tag |
-- -------------------------------------------------------------------------------- |
CTRL_O(ctrl_syscall_c) <= '1'; -- is system call |
when others => -- class 3c3: system call with 10-bit tag |
-- -------------------------------------------------------------------------------- |
ctrl_o(ctrl_syscall_c) <= '1'; -- is system call |
|
end case; |
end case; |
|
end case; |
end case; |
|
|
when others => -- undefined |
-- ============================================================================== |
NULL; -- wayne... |
when others => -- undefined |
-- ============================================================================== |
null; -- wayne... |
|
|
end case; |
|
end process OPCODE_DECODER; |
end case; |
|
end process opcode_decoder; |
|
|
|
/atlas_core/trunk/rtl/INT_RAM.vhd
3,7 → 3,7
-- # **************************************************** # |
-- # Core-compatible example RAM component. # |
-- # **************************************************** # |
-- # Last modified: 16.05.2014 # |
-- # Last modified: 28.11.2014 # |
-- # **************************************************** # |
-- # by Stephan Nolting 4788, Hanover, Germany # |
-- ######################################################## |
15,86 → 15,83
library work; |
use work.atlas_core_package.all; |
|
entity INT_RAM is |
generic ( |
MEM_SIZE_G : natural := 256 -- memory size in bytes |
); |
port ( |
-- Host Interface -- |
CLK_I : in std_logic; -- global clock line |
I_ADR_I : in std_logic_vector(31 downto 0); -- instruction adr |
I_EN_I : in std_logic; -- IR update |
I_DAT_O : out std_logic_vector(15 downto 0); -- instruction out |
D_EN_I : in std_logic; -- access enable |
D_RW_I : in std_logic; -- read/write |
D_ADR_I : in std_logic_vector(31 downto 0); -- data adr |
D_DAT_I : in std_logic_vector(15 downto 0); -- data in |
D_DAT_O : out std_logic_vector(15 downto 0) -- data out |
); |
end INT_RAM; |
entity int_ram is |
generic ( |
mem_size_g : natural := 256 -- memory size in bytes |
); |
port ( |
-- host interface -- |
clk_i : in std_logic; -- global clock line |
i_adr_i : in std_logic_vector(31 downto 0); -- instruction adr |
i_dat_o : out std_logic_vector(15 downto 0); -- instruction out |
d_en_i : in std_logic; -- access enable |
d_rw_i : in std_logic; -- read/write |
d_adr_i : in std_logic_vector(31 downto 0); -- data adr |
d_dat_i : in std_logic_vector(15 downto 0); -- data in |
d_dat_o : out std_logic_vector(15 downto 0) -- data out |
); |
end int_ram; |
|
architecture INT_RAM_STRUCTURE of INT_RAM is |
architecture int_ram_structure of int_ram is |
|
-- Internal Constants -- |
constant log2_mem_size_c : natural := log2(MEM_SIZE_G/2); -- address width |
-- internal constants -- |
constant log2_mem_size_c : natural := log2(mem_size_g/2); -- address width |
|
-- Memory Type -- |
type int_mem_file_t is array (0 to (MEM_SIZE_G/2)-1) of std_logic_vector(data_width_c-1 downto 0); |
-- memory type -- |
type int_mem_file_t is array (0 to (mem_size_g/2)-1) of std_logic_vector(data_width_c-1 downto 0); |
|
-- ====================================================================== |
signal MEM_FILE : int_mem_file_t; -- use this for implementation |
-- signal MEM_FILE : int_mem_file_t := -- use this for simulation only |
signal mem_file : int_mem_file_t; -- use this for implementation |
-- signal mem_file : int_mem_file_t := -- use this for simulation |
-- ( |
-- others => x"0000" -- NOP |
-- others => x"0000" -- nop |
-- ); |
-- ====================================================================== |
|
-- RAM attribute to inhibit bypass-logic - ALTERA ONLY! -- |
attribute ramstyle : string; |
attribute ramstyle of MEM_FILE : signal is "no_rw_check"; |
-- ram attribute to inhibit bypass-logic - altera only! -- |
attribute ramstyle : string; |
attribute ramstyle of mem_file : signal is "no_rw_check"; |
|
begin |
|
-- Data Memory Access ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
MEM_FILE_D_ACCESS: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
-- Data Read/Write -- |
if (D_EN_I = '1') then -- valid access |
if (D_RW_I = '1') then -- write data access |
if (word_mode_en_c = true) then |
MEM_FILE(to_integer(unsigned(D_ADR_I(log2_mem_size_c-1 downto 0)))) <= D_DAT_I; |
else |
MEM_FILE(to_integer(unsigned(D_ADR_I(log2_mem_size_c downto 1)))) <= D_DAT_I; |
end if; |
end if; |
end if; |
if (word_mode_en_c = true) then |
D_DAT_O <= MEM_FILE(to_integer(unsigned(D_ADR_I(log2_mem_size_c-1 downto 0)))); |
else |
D_DAT_O <= MEM_FILE(to_integer(unsigned(D_ADR_I(log2_mem_size_c downto 1)))); |
end if; |
end if; |
end process MEM_FILE_D_ACCESS; |
-- Data Memory Access ---------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
mem_file_d_access: process(clk_i) |
begin |
if rising_edge(clk_i) then |
-- data read/write -- |
if (d_en_i = '1') then -- valid access |
if (d_rw_i = '1') then -- write data access |
if (word_mode_en_c = true) then |
mem_file(to_integer(unsigned(d_adr_i(log2_mem_size_c-1 downto 0)))) <= d_dat_i; |
else |
mem_file(to_integer(unsigned(d_adr_i(log2_mem_size_c downto 1)))) <= d_dat_i; |
end if; |
end if; |
end if; |
if (word_mode_en_c = true) then |
d_dat_o <= mem_file(to_integer(unsigned(d_adr_i(log2_mem_size_c-1 downto 0)))); |
else |
d_dat_o <= mem_file(to_integer(unsigned(d_adr_i(log2_mem_size_c downto 1)))); |
end if; |
end if; |
end process mem_file_d_access; |
|
|
-- Instruction Memory Access --------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
MEM_FILE_I_ACCESS: process(CLK_I) |
begin |
if rising_edge(CLK_I) then |
-- Instruction Read -- |
if (I_EN_I = '1') then |
if (word_mode_en_c = true) then |
I_DAT_O <= MEM_FILE(to_integer(unsigned(I_ADR_I(log2_mem_size_c-1 downto 0)))); |
else |
I_DAT_O <= MEM_FILE(to_integer(unsigned(I_ADR_I(log2_mem_size_c downto 1)))); |
end if; |
end if; |
end if; |
end process MEM_FILE_I_ACCESS; |
-- Instruction Memory Access --------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
mem_file_i_access: process(clk_i) |
begin |
if rising_edge(clk_i) then |
-- instruction read -- |
if (word_mode_en_c = true) then |
i_dat_o <= mem_file(to_integer(unsigned(i_adr_i(log2_mem_size_c-1 downto 0)))); |
else |
i_dat_o <= mem_file(to_integer(unsigned(i_adr_i(log2_mem_size_c downto 1)))); |
end if; |
end if; |
end process mem_file_i_access; |
|
|
|
end INT_RAM_STRUCTURE; |
end int_ram_structure; |
/atlas_core/trunk/sim/atlas_2k_base_tb.vhd
12,173 → 12,173
|
-- Component: Atlas-2K Processor ---------------------------------------------------------- |
-- ------------------------------------------------------------------------------------------- |
component ATLAS_2K_BASE_TOP |
port ( |
-- Globals -- |
CLK_I : in std_logic; -- global clock line |
RSTN_I : in std_logic; -- global reset line, low-active |
component atlas_2k_base_top |
port ( |
-- globals -- |
clk_i : in std_logic; -- global clock line |
rstn_i : in std_logic; -- global reset line, low-active |
|
-- UART -- |
UART_RXD_I : in std_logic; -- receiver input |
UART_TXD_O : out std_logic; -- UART transmitter output |
-- uart -- |
uart_rxd_i : in std_logic; -- receiver input |
uart_txd_o : out std_logic; -- uart transmitter output |
|
-- SPI -- |
SPI_MOSI_O : out std_logic_vector(07 downto 0); -- serial data out |
SPI_MISO_I : in std_logic_vector(07 downto 0); -- serial data in |
SPI_SCK_O : out std_logic_vector(07 downto 0); -- serial clock out |
SPI_CS_O : out std_logic_vector(07 downto 0); -- chip select (low active) |
-- spi -- |
spi_mosi_o : out std_logic_vector(07 downto 0); -- serial data out |
spi_miso_i : in std_logic_vector(07 downto 0); -- serial data in |
spi_sck_o : out std_logic_vector(07 downto 0); -- serial clock out |
spi_cs_o : out std_logic_vector(07 downto 0); -- chip select (low active) |
|
-- PIO -- |
PIO_OUT_O : out std_logic_vector(15 downto 0); -- parallel output |
PIO_IN_I : in std_logic_vector(15 downto 0); -- parallel input |
-- pio -- |
pio_out_o : out std_logic_vector(15 downto 0); -- parallel output |
pio_in_i : in std_logic_vector(15 downto 0); -- parallel input |
|
-- System IO -- |
SYS_OUT_O : out std_logic_vector(07 downto 0); -- system output |
SYS_IN_I : in std_logic_vector(07 downto 0); -- system input |
-- system io -- |
sys_out_o : out std_logic_vector(07 downto 0); -- system output |
sys_in_i : in std_logic_vector(07 downto 0); -- system input |
|
-- Wishbone Bus -- |
WB_CLK_O : out std_logic; -- bus clock |
WB_RST_O : out std_logic; -- bus reset, sync, high active |
WB_ADR_O : out std_logic_vector(31 downto 0); -- address |
WB_SEL_O : out std_logic_vector(01 downto 0); -- byte select |
WB_DATA_O : out std_logic_vector(15 downto 0); -- data out |
WB_DATA_I : in std_logic_vector(15 downto 0); -- data in |
WB_WE_O : out std_logic; -- read/write |
WB_CYC_O : out std_logic; -- cycle enable |
WB_STB_O : out std_logic; -- strobe |
WB_ACK_I : in std_logic; -- acknowledge |
WB_ERR_I : in std_logic -- bus error |
); |
-- wishbone bus -- |
wb_clk_o : out std_logic; -- bus clock |
wb_rst_o : out std_logic; -- bus reset, sync, high active |
wb_adr_o : out std_logic_vector(31 downto 0); -- address |
wb_sel_o : out std_logic_vector(01 downto 0); -- byte select |
wb_data_o : out std_logic_vector(15 downto 0); -- data out |
wb_data_i : in std_logic_vector(15 downto 0); -- data in |
wb_we_o : out std_logic; -- read/write |
wb_cyc_o : out std_logic; -- cycle enable |
wb_stb_o : out std_logic; -- strobe |
wb_ack_i : in std_logic; -- acknowledge |
wb_err_i : in std_logic -- bus error |
); |
end component; |
|
-- Global Signals -- |
signal CLK_GEN : std_logic := '0'; |
signal RSTN_GEN : std_logic := '0'; |
-- global signals -- |
signal clk_gen : std_logic := '0'; |
signal rstn_gen : std_logic := '0'; |
|
-- IO -- |
signal RXD, TXD : std_logic; -- UART |
signal PIO_OUT, PIO_IN : std_logic_vector(15 downto 0); -- PIO |
signal BOOT_C_IN : std_logic_vector(07 downto 0); -- Boot/sys condfig |
signal BOOT_C_OUT : std_logic_vector(07 downto 0); -- Boot/sys status |
signal SPI_MISO : std_logic_vector(07 downto 0); -- SPI master out slave in |
signal SPI_MOSI : std_logic_vector(07 downto 0); -- SPI master in slave out |
signal SPI_CSN : std_logic_vector(07 downto 0); -- SPI chip select (low-active) |
signal SPI_SCK : std_logic_vector(07 downto 0); -- SPI master clock out |
-- io -- |
signal rxd, txd : std_logic; -- uart |
signal pio_out, pio_in : std_logic_vector(15 downto 0); -- pio |
signal boot_c_in : std_logic_vector(07 downto 0); -- boot/sys condfig |
signal boot_c_out : std_logic_vector(07 downto 0); -- boot/sys status |
signal spi_miso : std_logic_vector(07 downto 0); -- spi master out slave in |
signal spi_mosi : std_logic_vector(07 downto 0); -- spi master in slave out |
signal spi_csn : std_logic_vector(07 downto 0); -- spi chip select (low-active) |
signal spi_sck : std_logic_vector(07 downto 0); -- spi master clock out |
|
-- Wishbone Bus -- |
signal WB_CLK, WB_RST : std_logic; |
signal WB_ADR : std_logic_vector(31 downto 0); -- address |
signal WB_SEL : std_logic_vector(01 downto 0); -- byte select |
signal WB_DATA_O : std_logic_vector(15 downto 0); -- data out |
signal WB_DATA_I : std_logic_vector(15 downto 0); -- data in |
signal WB_WE : std_logic; -- read/write |
signal WB_CYC : std_logic; -- cycle enable |
signal WB_STB : std_logic; -- strobe |
signal WB_ACK : std_logic; -- acknowledge |
signal WB_ERR : std_logic; -- bus error |
-- wishbone bus -- |
signal wb_clk, wb_rst : std_logic; |
signal wb_adr : std_logic_vector(31 downto 0); -- address |
signal wb_sel : std_logic_vector(01 downto 0); -- byte select |
signal wb_data_o : std_logic_vector(15 downto 0); -- data out |
signal wb_data_i : std_logic_vector(15 downto 0); -- data in |
signal wb_we : std_logic; -- read/write |
signal wb_cyc : std_logic; -- cycle enable |
signal wb_stb : std_logic; -- strobe |
signal wb_ack : std_logic; -- acknowledge |
signal wb_err : std_logic; -- bus error |
|
-- Wishbone Dummy Memory -- |
constant wm_mem_size_c : natural := 256; -- BYTE |
constant log2_mem_size_c : natural := log2(wm_mem_size_c/2); -- address width |
signal WB_ACK_BUF : std_logic; |
type mem_file_t is array (0 to (wm_mem_size_c/2)-1) of std_logic_vector(15 downto 0); |
signal MEM_FILE : mem_file_t := (others => (others => '0')); |
-- wishbone dummy memory -- |
constant wm_mem_size_c : natural := 256; -- byte |
constant log2_mem_size_c : natural := log2(wm_mem_size_c/2); -- address width |
signal wb_ack_buf : std_logic; |
type mem_file_t is array (0 to (wm_mem_size_c/2)-1) of std_logic_vector(15 downto 0); |
signal mem_file : mem_file_t := (others => (others => '0')); |
|
begin |
|
-- Stimulus -------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
STIMULUS: process |
begin |
-- all idle -- |
RXD <= '1'; -- idle |
SPI_MISO <= "00000000"; |
PIO_IN <= x"0000"; |
WB_ERR <= '0'; |
wait; |
end process STIMULUS; |
-- Stimulus -------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
stimulus: process |
begin |
-- all idle -- |
rxd <= '1'; -- idle |
spi_miso <= "00000000"; |
pio_in <= x"0000"; |
wb_err <= '0'; |
wait; |
end process stimulus; |
|
|
|
-- Clock/Reset Generator ------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
CLK_GEN <= not CLK_GEN after 10 ns; -- 50Mhz |
RSTN_GEN <= '0', '1' after 35 ns; |
-- Clock/Reset Generator ------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
clk_gen <= not clk_gen after 10 ns; -- 50mhz |
rstn_gen <= '0', '1' after 35 ns; |
|
|
|
-- Processor Core -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
DUT: ATLAS_2K_BASE_TOP |
port map ( |
-- Globals -- |
CLK_I => CLK_GEN, -- global clock line |
RSTN_I => RSTN_GEN, -- global reset line, low-active |
-- Processor Core -------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
dut: atlas_2k_base_top |
port map ( |
-- globals -- |
clk_i => clk_gen, -- global clock line |
rstn_i => rstn_gen, -- global reset line, low-active |
|
-- UART -- |
UART_RXD_I => RXD, -- receiver input |
UART_TXD_O => TXD, -- UART transmitter output |
-- uart -- |
uart_rxd_i => rxd, -- receiver input |
uart_txd_o => txd, -- uart transmitter output |
|
-- SPI -- |
SPI_MOSI_O => SPI_MOSI, -- serial data out |
SPI_MISO_I => SPI_MISO, -- serial data in |
SPI_SCK_O => SPI_SCK, -- serial clock out |
SPI_CS_O => SPI_CSN, -- chip select (low active) |
-- spi -- |
spi_mosi_o => spi_mosi, -- serial data out |
spi_miso_i => spi_miso, -- serial data in |
spi_sck_o => spi_sck, -- serial clock out |
spi_cs_o => spi_csn, -- chip select (low active) |
|
-- PIO -- |
PIO_OUT_O => PIO_OUT, -- parallel output |
PIO_IN_I => PIO_IN, -- parallel input |
-- pio -- |
pio_out_o => pio_out, -- parallel output |
pio_in_i => pio_in, -- parallel input |
|
-- System IO -- |
SYS_OUT_O => BOOT_C_OUT, -- system output |
SYS_IN_I => BOOT_C_IN, -- system input |
-- system io -- |
sys_out_o => boot_c_out, -- system output |
sys_in_i => boot_c_in, -- system input |
|
-- Wishbone Bus -- |
WB_CLK_O => WB_CLK, -- bus clock |
WB_RST_O => WB_RST, -- bus reset, sync, high active |
WB_ADR_O => WB_ADR, -- address |
WB_SEL_O => WB_SEL, -- byte select |
WB_DATA_O => WB_DATA_O, -- data out |
WB_DATA_I => WB_DATA_I, -- data in |
WB_WE_O => WB_WE, -- read/write |
WB_CYC_O => WB_CYC, -- cycle enable |
WB_STB_O => WB_STB, -- strobe |
WB_ACK_I => WB_ACK, -- acknowledge |
WB_ERR_I => WB_ERR -- bus error |
); |
-- wishbone bus -- |
wb_clk_o => wb_clk, -- bus clock |
wb_rst_o => wb_rst, -- bus reset, sync, high active |
wb_adr_o => wb_adr, -- address |
wb_sel_o => wb_sel, -- byte select |
wb_data_o => wb_data_o, -- data out |
wb_data_i => wb_data_i, -- data in |
wb_we_o => wb_we, -- read/write |
wb_cyc_o => wb_cyc, -- cycle enable |
wb_stb_o => wb_stb, -- strobe |
wb_ack_i => wb_ack, -- acknowledge |
wb_err_i => wb_err -- bus error |
); |
|
-- BOOT CONFIG -- |
BOOT_C_IN(7 downto 2) <= "000000"; -- unused |
BOOT_C_IN(1 downto 0) <= "11"; -- BOOT FROM INTERNAL MEMORY!!! |
-- boot config -- |
boot_c_in(7 downto 2) <= "000000"; -- unused |
boot_c_in(1 downto 0) <= "11"; -- boot from internal memory!!! |
|
|
|
-- WB Memory ------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
WB_MEM_FILE_ACCESS: process(WB_CLK) |
begin |
if rising_edge(WB_CLK) then |
-- WB Memory ------------------------------------------------------------------------------------------- |
-- -------------------------------------------------------------------------------------------------------- |
wb_mem_file_access: process(wb_clk) |
begin |
if rising_edge(wb_clk) then |
|
--- Data Read/Write --- |
if (WB_STB = '1') and (WB_CYC = '1') then |
if (WB_WE = '1') then |
MEM_FILE(to_integer(unsigned(WB_ADR(log2_mem_size_c downto 1)))) <= WB_DATA_O; |
end if; |
WB_DATA_I <= MEM_FILE(to_integer(unsigned(WB_ADR(log2_mem_size_c downto 1)))); |
end if; |
--- data read/write --- |
if (wb_stb = '1') and (wb_cyc = '1') then |
if (wb_we = '1') then |
mem_file(to_integer(unsigned(wb_adr(log2_mem_size_c downto 1)))) <= wb_data_o; |
end if; |
wb_data_i <= mem_file(to_integer(unsigned(wb_adr(log2_mem_size_c downto 1)))); |
end if; |
|
--- ACK Control --- |
if (WB_RST = '1') then |
WB_ACK_BUF <= '0'; |
else |
WB_ACK_BUF <= WB_CYC and WB_STB; |
end if; |
--- ack control --- |
if (wb_rst = '1') then |
wb_ack_buf <= '0'; |
else |
wb_ack_buf <= wb_cyc and wb_stb; |
end if; |
|
end if; |
end process WB_MEM_FILE_ACCESS; |
end if; |
end process wb_mem_file_access; |
|
--- ACK Signal --- |
WB_ACK <= WB_ACK_BUF and WB_CYC; |
--- ack signal --- |
wb_ack <= wb_ack_buf and wb_cyc; |
|
|
|
/atlas_core/trunk/sim/xilinx_isim_atlas_2k_base_tb_wave.wcfg
45,28 → 45,28
<obj_property name="UseCustomSignalColor">true</obj_property> |
<obj_property name="CustomSignalColor">#ff0000</obj_property> |
</wvobject> |
<wvobject fp_name="/atlas_2k_base_tb/DUT/the_core_of_the_problem/cpu_core/Control_Spine/instr_i" type="array" db_ref_id="1"> |
<obj_property name="ElementShortName">instr_i[15:0]</obj_property> |
<obj_property name="ObjectShortName">instr_i[15:0]</obj_property> |
<obj_property name="Radix">HEXRADIX</obj_property> |
<wvobject fp_name="/atlas_2k_base_tb/DUT/the_core_of_the_problem/cpu_core/Control_Spine/instr_reg_o" type="array" db_ref_id="1"> |
<obj_property name="ElementShortName">instr_reg_o[15:0]</obj_property> |
<obj_property name="ObjectShortName">instr_reg_o[15:0]</obj_property> |
<obj_property name="UseCustomSignalColor">true</obj_property> |
<obj_property name="CustomSignalColor">#ffff00</obj_property> |
<obj_property name="Radix">HEXRADIX</obj_property> |
</wvobject> |
<wvobject fp_name="/atlas_2k_base_tb/DUT/the_core_of_the_problem/cpu_core/Control_Spine/of_ctrl_bus_o" type="array" db_ref_id="1"> |
<obj_property name="ElementShortName">of_ctrl_bus_o[53:0]</obj_property> |
<obj_property name="ObjectShortName">of_ctrl_bus_o[53:0]</obj_property> |
<obj_property name="ElementShortName">of_ctrl_bus_o[55:0]</obj_property> |
<obj_property name="ObjectShortName">of_ctrl_bus_o[55:0]</obj_property> |
</wvobject> |
<wvobject fp_name="/atlas_2k_base_tb/DUT/the_core_of_the_problem/cpu_core/Control_Spine/ex_ctrl_bus_o" type="array" db_ref_id="1"> |
<obj_property name="ElementShortName">ex_ctrl_bus_o[53:0]</obj_property> |
<obj_property name="ObjectShortName">ex_ctrl_bus_o[53:0]</obj_property> |
<obj_property name="ElementShortName">ex_ctrl_bus_o[55:0]</obj_property> |
<obj_property name="ObjectShortName">ex_ctrl_bus_o[55:0]</obj_property> |
</wvobject> |
<wvobject fp_name="/atlas_2k_base_tb/DUT/the_core_of_the_problem/cpu_core/Control_Spine/ma_ctrl_bus_o" type="array" db_ref_id="1"> |
<obj_property name="ElementShortName">ma_ctrl_bus_o[53:0]</obj_property> |
<obj_property name="ObjectShortName">ma_ctrl_bus_o[53:0]</obj_property> |
<obj_property name="ElementShortName">ma_ctrl_bus_o[55:0]</obj_property> |
<obj_property name="ObjectShortName">ma_ctrl_bus_o[55:0]</obj_property> |
</wvobject> |
<wvobject fp_name="/atlas_2k_base_tb/DUT/the_core_of_the_problem/cpu_core/Control_Spine/wb_ctrl_bus_o" type="array" db_ref_id="1"> |
<obj_property name="ElementShortName">wb_ctrl_bus_o[53:0]</obj_property> |
<obj_property name="ObjectShortName">wb_ctrl_bus_o[53:0]</obj_property> |
<obj_property name="ElementShortName">wb_ctrl_bus_o[55:0]</obj_property> |
<obj_property name="ObjectShortName">wb_ctrl_bus_o[55:0]</obj_property> |
</wvobject> |
<wvobject fp_name="/atlas_2k_base_tb/DUT/the_core_of_the_problem/cpu_core/Control_Spine/of_ctrl_bus_o[0]" type="logic" db_ref_id="1"> |
<obj_property name="ElementShortName">[0]</obj_property> |
111,6 → 111,10
<obj_property name="ElementShortName">mem_dependecy</obj_property> |
<obj_property name="ObjectShortName">mem_dependecy</obj_property> |
</wvobject> |
<wvobject fp_name="/atlas_2k_base_tb/DUT/the_core_of_the_problem/cpu_core/Control_Spine/dis_if" type="logic" db_ref_id="1"> |
<obj_property name="ElementShortName">dis_if</obj_property> |
<obj_property name="ObjectShortName">dis_if</obj_property> |
</wvobject> |
<wvobject fp_name="/atlas_2k_base_tb/DUT/the_core_of_the_problem/cpu_core/Control_Spine/sleep_flag" type="logic" db_ref_id="1"> |
<obj_property name="ElementShortName">sleep_flag</obj_property> |
<obj_property name="ObjectShortName">sleep_flag</obj_property> |
157,11 → 161,6
<obj_property name="ObjectShortName">alu_res_o[15:0]</obj_property> |
<obj_property name="Radix">HEXRADIX</obj_property> |
</wvobject> |
<wvobject fp_name="/atlas_2k_base_tb/DUT/the_core_of_the_problem/cpu_core/Executor/mac_res_o" type="array" db_ref_id="1"> |
<obj_property name="ElementShortName">mac_res_o[15:0]</obj_property> |
<obj_property name="ObjectShortName">mac_res_o[15:0]</obj_property> |
<obj_property name="Radix">HEXRADIX</obj_property> |
</wvobject> |
<wvobject fp_name="/atlas_2k_base_tb/DUT/the_core_of_the_problem/cpu_core/Executor/msr_data_o" type="array" db_ref_id="1"> |
<obj_property name="ElementShortName">msr_data_o[15:0]</obj_property> |
<obj_property name="ObjectShortName">msr_data_o[15:0]</obj_property> |
/atlas_core/trunk/software/bootloader/init.vhd
0,0 → 1,1016
000000 => x"bc0e", -- B |
000001 => x"bc04", -- B |
000002 => x"bc03", -- B |
000003 => x"bc02", -- B |
000004 => x"bc01", -- B |
000005 => x"c000", -- LDIL |
000006 => x"cc00", -- LDIH |
000007 => x"ec8a", -- MCR |
000008 => x"cc19", -- LDIH |
000009 => x"ed0f", -- MCR |
000010 => x"c520", -- LDIL |
000011 => x"c907", -- LDIH |
000012 => x"be73", -- BL |
000013 => x"bc00", -- B |
000014 => x"ec11", -- MRC |
000015 => x"ec88", -- MCR |
000016 => x"ec8a", -- MCR |
000017 => x"c380", -- LDIL |
000018 => x"cff8", -- LDIH |
000019 => x"1c07", -- STSR |
000020 => x"2800", -- CLR |
000021 => x"ec08", -- MCR |
000022 => x"ec0b", -- MCR |
000023 => x"ec0d", -- MCR |
000024 => x"ec00", -- MRC |
000025 => x"ed88", -- MCR |
000026 => x"ed8b", -- MCR |
000027 => x"c064", -- LDIL |
000028 => x"ed8d", -- MCR |
000029 => x"c901", -- LDIH |
000030 => x"ed2f", -- MCR |
000031 => x"ec17", -- MRC |
000032 => x"ec97", -- MRC |
000033 => x"c160", -- LDIL |
000034 => x"c909", -- LDIH |
000035 => x"c18f", -- LDIL |
000036 => x"0923", -- ADD |
000037 => x"29b3", -- CLR |
000038 => x"2a44", -- CLR |
000039 => x"100a", -- SUBS |
000040 => x"149b", -- SBCS |
000041 => x"9003", -- BMI |
000042 => x"0241", -- INC |
000043 => x"bdfc", -- B |
000044 => x"ed49", -- MCR |
000045 => x"ec22", -- MRC |
000046 => x"d406", -- SBR |
000047 => x"ed0a", -- MCR |
000048 => x"c534", -- LDIL |
000049 => x"c905", -- LDIH |
000050 => x"be4d", -- BL |
000051 => x"c12a", -- LDIL |
000052 => x"c906", -- LDIH |
000053 => x"be4a", -- BL |
000054 => x"ee11", -- MRC |
000055 => x"be4c", -- BL |
000056 => x"c13a", -- LDIL |
000057 => x"c906", -- LDIH |
000058 => x"be45", -- BL |
000059 => x"ee97", -- MRC |
000060 => x"ee17", -- MRC |
000061 => x"be46", -- BL |
000062 => x"0250", -- MOV |
000063 => x"be44", -- BL |
000064 => x"be40", -- BL |
000065 => x"ec27", -- MRC |
000066 => x"c083", -- LDIL |
000067 => x"2001", -- AND |
000068 => x"c330", -- LDIL |
000069 => x"0b60", -- ADD |
000070 => x"bc0f", -- B |
000071 => x"c552", -- LDIL |
000072 => x"c906", -- LDIH |
000073 => x"be36", -- BL |
000074 => x"c144", -- LDIL |
000075 => x"c907", -- LDIH |
000076 => x"be33", -- BL |
000077 => x"c50a", -- LDIL |
000078 => x"c907", -- LDIH |
000079 => x"be30", -- BL |
000080 => x"be32", -- BL |
000081 => x"0300", -- MOV |
000082 => x"0080", -- MOV |
000083 => x"be2e", -- BL |
000084 => x"be2c", -- BL |
000085 => x"c0b0", -- LDIL |
000086 => x"181e", -- CMP |
000087 => x"81f0", -- BEQ |
000088 => x"c0b1", -- LDIL |
000089 => x"181e", -- CMP |
000090 => x"8085", -- BEQ |
000091 => x"c0b2", -- LDIL |
000092 => x"181e", -- CMP |
000093 => x"8052", -- BEQ |
000094 => x"c0b3", -- LDIL |
000095 => x"181e", -- CMP |
000096 => x"8019", -- BEQ |
000097 => x"c0b4", -- LDIL |
000098 => x"181e", -- CMP |
000099 => x"8021", -- BEQ |
000100 => x"c296", -- LDIL |
000101 => x"ca83", -- LDIH |
000102 => x"c0f0", -- LDIL |
000103 => x"181e", -- CMP |
000104 => x"f705", -- RBAEQ |
000105 => x"c0e4", -- LDIL |
000106 => x"181e", -- CMP |
000107 => x"80e1", -- BEQ |
000108 => x"c2c8", -- LDIL |
000109 => x"ca85", -- LDIH |
000110 => x"c0f7", -- LDIL |
000111 => x"181e", -- CMP |
000112 => x"f705", -- RBAEQ |
000113 => x"c0f2", -- LDIL |
000114 => x"181e", -- CMP |
000115 => x"85da", -- BNE |
000116 => x"2800", -- CLR |
000117 => x"c080", -- LDIL |
000118 => x"cc80", -- LDIH |
000119 => x"ec99", -- MCR |
000120 => x"3400", -- GT |
000121 => x"c14a", -- LDIL |
000122 => x"c906", -- LDIH |
000123 => x"be04", -- BL |
000124 => x"2800", -- CLR |
000125 => x"2100", -- STUB |
000126 => x"bca0", -- B |
000127 => x"bc95", -- B |
000128 => x"bc95", -- B |
000129 => x"bc95", -- B |
000130 => x"bc95", -- B |
000131 => x"bc98", -- B |
000132 => x"c528", -- LDIL |
000133 => x"c906", -- LDIH |
000134 => x"be8e", -- BL |
000135 => x"be96", -- BL |
000136 => x"edca", -- MCR |
000137 => x"be94", -- BL |
000138 => x"edc9", -- MCR |
000139 => x"c036", -- LDIL |
000140 => x"c805", -- LDIH |
000141 => x"3404", -- GTL |
000142 => x"be87", -- BL |
000143 => x"be8d", -- BL |
000144 => x"c47e", -- LDIL |
000145 => x"cc4a", -- LDIH |
000146 => x"180e", -- CMP |
000147 => x"8486", -- BNE |
000148 => x"be88", -- BL |
000149 => x"3f64", -- SFT |
000150 => x"2066", -- STUB |
000151 => x"be85", -- BL |
000152 => x"20e6", -- STUB |
000153 => x"be83", -- BL |
000154 => x"2166", -- STUB |
000155 => x"be81", -- BL |
000156 => x"21e6", -- STUB |
000157 => x"be7f", -- BL |
000158 => x"2266", -- STUB |
000159 => x"be7d", -- BL |
000160 => x"22e6", -- STUB |
000161 => x"be7b", -- BL |
000162 => x"2366", -- STUB |
000163 => x"c280", -- LDIL |
000164 => x"ecda", -- MCR |
000165 => x"ec5e", -- MCR |
000166 => x"be76", -- BL |
000167 => x"7f5a", -- STR |
000168 => x"ec06", -- MRC |
000169 => x"2806", -- EOR |
000170 => x"ec0e", -- MCR |
000171 => x"2400", -- LDUB |
000172 => x"1858", -- CMP |
000173 => x"85f9", -- BNE |
000174 => x"bc53", -- B |
000175 => x"c100", -- LDIL |
000176 => x"be28", -- BL |
000177 => x"c47e", -- LDIL |
000178 => x"cc4a", -- LDIH |
000179 => x"180d", -- CMP |
000180 => x"8465", -- BNE |
000181 => x"c102", -- LDIL |
000182 => x"be22", -- BL |
000183 => x"2055", -- STUB |
000184 => x"c104", -- LDIL |
000185 => x"be1f", -- BL |
000186 => x"20d5", -- STUB |
000187 => x"c106", -- LDIL |
000188 => x"be1c", -- BL |
000189 => x"2155", -- STUB |
000190 => x"c108", -- LDIL |
000191 => x"be19", -- BL |
000192 => x"21d5", -- STUB |
000193 => x"c10a", -- LDIL |
000194 => x"be16", -- BL |
000195 => x"2255", -- STUB |
000196 => x"c10c", -- LDIL |
000197 => x"be13", -- BL |
000198 => x"22d5", -- STUB |
000199 => x"c10e", -- LDIL |
000200 => x"be10", -- BL |
000201 => x"2355", -- STUB |
000202 => x"c200", -- LDIL |
000203 => x"ecca", -- MCR |
000204 => x"ec4e", -- MCR |
000205 => x"c010", -- LDIL |
000206 => x"0940", -- ADD |
000207 => x"be09", -- BL |
000208 => x"7eca", -- STR |
000209 => x"ec06", -- MRC |
000210 => x"2805", -- EOR |
000211 => x"ec0e", -- MCR |
000212 => x"2400", -- LDUB |
000213 => x"1848", -- CMP |
000214 => x"85f7", -- BNE |
000215 => x"bc2a", -- B |
000216 => x"0370", -- MOV |
000217 => x"be3f", -- BL |
000218 => x"3eb0", -- SFT |
000219 => x"0121", -- INC |
000220 => x"be3c", -- BL |
000221 => x"26d3", -- ORR |
000222 => x"3460", -- RET |
000223 => x"c162", -- LDIL |
000224 => x"c906", -- LDIH |
000225 => x"be33", -- BL |
000226 => x"be2c", -- BL |
000227 => x"c47e", -- LDIL |
000228 => x"cc4a", -- LDIH |
000229 => x"1818", -- CMP |
000230 => x"8433", -- BNE |
000231 => x"be27", -- BL |
000232 => x"3c94", -- SFT |
000233 => x"2011", -- STUB |
000234 => x"be24", -- BL |
000235 => x"2091", -- STUB |
000236 => x"be22", -- BL |
000237 => x"2111", -- STUB |
000238 => x"be20", -- BL |
000239 => x"2191", -- STUB |
000240 => x"be1e", -- BL |
000241 => x"2211", -- STUB |
000242 => x"be1c", -- BL |
000243 => x"2291", -- STUB |
000244 => x"be1a", -- BL |
000245 => x"2311", -- STUB |
000246 => x"2ad5", -- CLR |
000247 => x"ecda", -- MCR |
000248 => x"ec5e", -- MCR |
000249 => x"be15", -- BL |
000250 => x"7cda", -- STR |
000251 => x"ec06", -- MRC |
000252 => x"2801", -- EOR |
000253 => x"ec0e", -- MCR |
000254 => x"2400", -- LDUB |
000255 => x"1858", -- CMP |
000256 => x"85f9", -- BNE |
000257 => x"ec11", -- MRC |
000258 => x"ec8a", -- MCR |
000259 => x"c506", -- LDIL |
000260 => x"c906", -- LDIH |
000261 => x"be0f", -- BL |
000262 => x"ec06", -- MRC |
000263 => x"2491", -- LDUB |
000264 => x"1809", -- CMP |
000265 => x"8015", -- BEQ |
000266 => x"c52e", -- LDIL |
000267 => x"c907", -- LDIH |
000268 => x"be08", -- BL |
000269 => x"bccf", -- B |
000270 => x"0370", -- MOV |
000271 => x"be08", -- BL |
000272 => x"3c80", -- SFT |
000273 => x"be06", -- BL |
000274 => x"2490", -- ORR |
000275 => x"3460", -- RET |
000276 => x"bccb", -- B |
000277 => x"bcd3", -- B |
000278 => x"bcd7", -- B |
000279 => x"bcdb", -- B |
000280 => x"bc71", -- B |
000281 => x"bcc0", -- B |
000282 => x"bd33", -- B |
000283 => x"bc6f", -- B |
000284 => x"bcc2", -- B |
000285 => x"bcda", -- B |
000286 => x"c176", -- LDIL |
000287 => x"c906", -- LDIH |
000288 => x"bebf", -- BL |
000289 => x"24aa", -- LDUBS |
000290 => x"8010", -- BEQ |
000291 => x"c0a2", -- LDIL |
000292 => x"bec9", -- BL |
000293 => x"24a2", -- LDUB |
000294 => x"be20", -- BL |
000295 => x"24b3", -- LDUB |
000296 => x"be1e", -- BL |
000297 => x"24c4", -- LDUB |
000298 => x"be1c", -- BL |
000299 => x"24d5", -- LDUB |
000300 => x"be1a", -- BL |
000301 => x"24e6", -- LDUB |
000302 => x"be18", -- BL |
000303 => x"c0a2", -- LDIL |
000304 => x"bebd", -- BL |
000305 => x"beb7", -- BL |
000306 => x"c546", -- LDIL |
000307 => x"c906", -- LDIH |
000308 => x"beab", -- BL |
000309 => x"ee06", -- MRC |
000310 => x"bee6", -- BL |
000311 => x"beb1", -- BL |
000312 => x"beb0", -- BL |
000313 => x"beaf", -- BL |
000314 => x"beae", -- BL |
000315 => x"c080", -- LDIL |
000316 => x"ccc0", -- LDIH |
000317 => x"1c01", -- STSR |
000318 => x"2800", -- CLR |
000319 => x"ed0f", -- MCR |
000320 => x"ec88", -- MCR |
000321 => x"ec8b", -- MCR |
000322 => x"ec8c", -- MCR |
000323 => x"ec8a", -- MCR |
000324 => x"ec89", -- MCR |
000325 => x"3400", -- GT |
000326 => x"0370", -- MOV |
000327 => x"3c90", -- SFT |
000328 => x"bea5", -- BL |
000329 => x"3c90", -- SFT |
000330 => x"bea3", -- BL |
000331 => x"3460", -- RET |
000332 => x"c51a", -- LDIL |
000333 => x"c906", -- LDIH |
000334 => x"be91", -- BL |
000335 => x"bea8", -- BL |
000336 => x"c136", -- LDIL |
000337 => x"c905", -- LDIH |
000338 => x"3424", -- GTL |
000339 => x"ecca", -- MCR |
000340 => x"be94", -- BL |
000341 => x"c280", -- LDIL |
000342 => x"c00f", -- LDIL |
000343 => x"2058", -- ANDS |
000344 => x"840e", -- BNE |
000345 => x"be8f", -- BL |
000346 => x"c0a4", -- LDIL |
000347 => x"be92", -- BL |
000348 => x"ee12", -- MRC |
000349 => x"bebf", -- BL |
000350 => x"c0ae", -- LDIL |
000351 => x"be8e", -- BL |
000352 => x"0250", -- MOV |
000353 => x"bebb", -- BL |
000354 => x"c0ba", -- LDIL |
000355 => x"be8a", -- BL |
000356 => x"c0a0", -- LDIL |
000357 => x"be88", -- BL |
000358 => x"7a5a", -- LDR |
000359 => x"c0a0", -- LDIL |
000360 => x"be85", -- BL |
000361 => x"beb3", -- BL |
000362 => x"c00f", -- LDIL |
000363 => x"2058", -- ANDS |
000364 => x"8414", -- BNE |
000365 => x"c0a0", -- LDIL |
000366 => x"be7f", -- BL |
000367 => x"be7e", -- BL |
000368 => x"c010", -- LDIL |
000369 => x"1250", -- SUB |
000370 => x"c470", -- LDIL |
000371 => x"2240", -- AND |
000372 => x"c12e", -- LDIL |
000373 => x"78c9", -- LDR |
000374 => x"3c90", -- SFT |
000375 => x"c880", -- LDIH |
000376 => x"c020", -- LDIL |
000377 => x"1818", -- CMP |
000378 => x"f8c2", -- MVHI |
000379 => x"be72", -- BL |
000380 => x"c08f", -- LDIL |
000381 => x"2014", -- AND |
000382 => x"3409", -- TEQ |
000383 => x"85f6", -- BNE |
000384 => x"ec20", -- MRC |
000385 => x"dc0f", -- STB |
000386 => x"b804", -- BTS |
000387 => x"c5fe", -- LDIL |
000388 => x"343d", -- TEQ |
000389 => x"85d1", -- BNE |
000390 => x"be6c", -- BL |
000391 => x"2800", -- CLR |
000392 => x"3400", -- GT |
000393 => x"bc54", -- B |
000394 => x"bc92", -- B |
000395 => x"c001", -- LDIL |
000396 => x"ed0c", -- MCR |
000397 => x"c050", -- LDIL |
000398 => x"c83f", -- LDIH |
000399 => x"ed0a", -- MCR |
000400 => x"c000", -- LDIL |
000401 => x"c801", -- LDIH |
000402 => x"bea8", -- BL |
000403 => x"c154", -- LDIL |
000404 => x"c906", -- LDIH |
000405 => x"be4a", -- BL |
000406 => x"c162", -- LDIL |
000407 => x"c906", -- LDIH |
000408 => x"be47", -- BL |
000409 => x"be59", -- BL |
000410 => x"3c80", -- SFT |
000411 => x"be57", -- BL |
000412 => x"2410", -- ORR |
000413 => x"c4fe", -- LDIL |
000414 => x"ccca", -- LDIH |
000415 => x"1809", -- CMP |
000416 => x"8439", -- BNE |
000417 => x"c100", -- LDIL |
000418 => x"0290", -- MOV |
000419 => x"be2f", -- BL |
000420 => x"be4e", -- BL |
000421 => x"3c80", -- SFT |
000422 => x"be4c", -- BL |
000423 => x"2690", -- ORR |
000424 => x"3ed4", -- SFT |
000425 => x"2055", -- STUB |
000426 => x"c102", -- LDIL |
000427 => x"be27", -- BL |
000428 => x"be46", -- BL |
000429 => x"3c80", -- SFT |
000430 => x"be44", -- BL |
000431 => x"2690", -- ORR |
000432 => x"20d5", -- STUB |
000433 => x"c104", -- LDIL |
000434 => x"be20", -- BL |
000435 => x"c106", -- LDIL |
000436 => x"be3e", -- BL |
000437 => x"0180", -- MOV |
000438 => x"be8a", -- BL |
000439 => x"0121", -- INC |
000440 => x"c010", -- LDIL |
000441 => x"1828", -- CMP |
000442 => x"85fa", -- BNE |
000443 => x"2ad5", -- CLR |
000444 => x"be36", -- BL |
000445 => x"0180", -- MOV |
000446 => x"be82", -- BL |
000447 => x"0121", -- INC |
000448 => x"2400", -- LDUB |
000449 => x"02d1", -- INC |
000450 => x"1858", -- CMP |
000451 => x"85f9", -- BNE |
000452 => x"c001", -- LDIL |
000453 => x"ed0c", -- MCR |
000454 => x"c050", -- LDIL |
000455 => x"c83f", -- LDIH |
000456 => x"ed0a", -- MCR |
000457 => x"c00c", -- LDIL |
000458 => x"c801", -- LDIH |
000459 => x"be6f", -- BL |
000460 => x"c506", -- LDIL |
000461 => x"c906", -- LDIH |
000462 => x"be11", -- BL |
000463 => x"c68e", -- LDIL |
000464 => x"ca80", -- LDIH |
000465 => x"3450", -- GT |
000466 => x"0370", -- MOV |
000467 => x"3dd0", -- SFT |
000468 => x"be6c", -- BL |
000469 => x"0121", -- INC |
000470 => x"01d0", -- MOV |
000471 => x"be69", -- BL |
000472 => x"3460", -- RET |
000473 => x"c512", -- LDIL |
000474 => x"c907", -- LDIH |
000475 => x"be04", -- BL |
000476 => x"bcb9", -- B |
000477 => x"bc93", -- B |
000478 => x"bca4", -- B |
000479 => x"01f0", -- MOV |
000480 => x"78a9", -- LDR |
000481 => x"3c90", -- SFT |
000482 => x"c880", -- LDIH |
000483 => x"3419", -- TEQ |
000484 => x"8003", -- BEQ |
000485 => x"be08", -- BL |
000486 => x"bdfa", -- B |
000487 => x"3430", -- RET |
000488 => x"0170", -- MOV |
000489 => x"c08d", -- LDIL |
000490 => x"be03", -- BL |
000491 => x"c08a", -- LDIL |
000492 => x"03a0", -- MOV |
000493 => x"ec22", -- MRC |
000494 => x"dc05", -- STB |
000495 => x"b9fe", -- BTS |
000496 => x"ed18", -- MCR |
000497 => x"3470", -- RET |
000498 => x"ec20", -- MRC |
000499 => x"dc8f", -- STBI |
000500 => x"b9fe", -- BTS |
000501 => x"c800", -- LDIH |
000502 => x"3470", -- RET |
000503 => x"0170", -- MOV |
000504 => x"c200", -- LDIL |
000505 => x"c184", -- LDIL |
000506 => x"bff8", -- BL |
000507 => x"c0c7", -- LDIL |
000508 => x"1809", -- CMP |
000509 => x"9003", -- BMI |
000510 => x"c0a0", -- LDIL |
000511 => x"1001", -- SUB |
000512 => x"c0b0", -- LDIL |
000513 => x"1809", -- CMP |
000514 => x"91f8", -- BMI |
000515 => x"c0c6", -- LDIL |
000516 => x"1818", -- CMP |
000517 => x"91f5", -- BMI |
000518 => x"c0b9", -- LDIL |
000519 => x"1818", -- CMP |
000520 => x"a404", -- BLS |
000521 => x"c0c1", -- LDIL |
000522 => x"1809", -- CMP |
000523 => x"a1ef", -- BHI |
000524 => x"0080", -- MOV |
000525 => x"bfe0", -- BL |
000526 => x"c030", -- LDIL |
000527 => x"1090", -- SUB |
000528 => x"c009", -- LDIL |
000529 => x"1809", -- CMP |
000530 => x"a402", -- BLS |
000531 => x"0497", -- DEC |
000532 => x"3e42", -- SFT |
000533 => x"3e42", -- SFT |
000534 => x"3e42", -- SFT |
000535 => x"3e42", -- SFT |
000536 => x"2641", -- ORR |
000537 => x"05b9", -- DECS |
000538 => x"85e0", -- BNE |
000539 => x"3420", -- RET |
000540 => x"0370", -- MOV |
000541 => x"3d42", -- SFT |
000542 => x"3d22", -- SFT |
000543 => x"3d22", -- SFT |
000544 => x"3d22", -- SFT |
000545 => x"be0f", -- BL |
000546 => x"bfcb", -- BL |
000547 => x"3d40", -- SFT |
000548 => x"be0c", -- BL |
000549 => x"bfc8", -- BL |
000550 => x"3d45", -- SFT |
000551 => x"3d25", -- SFT |
000552 => x"3d25", -- SFT |
000553 => x"3d25", -- SFT |
000554 => x"be06", -- BL |
000555 => x"bfc2", -- BL |
000556 => x"0140", -- MOV |
000557 => x"be03", -- BL |
000558 => x"bfbf", -- BL |
000559 => x"3460", -- RET |
000560 => x"c08f", -- LDIL |
000561 => x"2121", -- AND |
000562 => x"c089", -- LDIL |
000563 => x"181a", -- CMP |
000564 => x"8803", -- BCS |
000565 => x"c0b0", -- LDIL |
000566 => x"bc02", -- B |
000567 => x"c0b7", -- LDIL |
000568 => x"0892", -- ADD |
000569 => x"3470", -- RET |
000570 => x"ed0b", -- MCR |
000571 => x"ec22", -- MRC |
000572 => x"dc03", -- STB |
000573 => x"b9fe", -- BTS |
000574 => x"ec23", -- MRC |
000575 => x"3470", -- RET |
000576 => x"00f0", -- MOV |
000577 => x"c050", -- LDIL |
000578 => x"c837", -- LDIH |
000579 => x"ed0a", -- MCR |
000580 => x"c001", -- LDIL |
000581 => x"ed0c", -- MCR |
000582 => x"c006", -- LDIL |
000583 => x"bff3", -- BL |
000584 => x"c050", -- LDIL |
000585 => x"c83f", -- LDIH |
000586 => x"ed0a", -- MCR |
000587 => x"c000", -- LDIL |
000588 => x"c805", -- LDIH |
000589 => x"bfed", -- BL |
000590 => x"dc01", -- STB |
000591 => x"b805", -- BTS |
000592 => x"c53e", -- LDIL |
000593 => x"c907", -- LDIH |
000594 => x"bf8d", -- BL |
000595 => x"bc42", -- B |
000596 => x"c040", -- LDIL |
000597 => x"c83f", -- LDIH |
000598 => x"ed0a", -- MCR |
000599 => x"c001", -- LDIL |
000600 => x"ed0c", -- MCR |
000601 => x"3c20", -- SFT |
000602 => x"c802", -- LDIH |
000603 => x"bfdf", -- BL |
000604 => x"03a0", -- MOV |
000605 => x"cb80", -- LDIH |
000606 => x"3ff0", -- SFT |
000607 => x"0030", -- MOV |
000608 => x"c800", -- LDIH |
000609 => x"2407", -- ORR |
000610 => x"bfd8", -- BL |
000611 => x"2800", -- CLR |
000612 => x"ed0c", -- MCR |
000613 => x"c050", -- LDIL |
000614 => x"c83f", -- LDIH |
000615 => x"ed0a", -- MCR |
000616 => x"c001", -- LDIL |
000617 => x"ed0c", -- MCR |
000618 => x"c000", -- LDIL |
000619 => x"c805", -- LDIH |
000620 => x"bfce", -- BL |
000621 => x"dc00", -- STB |
000622 => x"b9fc", -- BTS |
000623 => x"3410", -- RET |
000624 => x"00f0", -- MOV |
000625 => x"c040", -- LDIL |
000626 => x"c83f", -- LDIH |
000627 => x"ed0a", -- MCR |
000628 => x"c001", -- LDIL |
000629 => x"ed0c", -- MCR |
000630 => x"3c20", -- SFT |
000631 => x"c803", -- LDIH |
000632 => x"bfc2", -- BL |
000633 => x"0020", -- MOV |
000634 => x"c800", -- LDIH |
000635 => x"3c00", -- SFT |
000636 => x"bfbe", -- BL |
000637 => x"29b3", -- CLR |
000638 => x"ed3c", -- MCR |
000639 => x"0180", -- MOV |
000640 => x"c980", -- LDIH |
000641 => x"3410", -- RET |
000642 => x"e5b0", -- CDP |
000643 => x"ec30", -- MRC |
000644 => x"dc06", -- STB |
000645 => x"b9fe", -- BTS |
000646 => x"c306", -- LDIL |
000647 => x"200e", -- ANDS |
000648 => x"840a", -- BNE |
000649 => x"ecb1", -- MRC |
000650 => x"ef32", -- MRC |
000651 => x"2800", -- CLR |
000652 => x"009a", -- INCS |
000653 => x"0f60", -- ADC |
000654 => x"ed99", -- MCR |
000655 => x"edea", -- MCR |
000656 => x"ef34", -- MRC |
000657 => x"3470", -- RET |
000658 => x"c550", -- LDIL |
000659 => x"c907", -- LDIH |
000660 => x"bf4b", -- BL |
000661 => x"c55e", -- LDIL |
000662 => x"c907", -- LDIH |
000663 => x"bf48", -- BL |
000664 => x"bf5a", -- BL |
000665 => x"2800", -- CLR |
000666 => x"3400", -- GT |
000667 => x"0170", -- MOV |
000668 => x"bf56", -- BL |
000669 => x"c08d", -- LDIL |
000670 => x"1809", -- CMP |
000671 => x"f702", -- RBAEQ |
000672 => x"c088", -- LDIL |
000673 => x"1809", -- CMP |
000674 => x"8034", -- BEQ |
000675 => x"bdf9", -- B |
000676 => x"c528", -- LDIL |
000677 => x"c906", -- LDIH |
000678 => x"bf39", -- BL |
000679 => x"bf50", -- BL |
000680 => x"edca", -- MCR |
000681 => x"bf4e", -- BL |
000682 => x"edc9", -- MCR |
000683 => x"bff0", -- BL |
000684 => x"bf3c", -- BL |
000685 => x"c536", -- LDIL |
000686 => x"c906", -- LDIH |
000687 => x"bf30", -- BL |
000688 => x"bf47", -- BL |
000689 => x"02c0", -- MOV |
000690 => x"bfe9", -- BL |
000691 => x"bf35", -- BL |
000692 => x"345d", -- TEQ |
000693 => x"8021", -- BEQ |
000694 => x"06d1", -- DEC |
000695 => x"bf31", -- BL |
000696 => x"c0a4", -- LDIL |
000697 => x"bf34", -- BL |
000698 => x"ee32", -- MRC |
000699 => x"bf61", -- BL |
000700 => x"ee31", -- MRC |
000701 => x"bf5f", -- BL |
000702 => x"c0ba", -- LDIL |
000703 => x"bf2e", -- BL |
000704 => x"c0a0", -- LDIL |
000705 => x"bf2c", -- BL |
000706 => x"bfc0", -- BL |
000707 => x"0260", -- MOV |
000708 => x"bf58", -- BL |
000709 => x"c320", -- LDIL |
000710 => x"c1ae", -- LDIL |
000711 => x"00e0", -- MOV |
000712 => x"bf25", -- BL |
000713 => x"3cc0", -- SFT |
000714 => x"c880", -- LDIH |
000715 => x"181e", -- CMP |
000716 => x"f8c3", -- MVHI |
000717 => x"bf20", -- BL |
000718 => x"00c0", -- MOV |
000719 => x"c880", -- LDIH |
000720 => x"181e", -- CMP |
000721 => x"f8c3", -- MVHI |
000722 => x"bf1b", -- BL |
000723 => x"eca0", -- MRC |
000724 => x"dc9f", -- STBI |
000725 => x"b9df", -- BTS |
000726 => x"bf12", -- BL |
000727 => x"c69a", -- LDIL |
000728 => x"ca80", -- LDIH |
000729 => x"3450", -- GT |
000730 => x"0d0a", -- .DW |
000731 => x"0d0a", -- .DW |
000732 => x"4174", -- .DW |
000733 => x"6c61", -- .DW |
000734 => x"732d", -- .DW |
000735 => x"324b", -- .DW |
000736 => x"2042", -- .DW |
000737 => x"6f6f", -- .DW |
000738 => x"746c", -- .DW |
000739 => x"6f61", -- .DW |
000740 => x"6465", -- .DW |
000741 => x"7220", -- .DW |
000742 => x"2d20", -- .DW |
000743 => x"5632", -- .DW |
000744 => x"3031", -- .DW |
000745 => x"3430", -- .DW |
000746 => x"3531", -- .DW |
000747 => x"360d", -- .DW |
000748 => x"0a62", -- .DW |
000749 => x"7920", -- .DW |
000750 => x"5374", -- .DW |
000751 => x"6570", -- .DW |
000752 => x"6861", -- .DW |
000753 => x"6e20", -- .DW |
000754 => x"4e6f", -- .DW |
000755 => x"6c74", -- .DW |
000756 => x"696e", -- .DW |
000757 => x"672c", -- .DW |
000758 => x"2073", -- .DW |
000759 => x"746e", -- .DW |
000760 => x"6f6c", -- .DW |
000761 => x"7469", -- .DW |
000762 => x"6e67", -- .DW |
000763 => x"4067", -- .DW |
000764 => x"6d61", -- .DW |
000765 => x"696c", -- .DW |
000766 => x"2e63", -- .DW |
000767 => x"6f6d", -- .DW |
000768 => x"0d0a", -- .DW |
000769 => x"7777", -- .DW |
000770 => x"772e", -- .DW |
000771 => x"6f70", -- .DW |
000772 => x"656e", -- .DW |
000773 => x"636f", -- .DW |
000774 => x"7265", -- .DW |
000775 => x"732e", -- .DW |
000776 => x"6f72", -- .DW |
000777 => x"672f", -- .DW |
000778 => x"7072", -- .DW |
000779 => x"6f6a", -- .DW |
000780 => x"6563", -- .DW |
000781 => x"742c", -- .DW |
000782 => x"6174", -- .DW |
000783 => x"6c61", -- .DW |
000784 => x"735f", -- .DW |
000785 => x"636f", -- .DW |
000786 => x"7265", -- .DW |
000787 => x"0d0a", -- .DW |
000788 => x"0000", -- .DW |
000789 => x"0d0a", -- .DW |
000790 => x"426f", -- .DW |
000791 => x"6f74", -- .DW |
000792 => x"2070", -- .DW |
000793 => x"6167", -- .DW |
000794 => x"653a", -- .DW |
000795 => x"2030", -- .DW |
000796 => x"7800", -- .DW |
000797 => x"0d0a", -- .DW |
000798 => x"436c", -- .DW |
000799 => x"6f63", -- .DW |
000800 => x"6b28", -- .DW |
000801 => x"487a", -- .DW |
000802 => x"293a", -- .DW |
000803 => x"2030", -- .DW |
000804 => x"7800", -- .DW |
000805 => x"426f", -- .DW |
000806 => x"6f74", -- .DW |
000807 => x"696e", -- .DW |
000808 => x"670d", -- .DW |
000809 => x"0a00", -- .DW |
000810 => x"4275", -- .DW |
000811 => x"726e", -- .DW |
000812 => x"2045", -- .DW |
000813 => x"4550", -- .DW |
000814 => x"524f", -- .DW |
000815 => x"4d0d", -- .DW |
000816 => x"0a00", -- .DW |
000817 => x"4177", -- .DW |
000818 => x"6169", -- .DW |
000819 => x"7469", -- .DW |
000820 => x"6e67", -- .DW |
000821 => x"2069", -- .DW |
000822 => x"6d61", -- .DW |
000823 => x"6765", -- .DW |
000824 => x"2e2e", -- .DW |
000825 => x"2e0d", -- .DW |
000826 => x"0a00", -- .DW |
000827 => x"5374", -- .DW |
000828 => x"6172", -- .DW |
000829 => x"7469", -- .DW |
000830 => x"6e67", -- .DW |
000831 => x"2069", -- .DW |
000832 => x"6d61", -- .DW |
000833 => x"6765", -- .DW |
000834 => x"2000", -- .DW |
000835 => x"446f", -- .DW |
000836 => x"776e", -- .DW |
000837 => x"6c6f", -- .DW |
000838 => x"6164", -- .DW |
000839 => x"2063", -- .DW |
000840 => x"6f6d", -- .DW |
000841 => x"706c", -- .DW |
000842 => x"6574", -- .DW |
000843 => x"650d", -- .DW |
000844 => x"0a00", -- .DW |
000845 => x"5061", -- .DW |
000846 => x"6765", -- .DW |
000847 => x"2028", -- .DW |
000848 => x"3468", -- .DW |
000849 => x"293a", -- .DW |
000850 => x"2024", -- .DW |
000851 => x"0000", -- .DW |
000852 => x"4164", -- .DW |
000853 => x"6472", -- .DW |
000854 => x"2028", -- .DW |
000855 => x"3868", -- .DW |
000856 => x"293a", -- .DW |
000857 => x"2024", -- .DW |
000858 => x"0000", -- .DW |
000859 => x"2377", -- .DW |
000860 => x"6f72", -- .DW |
000861 => x"6473", -- .DW |
000862 => x"2028", -- .DW |
000863 => x"3468", -- .DW |
000864 => x"293a", -- .DW |
000865 => x"2024", -- .DW |
000866 => x"0000", -- .DW |
000867 => x"4368", -- .DW |
000868 => x"6563", -- .DW |
000869 => x"6b73", -- .DW |
000870 => x"756d", -- .DW |
000871 => x"3a20", -- .DW |
000872 => x"2400", -- .DW |
000873 => x"0d0a", -- .DW |
000874 => x"636d", -- .DW |
000875 => x"642f", -- .DW |
000876 => x"626f", -- .DW |
000877 => x"6f74", -- .DW |
000878 => x"2d73", -- .DW |
000879 => x"7769", -- .DW |
000880 => x"7463", -- .DW |
000881 => x"683a", -- .DW |
000882 => x"0d0a", -- .DW |
000883 => x"2030", -- .DW |
000884 => x"2f27", -- .DW |
000885 => x"3030", -- .DW |
000886 => x"273a", -- .DW |
000887 => x"2028", -- .DW |
000888 => x"5265", -- .DW |
000889 => x"2d29", -- .DW |
000890 => x"5374", -- .DW |
000891 => x"6172", -- .DW |
000892 => x"7420", -- .DW |
000893 => x"636f", -- .DW |
000894 => x"6e73", -- .DW |
000895 => x"6f6c", -- .DW |
000896 => x"650d", -- .DW |
000897 => x"0a20", -- .DW |
000898 => x"312f", -- .DW |
000899 => x"2730", -- .DW |
000900 => x"3127", -- .DW |
000901 => x"3a20", -- .DW |
000902 => x"426f", -- .DW |
000903 => x"6f74", -- .DW |
000904 => x"2055", -- .DW |
000905 => x"4152", -- .DW |
000906 => x"540d", -- .DW |
000907 => x"0a20", -- .DW |
000908 => x"322f", -- .DW |
000909 => x"2731", -- .DW |
000910 => x"3027", -- .DW |
000911 => x"3a20", -- .DW |
000912 => x"426f", -- .DW |
000913 => x"6f74", -- .DW |
000914 => x"2045", -- .DW |
000915 => x"4550", -- .DW |
000916 => x"524f", -- .DW |
000917 => x"4d0d", -- .DW |
000918 => x"0a20", -- .DW |
000919 => x"332f", -- .DW |
000920 => x"2731", -- .DW |
000921 => x"3127", -- .DW |
000922 => x"3a20", -- .DW |
000923 => x"426f", -- .DW |
000924 => x"6f74", -- .DW |
000925 => x"206d", -- .DW |
000926 => x"656d", -- .DW |
000927 => x"6f72", -- .DW |
000928 => x"790d", -- .DW |
000929 => x"0a00", -- .DW |
000930 => x"2034", -- .DW |
000931 => x"3a20", -- .DW |
000932 => x"426f", -- .DW |
000933 => x"6f74", -- .DW |
000934 => x"2057", -- .DW |
000935 => x"420d", -- .DW |
000936 => x"0a20", -- .DW |
000937 => x"703a", -- .DW |
000938 => x"2042", -- .DW |
000939 => x"7572", -- .DW |
000940 => x"6e20", -- .DW |
000941 => x"4545", -- .DW |
000942 => x"5052", -- .DW |
000943 => x"4f4d", -- .DW |
000944 => x"0d0a", -- .DW |
000945 => x"2064", -- .DW |
000946 => x"3a20", -- .DW |
000947 => x"5241", -- .DW |
000948 => x"4d20", -- .DW |
000949 => x"6475", -- .DW |
000950 => x"6d70", -- .DW |
000951 => x"0d0a", -- .DW |
000952 => x"2072", -- .DW |
000953 => x"3a20", -- .DW |
000954 => x"5265", -- .DW |
000955 => x"7365", -- .DW |
000956 => x"740d", -- .DW |
000957 => x"0a20", -- .DW |
000958 => x"773a", -- .DW |
000959 => x"2057", -- .DW |
000960 => x"4220", -- .DW |
000961 => x"6475", -- .DW |
000962 => x"6d70", -- .DW |
000963 => x"0d0a", -- .DW |
000964 => x"0000", -- .DW |
000965 => x"636d", -- .DW |
000966 => x"643a", -- .DW |
000967 => x"3e20", -- .DW |
000968 => x"0000", -- .DW |
000969 => x"494d", -- .DW |
000970 => x"4147", -- .DW |
000971 => x"4520", -- .DW |
000972 => x"4552", -- .DW |
000973 => x"5221", -- .DW |
000974 => x"0d0a", -- .DW |
000975 => x"0000", -- .DW |
000976 => x"0d0a", -- .DW |
000977 => x"4952", -- .DW |
000978 => x"5120", -- .DW |
000979 => x"4552", -- .DW |
000980 => x"5221", -- .DW |
000981 => x"0d0a", -- .DW |
000982 => x"0000", -- .DW |
000983 => x"4348", -- .DW |
000984 => x"4543", -- .DW |
000985 => x"4b53", -- .DW |
000986 => x"554d", -- .DW |
000987 => x"2045", -- .DW |
000988 => x"5252", -- .DW |
000989 => x"210d", -- .DW |
000990 => x"0a00", -- .DW |
000991 => x"5350", -- .DW |
000992 => x"492f", -- .DW |
000993 => x"4545", -- .DW |
000994 => x"5052", -- .DW |
000995 => x"4f4d", -- .DW |
000996 => x"2045", -- .DW |
000997 => x"5252", -- .DW |
000998 => x"210d", -- .DW |
000999 => x"0a00", -- .DW |
001000 => x"5742", -- .DW |
001001 => x"2042", -- .DW |
001002 => x"5553", -- .DW |
001003 => x"2045", -- .DW |
001004 => x"5252", -- .DW |
001005 => x"210d", -- .DW |
001006 => x"0a00", -- .DW |
001007 => x"5072", -- .DW |
001008 => x"6573", -- .DW |
001009 => x"7320", -- .DW |
001010 => x"616e", -- .DW |
001011 => x"7920", -- .DW |
001012 => x"6b65", -- .DW |
001013 => x"790d", -- .DW |
001014 => x"0a00", -- .DW |
others => x"0000" -- NOP |
/atlas_core/trunk/software/bootloader/boot_init.vhd
0,0 → 1,1024
000000 => x"cafe", |
000001 => x"03f7", |
000002 => x"929c", |
000003 => x"426f", |
000004 => x"6f74", |
000005 => x"6c6f", |
000006 => x"6164", |
000007 => x"6572", |
000008 => x"bc0e", |
000009 => x"bc04", |
000010 => x"bc03", |
000011 => x"bc02", |
000012 => x"bc01", |
000013 => x"c000", |
000014 => x"cc00", |
000015 => x"ec8a", |
000016 => x"cc19", |
000017 => x"ed0f", |
000018 => x"c520", |
000019 => x"c907", |
000020 => x"be73", |
000021 => x"bc00", |
000022 => x"ec11", |
000023 => x"ec88", |
000024 => x"ec8a", |
000025 => x"c380", |
000026 => x"cff8", |
000027 => x"1c07", |
000028 => x"2800", |
000029 => x"ec08", |
000030 => x"ec0b", |
000031 => x"ec0d", |
000032 => x"ec00", |
000033 => x"ed88", |
000034 => x"ed8b", |
000035 => x"c064", |
000036 => x"ed8d", |
000037 => x"c901", |
000038 => x"ed2f", |
000039 => x"ec17", |
000040 => x"ec97", |
000041 => x"c160", |
000042 => x"c909", |
000043 => x"c18f", |
000044 => x"0923", |
000045 => x"29b3", |
000046 => x"2a44", |
000047 => x"100a", |
000048 => x"149b", |
000049 => x"9003", |
000050 => x"0241", |
000051 => x"bdfc", |
000052 => x"ed49", |
000053 => x"ec22", |
000054 => x"d406", |
000055 => x"ed0a", |
000056 => x"c534", |
000057 => x"c905", |
000058 => x"be4d", |
000059 => x"c12a", |
000060 => x"c906", |
000061 => x"be4a", |
000062 => x"ee11", |
000063 => x"be4c", |
000064 => x"c13a", |
000065 => x"c906", |
000066 => x"be45", |
000067 => x"ee97", |
000068 => x"ee17", |
000069 => x"be46", |
000070 => x"0250", |
000071 => x"be44", |
000072 => x"be40", |
000073 => x"ec27", |
000074 => x"c083", |
000075 => x"2001", |
000076 => x"c330", |
000077 => x"0b60", |
000078 => x"bc0f", |
000079 => x"c552", |
000080 => x"c906", |
000081 => x"be36", |
000082 => x"c144", |
000083 => x"c907", |
000084 => x"be33", |
000085 => x"c50a", |
000086 => x"c907", |
000087 => x"be30", |
000088 => x"be32", |
000089 => x"0300", |
000090 => x"0080", |
000091 => x"be2e", |
000092 => x"be2c", |
000093 => x"c0b0", |
000094 => x"181e", |
000095 => x"81f0", |
000096 => x"c0b1", |
000097 => x"181e", |
000098 => x"8085", |
000099 => x"c0b2", |
000100 => x"181e", |
000101 => x"8052", |
000102 => x"c0b3", |
000103 => x"181e", |
000104 => x"8019", |
000105 => x"c0b4", |
000106 => x"181e", |
000107 => x"8021", |
000108 => x"c296", |
000109 => x"ca83", |
000110 => x"c0f0", |
000111 => x"181e", |
000112 => x"f705", |
000113 => x"c0e4", |
000114 => x"181e", |
000115 => x"80e1", |
000116 => x"c2c8", |
000117 => x"ca85", |
000118 => x"c0f7", |
000119 => x"181e", |
000120 => x"f705", |
000121 => x"c0f2", |
000122 => x"181e", |
000123 => x"85da", |
000124 => x"2800", |
000125 => x"c080", |
000126 => x"cc80", |
000127 => x"ec99", |
000128 => x"3400", |
000129 => x"c14a", |
000130 => x"c906", |
000131 => x"be04", |
000132 => x"2800", |
000133 => x"2100", |
000134 => x"bca0", |
000135 => x"bc95", |
000136 => x"bc95", |
000137 => x"bc95", |
000138 => x"bc95", |
000139 => x"bc98", |
000140 => x"c528", |
000141 => x"c906", |
000142 => x"be8e", |
000143 => x"be96", |
000144 => x"edca", |
000145 => x"be94", |
000146 => x"edc9", |
000147 => x"c036", |
000148 => x"c805", |
000149 => x"3404", |
000150 => x"be87", |
000151 => x"be8d", |
000152 => x"c47e", |
000153 => x"cc4a", |
000154 => x"180e", |
000155 => x"8486", |
000156 => x"be88", |
000157 => x"3f64", |
000158 => x"2066", |
000159 => x"be85", |
000160 => x"20e6", |
000161 => x"be83", |
000162 => x"2166", |
000163 => x"be81", |
000164 => x"21e6", |
000165 => x"be7f", |
000166 => x"2266", |
000167 => x"be7d", |
000168 => x"22e6", |
000169 => x"be7b", |
000170 => x"2366", |
000171 => x"c280", |
000172 => x"ecda", |
000173 => x"ec5e", |
000174 => x"be76", |
000175 => x"7f5a", |
000176 => x"ec06", |
000177 => x"2806", |
000178 => x"ec0e", |
000179 => x"2400", |
000180 => x"1858", |
000181 => x"85f9", |
000182 => x"bc53", |
000183 => x"c100", |
000184 => x"be28", |
000185 => x"c47e", |
000186 => x"cc4a", |
000187 => x"180d", |
000188 => x"8465", |
000189 => x"c102", |
000190 => x"be22", |
000191 => x"2055", |
000192 => x"c104", |
000193 => x"be1f", |
000194 => x"20d5", |
000195 => x"c106", |
000196 => x"be1c", |
000197 => x"2155", |
000198 => x"c108", |
000199 => x"be19", |
000200 => x"21d5", |
000201 => x"c10a", |
000202 => x"be16", |
000203 => x"2255", |
000204 => x"c10c", |
000205 => x"be13", |
000206 => x"22d5", |
000207 => x"c10e", |
000208 => x"be10", |
000209 => x"2355", |
000210 => x"c200", |
000211 => x"ecca", |
000212 => x"ec4e", |
000213 => x"c010", |
000214 => x"0940", |
000215 => x"be09", |
000216 => x"7eca", |
000217 => x"ec06", |
000218 => x"2805", |
000219 => x"ec0e", |
000220 => x"2400", |
000221 => x"1848", |
000222 => x"85f7", |
000223 => x"bc2a", |
000224 => x"0370", |
000225 => x"be3f", |
000226 => x"3eb0", |
000227 => x"0121", |
000228 => x"be3c", |
000229 => x"26d3", |
000230 => x"3460", |
000231 => x"c162", |
000232 => x"c906", |
000233 => x"be33", |
000234 => x"be2c", |
000235 => x"c47e", |
000236 => x"cc4a", |
000237 => x"1818", |
000238 => x"8433", |
000239 => x"be27", |
000240 => x"3c94", |
000241 => x"2011", |
000242 => x"be24", |
000243 => x"2091", |
000244 => x"be22", |
000245 => x"2111", |
000246 => x"be20", |
000247 => x"2191", |
000248 => x"be1e", |
000249 => x"2211", |
000250 => x"be1c", |
000251 => x"2291", |
000252 => x"be1a", |
000253 => x"2311", |
000254 => x"2ad5", |
000255 => x"ecda", |
000256 => x"ec5e", |
000257 => x"be15", |
000258 => x"7cda", |
000259 => x"ec06", |
000260 => x"2801", |
000261 => x"ec0e", |
000262 => x"2400", |
000263 => x"1858", |
000264 => x"85f9", |
000265 => x"ec11", |
000266 => x"ec8a", |
000267 => x"c506", |
000268 => x"c906", |
000269 => x"be0f", |
000270 => x"ec06", |
000271 => x"2491", |
000272 => x"1809", |
000273 => x"8015", |
000274 => x"c52e", |
000275 => x"c907", |
000276 => x"be08", |
000277 => x"bccf", |
000278 => x"0370", |
000279 => x"be08", |
000280 => x"3c80", |
000281 => x"be06", |
000282 => x"2490", |
000283 => x"3460", |
000284 => x"bccb", |
000285 => x"bcd3", |
000286 => x"bcd7", |
000287 => x"bcdb", |
000288 => x"bc71", |
000289 => x"bcc0", |
000290 => x"bd33", |
000291 => x"bc6f", |
000292 => x"bcc2", |
000293 => x"bcda", |
000294 => x"c176", |
000295 => x"c906", |
000296 => x"bebf", |
000297 => x"24aa", |
000298 => x"8010", |
000299 => x"c0a2", |
000300 => x"bec9", |
000301 => x"24a2", |
000302 => x"be20", |
000303 => x"24b3", |
000304 => x"be1e", |
000305 => x"24c4", |
000306 => x"be1c", |
000307 => x"24d5", |
000308 => x"be1a", |
000309 => x"24e6", |
000310 => x"be18", |
000311 => x"c0a2", |
000312 => x"bebd", |
000313 => x"beb7", |
000314 => x"c546", |
000315 => x"c906", |
000316 => x"beab", |
000317 => x"ee06", |
000318 => x"bee6", |
000319 => x"beb1", |
000320 => x"beb0", |
000321 => x"beaf", |
000322 => x"beae", |
000323 => x"c080", |
000324 => x"ccc0", |
000325 => x"1c01", |
000326 => x"2800", |
000327 => x"ed0f", |
000328 => x"ec88", |
000329 => x"ec8b", |
000330 => x"ec8c", |
000331 => x"ec8a", |
000332 => x"ec89", |
000333 => x"3400", |
000334 => x"0370", |
000335 => x"3c90", |
000336 => x"bea5", |
000337 => x"3c90", |
000338 => x"bea3", |
000339 => x"3460", |
000340 => x"c51a", |
000341 => x"c906", |
000342 => x"be91", |
000343 => x"bea8", |
000344 => x"c136", |
000345 => x"c905", |
000346 => x"3424", |
000347 => x"ecca", |
000348 => x"be94", |
000349 => x"c280", |
000350 => x"c00f", |
000351 => x"2058", |
000352 => x"840e", |
000353 => x"be8f", |
000354 => x"c0a4", |
000355 => x"be92", |
000356 => x"ee12", |
000357 => x"bebf", |
000358 => x"c0ae", |
000359 => x"be8e", |
000360 => x"0250", |
000361 => x"bebb", |
000362 => x"c0ba", |
000363 => x"be8a", |
000364 => x"c0a0", |
000365 => x"be88", |
000366 => x"7a5a", |
000367 => x"c0a0", |
000368 => x"be85", |
000369 => x"beb3", |
000370 => x"c00f", |
000371 => x"2058", |
000372 => x"8414", |
000373 => x"c0a0", |
000374 => x"be7f", |
000375 => x"be7e", |
000376 => x"c010", |
000377 => x"1250", |
000378 => x"c470", |
000379 => x"2240", |
000380 => x"c12e", |
000381 => x"78c9", |
000382 => x"3c90", |
000383 => x"c880", |
000384 => x"c020", |
000385 => x"1818", |
000386 => x"f8c2", |
000387 => x"be72", |
000388 => x"c08f", |
000389 => x"2014", |
000390 => x"3409", |
000391 => x"85f6", |
000392 => x"ec20", |
000393 => x"dc0f", |
000394 => x"b804", |
000395 => x"c5fe", |
000396 => x"343d", |
000397 => x"85d1", |
000398 => x"be6c", |
000399 => x"2800", |
000400 => x"3400", |
000401 => x"bc54", |
000402 => x"bc92", |
000403 => x"c001", |
000404 => x"ed0c", |
000405 => x"c050", |
000406 => x"c83f", |
000407 => x"ed0a", |
000408 => x"c000", |
000409 => x"c801", |
000410 => x"bea8", |
000411 => x"c154", |
000412 => x"c906", |
000413 => x"be4a", |
000414 => x"c162", |
000415 => x"c906", |
000416 => x"be47", |
000417 => x"be59", |
000418 => x"3c80", |
000419 => x"be57", |
000420 => x"2410", |
000421 => x"c4fe", |
000422 => x"ccca", |
000423 => x"1809", |
000424 => x"8439", |
000425 => x"c100", |
000426 => x"0290", |
000427 => x"be2f", |
000428 => x"be4e", |
000429 => x"3c80", |
000430 => x"be4c", |
000431 => x"2690", |
000432 => x"3ed4", |
000433 => x"2055", |
000434 => x"c102", |
000435 => x"be27", |
000436 => x"be46", |
000437 => x"3c80", |
000438 => x"be44", |
000439 => x"2690", |
000440 => x"20d5", |
000441 => x"c104", |
000442 => x"be20", |
000443 => x"c106", |
000444 => x"be3e", |
000445 => x"0180", |
000446 => x"be8a", |
000447 => x"0121", |
000448 => x"c010", |
000449 => x"1828", |
000450 => x"85fa", |
000451 => x"2ad5", |
000452 => x"be36", |
000453 => x"0180", |
000454 => x"be82", |
000455 => x"0121", |
000456 => x"2400", |
000457 => x"02d1", |
000458 => x"1858", |
000459 => x"85f9", |
000460 => x"c001", |
000461 => x"ed0c", |
000462 => x"c050", |
000463 => x"c83f", |
000464 => x"ed0a", |
000465 => x"c00c", |
000466 => x"c801", |
000467 => x"be6f", |
000468 => x"c506", |
000469 => x"c906", |
000470 => x"be11", |
000471 => x"c68e", |
000472 => x"ca80", |
000473 => x"3450", |
000474 => x"0370", |
000475 => x"3dd0", |
000476 => x"be6c", |
000477 => x"0121", |
000478 => x"01d0", |
000479 => x"be69", |
000480 => x"3460", |
000481 => x"c512", |
000482 => x"c907", |
000483 => x"be04", |
000484 => x"bcb9", |
000485 => x"bc93", |
000486 => x"bca4", |
000487 => x"01f0", |
000488 => x"78a9", |
000489 => x"3c90", |
000490 => x"c880", |
000491 => x"3419", |
000492 => x"8003", |
000493 => x"be08", |
000494 => x"bdfa", |
000495 => x"3430", |
000496 => x"0170", |
000497 => x"c08d", |
000498 => x"be03", |
000499 => x"c08a", |
000500 => x"03a0", |
000501 => x"ec22", |
000502 => x"dc05", |
000503 => x"b9fe", |
000504 => x"ed18", |
000505 => x"3470", |
000506 => x"ec20", |
000507 => x"dc8f", |
000508 => x"b9fe", |
000509 => x"c800", |
000510 => x"3470", |
000511 => x"0170", |
000512 => x"c200", |
000513 => x"c184", |
000514 => x"bff8", |
000515 => x"c0c7", |
000516 => x"1809", |
000517 => x"9003", |
000518 => x"c0a0", |
000519 => x"1001", |
000520 => x"c0b0", |
000521 => x"1809", |
000522 => x"91f8", |
000523 => x"c0c6", |
000524 => x"1818", |
000525 => x"91f5", |
000526 => x"c0b9", |
000527 => x"1818", |
000528 => x"a404", |
000529 => x"c0c1", |
000530 => x"1809", |
000531 => x"a1ef", |
000532 => x"0080", |
000533 => x"bfe0", |
000534 => x"c030", |
000535 => x"1090", |
000536 => x"c009", |
000537 => x"1809", |
000538 => x"a402", |
000539 => x"0497", |
000540 => x"3e42", |
000541 => x"3e42", |
000542 => x"3e42", |
000543 => x"3e42", |
000544 => x"2641", |
000545 => x"05b9", |
000546 => x"85e0", |
000547 => x"3420", |
000548 => x"0370", |
000549 => x"3d42", |
000550 => x"3d22", |
000551 => x"3d22", |
000552 => x"3d22", |
000553 => x"be0f", |
000554 => x"bfcb", |
000555 => x"3d40", |
000556 => x"be0c", |
000557 => x"bfc8", |
000558 => x"3d45", |
000559 => x"3d25", |
000560 => x"3d25", |
000561 => x"3d25", |
000562 => x"be06", |
000563 => x"bfc2", |
000564 => x"0140", |
000565 => x"be03", |
000566 => x"bfbf", |
000567 => x"3460", |
000568 => x"c08f", |
000569 => x"2121", |
000570 => x"c089", |
000571 => x"181a", |
000572 => x"8803", |
000573 => x"c0b0", |
000574 => x"bc02", |
000575 => x"c0b7", |
000576 => x"0892", |
000577 => x"3470", |
000578 => x"ed0b", |
000579 => x"ec22", |
000580 => x"dc03", |
000581 => x"b9fe", |
000582 => x"ec23", |
000583 => x"3470", |
000584 => x"00f0", |
000585 => x"c050", |
000586 => x"c837", |
000587 => x"ed0a", |
000588 => x"c001", |
000589 => x"ed0c", |
000590 => x"c006", |
000591 => x"bff3", |
000592 => x"c050", |
000593 => x"c83f", |
000594 => x"ed0a", |
000595 => x"c000", |
000596 => x"c805", |
000597 => x"bfed", |
000598 => x"dc01", |
000599 => x"b805", |
000600 => x"c53e", |
000601 => x"c907", |
000602 => x"bf8d", |
000603 => x"bc42", |
000604 => x"c040", |
000605 => x"c83f", |
000606 => x"ed0a", |
000607 => x"c001", |
000608 => x"ed0c", |
000609 => x"3c20", |
000610 => x"c802", |
000611 => x"bfdf", |
000612 => x"03a0", |
000613 => x"cb80", |
000614 => x"3ff0", |
000615 => x"0030", |
000616 => x"c800", |
000617 => x"2407", |
000618 => x"bfd8", |
000619 => x"2800", |
000620 => x"ed0c", |
000621 => x"c050", |
000622 => x"c83f", |
000623 => x"ed0a", |
000624 => x"c001", |
000625 => x"ed0c", |
000626 => x"c000", |
000627 => x"c805", |
000628 => x"bfce", |
000629 => x"dc00", |
000630 => x"b9fc", |
000631 => x"3410", |
000632 => x"00f0", |
000633 => x"c040", |
000634 => x"c83f", |
000635 => x"ed0a", |
000636 => x"c001", |
000637 => x"ed0c", |
000638 => x"3c20", |
000639 => x"c803", |
000640 => x"bfc2", |
000641 => x"0020", |
000642 => x"c800", |
000643 => x"3c00", |
000644 => x"bfbe", |
000645 => x"29b3", |
000646 => x"ed3c", |
000647 => x"0180", |
000648 => x"c980", |
000649 => x"3410", |
000650 => x"e5b0", |
000651 => x"ec30", |
000652 => x"dc06", |
000653 => x"b9fe", |
000654 => x"c306", |
000655 => x"200e", |
000656 => x"840a", |
000657 => x"ecb1", |
000658 => x"ef32", |
000659 => x"2800", |
000660 => x"009a", |
000661 => x"0f60", |
000662 => x"ed99", |
000663 => x"edea", |
000664 => x"ef34", |
000665 => x"3470", |
000666 => x"c550", |
000667 => x"c907", |
000668 => x"bf4b", |
000669 => x"c55e", |
000670 => x"c907", |
000671 => x"bf48", |
000672 => x"bf5a", |
000673 => x"2800", |
000674 => x"3400", |
000675 => x"0170", |
000676 => x"bf56", |
000677 => x"c08d", |
000678 => x"1809", |
000679 => x"f702", |
000680 => x"c088", |
000681 => x"1809", |
000682 => x"8034", |
000683 => x"bdf9", |
000684 => x"c528", |
000685 => x"c906", |
000686 => x"bf39", |
000687 => x"bf50", |
000688 => x"edca", |
000689 => x"bf4e", |
000690 => x"edc9", |
000691 => x"bff0", |
000692 => x"bf3c", |
000693 => x"c536", |
000694 => x"c906", |
000695 => x"bf30", |
000696 => x"bf47", |
000697 => x"02c0", |
000698 => x"bfe9", |
000699 => x"bf35", |
000700 => x"345d", |
000701 => x"8021", |
000702 => x"06d1", |
000703 => x"bf31", |
000704 => x"c0a4", |
000705 => x"bf34", |
000706 => x"ee32", |
000707 => x"bf61", |
000708 => x"ee31", |
000709 => x"bf5f", |
000710 => x"c0ba", |
000711 => x"bf2e", |
000712 => x"c0a0", |
000713 => x"bf2c", |
000714 => x"bfc0", |
000715 => x"0260", |
000716 => x"bf58", |
000717 => x"c320", |
000718 => x"c1ae", |
000719 => x"00e0", |
000720 => x"bf25", |
000721 => x"3cc0", |
000722 => x"c880", |
000723 => x"181e", |
000724 => x"f8c3", |
000725 => x"bf20", |
000726 => x"00c0", |
000727 => x"c880", |
000728 => x"181e", |
000729 => x"f8c3", |
000730 => x"bf1b", |
000731 => x"eca0", |
000732 => x"dc9f", |
000733 => x"b9df", |
000734 => x"bf12", |
000735 => x"c69a", |
000736 => x"ca80", |
000737 => x"3450", |
000738 => x"0d0a", |
000739 => x"0d0a", |
000740 => x"4174", |
000741 => x"6c61", |
000742 => x"732d", |
000743 => x"324b", |
000744 => x"2042", |
000745 => x"6f6f", |
000746 => x"746c", |
000747 => x"6f61", |
000748 => x"6465", |
000749 => x"7220", |
000750 => x"2d20", |
000751 => x"5632", |
000752 => x"3031", |
000753 => x"3430", |
000754 => x"3531", |
000755 => x"360d", |
000756 => x"0a62", |
000757 => x"7920", |
000758 => x"5374", |
000759 => x"6570", |
000760 => x"6861", |
000761 => x"6e20", |
000762 => x"4e6f", |
000763 => x"6c74", |
000764 => x"696e", |
000765 => x"672c", |
000766 => x"2073", |
000767 => x"746e", |
000768 => x"6f6c", |
000769 => x"7469", |
000770 => x"6e67", |
000771 => x"4067", |
000772 => x"6d61", |
000773 => x"696c", |
000774 => x"2e63", |
000775 => x"6f6d", |
000776 => x"0d0a", |
000777 => x"7777", |
000778 => x"772e", |
000779 => x"6f70", |
000780 => x"656e", |
000781 => x"636f", |
000782 => x"7265", |
000783 => x"732e", |
000784 => x"6f72", |
000785 => x"672f", |
000786 => x"7072", |
000787 => x"6f6a", |
000788 => x"6563", |
000789 => x"742c", |
000790 => x"6174", |
000791 => x"6c61", |
000792 => x"735f", |
000793 => x"636f", |
000794 => x"7265", |
000795 => x"0d0a", |
000796 => x"0000", |
000797 => x"0d0a", |
000798 => x"426f", |
000799 => x"6f74", |
000800 => x"2070", |
000801 => x"6167", |
000802 => x"653a", |
000803 => x"2030", |
000804 => x"7800", |
000805 => x"0d0a", |
000806 => x"436c", |
000807 => x"6f63", |
000808 => x"6b28", |
000809 => x"487a", |
000810 => x"293a", |
000811 => x"2030", |
000812 => x"7800", |
000813 => x"426f", |
000814 => x"6f74", |
000815 => x"696e", |
000816 => x"670d", |
000817 => x"0a00", |
000818 => x"4275", |
000819 => x"726e", |
000820 => x"2045", |
000821 => x"4550", |
000822 => x"524f", |
000823 => x"4d0d", |
000824 => x"0a00", |
000825 => x"4177", |
000826 => x"6169", |
000827 => x"7469", |
000828 => x"6e67", |
000829 => x"2069", |
000830 => x"6d61", |
000831 => x"6765", |
000832 => x"2e2e", |
000833 => x"2e0d", |
000834 => x"0a00", |
000835 => x"5374", |
000836 => x"6172", |
000837 => x"7469", |
000838 => x"6e67", |
000839 => x"2069", |
000840 => x"6d61", |
000841 => x"6765", |
000842 => x"2000", |
000843 => x"446f", |
000844 => x"776e", |
000845 => x"6c6f", |
000846 => x"6164", |
000847 => x"2063", |
000848 => x"6f6d", |
000849 => x"706c", |
000850 => x"6574", |
000851 => x"650d", |
000852 => x"0a00", |
000853 => x"5061", |
000854 => x"6765", |
000855 => x"2028", |
000856 => x"3468", |
000857 => x"293a", |
000858 => x"2024", |
000859 => x"0000", |
000860 => x"4164", |
000861 => x"6472", |
000862 => x"2028", |
000863 => x"3868", |
000864 => x"293a", |
000865 => x"2024", |
000866 => x"0000", |
000867 => x"2377", |
000868 => x"6f72", |
000869 => x"6473", |
000870 => x"2028", |
000871 => x"3468", |
000872 => x"293a", |
000873 => x"2024", |
000874 => x"0000", |
000875 => x"4368", |
000876 => x"6563", |
000877 => x"6b73", |
000878 => x"756d", |
000879 => x"3a20", |
000880 => x"2400", |
000881 => x"0d0a", |
000882 => x"636d", |
000883 => x"642f", |
000884 => x"626f", |
000885 => x"6f74", |
000886 => x"2d73", |
000887 => x"7769", |
000888 => x"7463", |
000889 => x"683a", |
000890 => x"0d0a", |
000891 => x"2030", |
000892 => x"2f27", |
000893 => x"3030", |
000894 => x"273a", |
000895 => x"2028", |
000896 => x"5265", |
000897 => x"2d29", |
000898 => x"5374", |
000899 => x"6172", |
000900 => x"7420", |
000901 => x"636f", |
000902 => x"6e73", |
000903 => x"6f6c", |
000904 => x"650d", |
000905 => x"0a20", |
000906 => x"312f", |
000907 => x"2730", |
000908 => x"3127", |
000909 => x"3a20", |
000910 => x"426f", |
000911 => x"6f74", |
000912 => x"2055", |
000913 => x"4152", |
000914 => x"540d", |
000915 => x"0a20", |
000916 => x"322f", |
000917 => x"2731", |
000918 => x"3027", |
000919 => x"3a20", |
000920 => x"426f", |
000921 => x"6f74", |
000922 => x"2045", |
000923 => x"4550", |
000924 => x"524f", |
000925 => x"4d0d", |
000926 => x"0a20", |
000927 => x"332f", |
000928 => x"2731", |
000929 => x"3127", |
000930 => x"3a20", |
000931 => x"426f", |
000932 => x"6f74", |
000933 => x"206d", |
000934 => x"656d", |
000935 => x"6f72", |
000936 => x"790d", |
000937 => x"0a00", |
000938 => x"2034", |
000939 => x"3a20", |
000940 => x"426f", |
000941 => x"6f74", |
000942 => x"2057", |
000943 => x"420d", |
000944 => x"0a20", |
000945 => x"703a", |
000946 => x"2042", |
000947 => x"7572", |
000948 => x"6e20", |
000949 => x"4545", |
000950 => x"5052", |
000951 => x"4f4d", |
000952 => x"0d0a", |
000953 => x"2064", |
000954 => x"3a20", |
000955 => x"5241", |
000956 => x"4d20", |
000957 => x"6475", |
000958 => x"6d70", |
000959 => x"0d0a", |
000960 => x"2072", |
000961 => x"3a20", |
000962 => x"5265", |
000963 => x"7365", |
000964 => x"740d", |
000965 => x"0a20", |
000966 => x"773a", |
000967 => x"2057", |
000968 => x"4220", |
000969 => x"6475", |
000970 => x"6d70", |
000971 => x"0d0a", |
000972 => x"0000", |
000973 => x"636d", |
000974 => x"643a", |
000975 => x"3e20", |
000976 => x"0000", |
000977 => x"494d", |
000978 => x"4147", |
000979 => x"4520", |
000980 => x"4552", |
000981 => x"5221", |
000982 => x"0d0a", |
000983 => x"0000", |
000984 => x"0d0a", |
000985 => x"4952", |
000986 => x"5120", |
000987 => x"4552", |
000988 => x"5221", |
000989 => x"0d0a", |
000990 => x"0000", |
000991 => x"4348", |
000992 => x"4543", |
000993 => x"4b53", |
000994 => x"554d", |
000995 => x"2045", |
000996 => x"5252", |
000997 => x"210d", |
000998 => x"0a00", |
000999 => x"5350", |
001000 => x"492f", |
001001 => x"4545", |
001002 => x"5052", |
001003 => x"4f4d", |
001004 => x"2045", |
001005 => x"5252", |
001006 => x"210d", |
001007 => x"0a00", |
001008 => x"5742", |
001009 => x"2042", |
001010 => x"5553", |
001011 => x"2045", |
001012 => x"5252", |
001013 => x"210d", |
001014 => x"0a00", |
001015 => x"5072", |
001016 => x"6573", |
001017 => x"7320", |
001018 => x"616e", |
001019 => x"7920", |
001020 => x"6b65", |
001021 => x"790d", |
001022 => x"0a00", |
others => x"0000" |
/atlas_core/trunk/software/bootloader/atlas2k_bootloader.asm
867,9 → 867,9
|
uart_print_loop: |
ldr r1, r2, +#1, post, ! ; get one string byte |
sft r1, r1, #swp ; swap high and low byte |
sft r1, r1, #swp ; swap high and low byte |
ldih r1, #0x00 ; clear high byte |
teq r1, r1 ; test if string end |
teq r1, r1 ; test if string end |
beq uart_print_loop_end |
bl uart_sendbyte |
b uart_print_loop |
/atlas_core/trunk/software/bootloader/out.bin
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
atlas_core/trunk/software/bootloader/out.bin
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: atlas_core/trunk/software/examples/fft/pre_processor.asm
===================================================================
--- atlas_core/trunk/software/examples/fft/pre_processor.asm (nonexistent)
+++ atlas_core/trunk/software/examples/fft/pre_processor.asm (revision 35)
@@ -0,0 +1,979 @@
+RESET_VEC: B RESET
+X_INT0_VEC: B ERR_HANDLER
+X_INT1_VEC: B ERR_HANDLER
+CMD_ERR_VEC: B ERR_HANDLER
+SWI_VEC: B ERR_HANDLER
+ERR_HANDLER: BL UART_LINEBREAK
+LDIL R2 LOW[ERR_STRING]
+LDIH R2 HIGH[ERR_STRING]
+BL UART_PRINT
+BL UART_LINEBREAK
+B #+0
+RESET: LDIL SP LOW[STACK_END]
+LDIH SP HIGH[STACK_END]
+LDIL R2 LOW[STRING_INTRO]
+LDIH R2 HIGH[STRING_INTRO]
+BL UART_PRINT
+LDIL R0 #0XFF
+MCR #1 SYS0_CORE R0 #3
+LDIL R0 #2
+MCR #1 SYS0_CORE R0 #4
+LDIL R0 LOW[FFT_N_C]
+LDIH R0 HIGH[FFT_N_C]
+LDIL R7 LOW[MATH_LOG2]
+LDIH R7 HIGH[MATH_LOG2]
+GTL R7
+PUSH R0
+LDIL R5 LOW[INPUT_SIGNAL]
+LDIH R5 HIGH[INPUT_SIGNAL]
+LDIL R2 LOW[FFT_RAM]
+LDIH R2 HIGH[FFT_RAM]
+CLR R3 #0
+FFT_STORE_LOOP: LDR R0 R5 +#2 POST !
+LDIL R1 #0X00
+PEEK R4
+LDIL R7 LOW[STORE_FFT_SAMPLE]
+LDIH R7 HIGH[STORE_FFT_SAMPLE]
+GTL R7
+INC R3 R3 #1
+LDIL R0 LOW[FFT_N_C]
+LDIH R0 HIGH[FFT_N_C]
+CMP R3 R0
+BNE FFT_STORE_LOOP
+POP R0
+CLR R5
+MCR #1 SYS0_CORE R5 #2
+LDIL R0 LOW[FFT_RAM]
+LDIH R0 HIGH[FFT_RAM]
+LDIL R1 LOW[FFT_N_C]
+LDIH R1 HIGH[FFT_N_C]
+LDIL R2 LOW[FFT_SINCOS_LUT]
+LDIH R2 HIGH[FFT_SINCOS_LUT]
+BL MATH_FFT
+MRC #1 R4 SYS0_CORE #2
+BL PRINT_HEX_STRING
+BL UART_LINEBREAK
+LDIL R5 LOW[FFT_RAM]
+LDIH R5 HIGH[FFT_RAM]
+LDIL R3 LOW[FFT_N_C]
+LDIH R3 HIGH[FFT_N_C]
+PRINT_RESULTS: LDR R4 R5 +#2 POST !
+BL PRINT_HEX_STRING
+LDIL R1 #32
+BL UART_SENDBYTE
+LDR R4 R5 +#2 POST !
+BL PRINT_HEX_STRING
+BL UART_LINEBREAK
+DECS R3 R3 #1
+BNE PRINT_RESULTS
+B #+0
+UART_SENDBYTE: MRC #1 R0 COM0_CORE #2
+STB R0 #5
+BTS UART_SENDBYTE
+MCR #1 COM0_CORE R1 #0
+RET LR
+UART_RECEIVEBYTE: MRC #1 R0 COM0_CORE #0
+STBI R0 #15
+BTS UART_RECEIVEBYTE
+LDIH R0 #0X00
+RET LR
+PRINT_HEX_STRING: PUSH R0
+PUSH R1
+PUSH R2
+PUSH R3
+PUSH R4
+PUSH LR
+SFT R2 R4 #ROL
+SFT R2 R2 #ROL
+SFT R2 R2 #ROL
+SFT R2 R2 #ROL
+BL CONV_HEX_COMP
+BL UART_SENDBYTE
+SFT R2 R4 #SWP
+BL CONV_HEX_COMP
+BL UART_SENDBYTE
+SFT R2 R4 #LSR
+SFT R2 R2 #LSR
+SFT R2 R2 #LSR
+SFT R2 R2 #LSR
+BL CONV_HEX_COMP
+BL UART_SENDBYTE
+MOV R2 R4
+BL CONV_HEX_COMP
+BL UART_SENDBYTE
+POP LR
+POP R4
+POP R3
+POP R2
+POP R1
+POP R0
+RET LR
+CONV_HEX_COMP: LDIL R1 #0X0F
+AND R2 R2 R1
+LDIL R1 #9
+CMP R1 R2
+BCS #+3
+LDIL R1 #48
+B #+2
+LDIL R1 #55
+ADD R1 R1 R2
+RET LR
+UART_LINEBREAK: PUSH R0
+PUSH R1
+PUSH R2
+PUSH LR
+MOV R2 LR
+LDIL R1 #0X0D
+BL UART_SENDBYTE
+LDIL R1 #0X0A
+MOV LR R2
+BL UART_SENDBYTE
+POP LR
+POP R2
+POP R1
+POP R0
+RET LR
+UART_PRINT: MOV R4 LR
+UART_PRINT_LOOP: LDR R0 R2 +#1 POST !
+LDIL R1 #0X00
+LDIH R1 #0XFF
+AND R1 R0 R1
+SFTS R1 R1 #SWP
+BEQ UART_PRINT_LOOP_END
+BL UART_SENDBYTE
+B UART_PRINT_LOOP
+UART_PRINT_LOOP_END: RET R4
+MATH_FFT: PUSH R5
+PUSH R4
+PUSH R3
+PUSH R2
+PUSH R1
+PUSH R0
+PUSH LR
+LDIL R7 LOW[V_MATH_FFT_NUM_LEVELS]
+LDIH R7 HIGH[V_MATH_FFT_NUM_LEVELS]
+STR R0 R7 -#6 PRE
+STR R1 R7 -#2 PRE
+STR R2 R7 -#4 PRE
+CLR R0
+MATH_FFT_GET_LVS: SFT R1 R1 #LSR
+TEQ R1 R1
+BEQ #+3
+INC R0 R0 #1
+B MATH_FFT_GET_LVS
+LDIL R7 LOW[V_MATH_FFT_NUM_LEVELS]
+LDIH R7 HIGH[V_MATH_FFT_NUM_LEVELS]
+STR R0 R7 +#0 PRE
+LDIL R7 LOW[V_MATH_FFT_NUM_LEVELS]
+LDIH R7 HIGH[V_MATH_FFT_NUM_LEVELS]
+LDIL R5 #1
+STR R5 R7 +#2 PRE
+STR R5 R7 +#4 PRE
+STR R5 R7 +#6 PRE
+LDIL R7 LOW[V_MATH_FFT_A_OFFS]
+LDIH R7 HIGH[V_MATH_FFT_A_OFFS]
+LDIL R5 #0
+STR R5 R7 +#0 PRE
+MATH_FFT_LEVEL: LDIL R7 LOW[V_MATH_FFT_DFT]
+LDIH R7 HIGH[V_MATH_FFT_DFT]
+LDR R1 R7 -#2 PRE
+LDR R2 R7 +#0 PRE
+DEC R2 R2 #1
+LDIL R4 #4
+SFT R4 R4 #LSL
+DECS R1 R1 #1
+BNE #-2
+MUL R2 R2 R4
+STR R2 R7 +#4 PRE
+MATH_FFT_BUTTERFLY: LDIL R7 LOW[V_MATH_FFT_NUM_LEVELS]
+LDIH R7 HIGH[V_MATH_FFT_NUM_LEVELS]
+LDR R4 R7 -#6 PRE
+LDR R1 R7 +#2 PRE
+LDR R2 R7 +#6 PRE
+LDR R3 R7 -#4 PRE
+DEC R2 R2 #1
+SFT R2 R2 #LSL
+SFT R2 R2 #LSL
+ADD R2 R3 R2
+LDIL R7 LOW[V_MATH_FFT_A_OFFS]
+LDIH R7 HIGH[V_MATH_FFT_A_OFFS]
+LDR R0 R7 +#0 PRE
+ADD R0 R0 R4
+LDIL R3 #2
+SFT R3 R3 #LSL
+DECS R1 R1 #1
+BNE #-2
+ADD R1 R0 R3
+LDIL R7 LOW[V_MATH_FFT_A_PNT]
+LDIH R7 HIGH[V_MATH_FFT_A_PNT]
+STR R0 R7 +#0 PRE
+STR R1 R7 +#2 PRE
+STR R2 R7 +#4 PRE
+MOV R3 R0
+MOV R4 R1
+MOV R5 R2
+PUSH R3
+PUSH R4
+LDR R0 R3 +#0 PRE
+LDR R1 R3 +#2 PRE
+LDR R2 R4 +#0 PRE
+LDR R3 R4 +#2 PRE
+LDR R4 R5 +#0 PRE
+LDR R5 R5 +#2 PRE
+BL FFT_BUTTERFLY
+POP R5
+POP R4
+STR R2 R5 +#0 PRE
+STR R3 R5 +#2 PRE
+STR R0 R4 +#0 PRE
+STR R1 R4 +#2 PRE
+LDIL R7 LOW[V_MATH_FFT_A_OFFS]
+LDIH R7 HIGH[V_MATH_FFT_A_OFFS]
+LDR R0 R7 +#0 PRE
+LDIL R1 #4
+ADD R0 R0 R1
+STR R0 R7 +#0 PRE
+LDIL R7 LOW[V_MATH_FFT_NUM_LEVELS]
+LDIH R7 HIGH[V_MATH_FFT_NUM_LEVELS]
+LDR R0 R7 +#2 PRE
+LDR R2 R7 +#6 PRE
+LDIL R1 #1
+DECS R0 R0 #1
+BEQ #+3
+SFT R1 R1 #LSL
+B #-3
+CMP R1 R2
+INC R2 R2 #1
+STR R2 R7 +#6 PRE
+BNE MATH_FFT_BUTTERFLY
+LDIL R2 #1
+STR R2 R7 +#6 PRE
+LDIL R7 LOW[V_MATH_FFT_NUM_LEVELS]
+LDIH R7 HIGH[V_MATH_FFT_NUM_LEVELS]
+LDR R0 R7 -#2 PRE
+LDR R1 R7 +#2 PRE
+LDR R2 R7 +#4 PRE
+SFT R0 R0 #LSR
+DECS R1 R1 #1
+BNE #-2
+CMP R0 R2
+INC R2 R2 #1
+STR R2 R7 +#4 PRE
+BNE MATH_FFT_LEVEL
+LDIL R2 #1
+STR R2 R7 +#4 PRE
+LDIL R7 LOW[V_MATH_FFT_NUM_LEVELS]
+LDIH R7 HIGH[V_MATH_FFT_NUM_LEVELS]
+LDR R0 R7 +#0 PRE
+LDR R1 R7 +#2 PRE
+CMP R0 R1
+INC R1 R1 #1
+STR R1 R7 +#2 PRE
+BNE MATH_FFT_LEVEL
+POP LR
+POP R0
+POP R1
+POP R2
+POP R3
+POP R4
+POP R5
+RET LR
+V_MATH_FFT_SIG_PNT: NOP
+V_MATH_SINCOS_PNT: NOP
+V_MATH_FFT_NUM_POINTS: NOP
+V_MATH_FFT_NUM_LEVELS: NOP
+V_MATH_FFT_LEVEL: NOP
+V_MATH_FFT_DFT: NOP
+V_MATH_FFT_BTFLY: NOP
+V_MATH_FFT_A_OFFS: NOP
+V_MATH_FFT_A_PNT: NOP
+V_MATH_FFT_B_PNT: NOP
+V_MATH_FFT_W_PNT: NOP
+FFT_BUTTERFLY: PUSH LR
+PUSH R0
+PUSH R1
+LDIL R7 LOW[FFT_BUTTERFLY_MEM]
+LDIH R7 HIGH[FFT_BUTTERFLY_MEM]
+MUL R0 R4 R2
+MULH R1 R4 R2
+SFTS R0 R0 #LSL
+SFT R1 R1 #ROL
+SFTS R0 R0 #LSL
+SFT R1 R1 #ROL
+STR R1 R7 +#0 PRE
+MUL R0 R4 R3
+MULH R1 R4 R3
+SFTS R0 R0 #LSL
+SFT R1 R1 #ROL
+SFTS R0 R0 #LSL
+SFT R1 R1 #ROL
+STR R1 R7 +#2 PRE
+MUL R0 R5 R2
+MULH R1 R5 R2
+SFTS R0 R0 #LSL
+SFT R1 R1 #ROL
+SFTS R0 R0 #LSL
+SFT R1 R1 #ROL
+STR R1 R7 +#4 PRE
+MUL R0 R5 R3
+MULH R1 R5 R3
+SFTS R0 R0 #LSL
+SFT R1 R1 #ROL
+SFTS R0 R0 #LSL
+SFT R1 R1 #ROL
+STR R1 R7 +#6 PRE
+POP R1
+POP R0
+LDR R2 R7 +#0 PRE
+LDR R3 R7 +#6 PRE
+ADDS R2 R0 R2
+SBC R3 R2 R3
+PUSH R3
+LDR R2 R7 +#2 PRE
+LDR R3 R7 +#4 PRE
+ADDS R2 R1 R2
+ADC R3 R2 R3
+PUSH R3
+LDR R2 R7 +#0 PRE
+LDR R3 R7 +#6 PRE
+SUBS R2 R0 R2
+ADC R3 R2 R3
+PUSH R3
+LDR R2 R7 +#2 PRE
+LDR R3 R7 +#4 PRE
+SUBS R2 R1 R2
+SBC R3 R2 R3
+POP R2
+POP R1
+POP R0
+POP LR
+RET LR
+FFT_BUTTERFLY_MEM: NOP
+NOP
+NOP
+NOP
+STORE_FFT_SAMPLE: PUSH R3
+PUSH R4
+PUSH R5
+CLR R5
+STORE_FFT_SAMPLE_BREV: SFTS R3 R3 #LSR
+SFT R5 R5 #RLC
+DECS R4 R4 #1
+BNE STORE_FFT_SAMPLE_BREV
+SFT R5 R5 #LSL
+SFT R5 R5 #LSL
+ADD R5 R2 R5
+STR R0 R5 +#0 PRE
+STR R1 R5 +#2 PRE
+POP R5
+POP R4
+POP R3
+RET LR
+MATH_LOG2: PUSH R1
+CLR R1
+MATH_LOG2_LOOP: SFTS R0 R0 #LSR
+BEQ MATH_LOG2_END
+INC R1 R1 #1
+B MATH_LOG2_LOOP
+MATH_LOG2_END: MOV R0 R1
+POP R1
+RET LR
+FFT_SINCOS_LUT: .DW #16384
+.DW #0
+.DW #16364
+.DW #803
+.DW #16305
+.DW #1605
+.DW #16206
+.DW #2404
+.DW #16069
+.DW #3196
+.DW #15892
+.DW #3980
+.DW #15678
+.DW #4756
+.DW #15426
+.DW #5519
+.DW #15136
+.DW #6269
+.DW #14810
+.DW #7005
+.DW #14449
+.DW #7723
+.DW #14053
+.DW #8423
+.DW #13622
+.DW #9102
+.DW #13159
+.DW #9759
+.DW #12665
+.DW #10393
+.DW #12139
+.DW #11002
+.DW #11585
+.DW #11585
+.DW #11002
+.DW #12139
+.DW #10393
+.DW #12665
+.DW #9759
+.DW #13159
+.DW #9102
+.DW #13622
+.DW #8423
+.DW #14053
+.DW #7723
+.DW #14449
+.DW #7005
+.DW #14810
+.DW #6269
+.DW #15136
+.DW #5519
+.DW #15426
+.DW #4756
+.DW #15678
+.DW #3980
+.DW #15892
+.DW #3196
+.DW #16069
+.DW #2404
+.DW #16206
+.DW #1605
+.DW #16305
+.DW #803
+.DW #16364
+.DW #0
+.DW #16384
+.DW #64733
+.DW #16364
+.DW #63931
+.DW #16305
+.DW #63132
+.DW #16206
+.DW #62340
+.DW #16069
+.DW #61556
+.DW #15892
+.DW #60780
+.DW #15678
+.DW #60017
+.DW #15426
+.DW #59267
+.DW #15136
+.DW #58531
+.DW #14810
+.DW #57813
+.DW #14449
+.DW #57113
+.DW #14053
+.DW #56434
+.DW #13622
+.DW #55777
+.DW #13159
+.DW #55143
+.DW #12665
+.DW #54534
+.DW #12139
+.DW #53951
+.DW #11585
+.DW #53397
+.DW #11002
+.DW #52871
+.DW #10393
+.DW #52377
+.DW #9759
+.DW #51914
+.DW #9102
+.DW #51483
+.DW #8423
+.DW #51087
+.DW #7723
+.DW #50726
+.DW #7005
+.DW #50400
+.DW #6269
+.DW #50110
+.DW #5519
+.DW #49858
+.DW #4756
+.DW #49644
+.DW #3980
+.DW #49467
+.DW #3196
+.DW #49330
+.DW #2404
+.DW #49231
+.DW #1605
+.DW #49172
+.DW #803
+INPUT_SIGNAL: .DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+.DW #1024
+.DW #0
+.DW #0
+.DW #0
+FFT_RAM: NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+ERR_STRING: .DW #17784
+.DW #25445
+.DW #28788
+.DW #26991
+.DW #28207
+.DW #26990
+.DW #29797
+.DW #29298
+.DW #30064
+.DW #29728
+.DW #25970
+.DW #29295
+.DW #29217
+.DW #0
+STRING_INTRO: .DW #17263
+.DW #28016
+.DW #30068
+.DW #26990
+.DW #26400
+.DW #17990
+.DW #21550
+.DW #11822
+.DW #8192
+STACK_BEGIN: NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+NOP
+STACK_END: NOP