| 1 |
2 |
tobil |
--------------------------------------------------------------
|
| 2 |
|
|
-- Simple testbench for AVR CM3 core running program_a.dec
|
| 3 |
|
|
-- program_b.dec and program_c.dec
|
| 4 |
|
|
--------------------------------------------------------------
|
| 5 |
|
|
LIBRARY IEEE;
|
| 6 |
|
|
USE IEEE.std_logic_1164.all;
|
| 7 |
|
|
USE IEEE.std_logic_arith.all;
|
| 8 |
|
|
USE IEEE.std_logic_textio.all;
|
| 9 |
|
|
USE std.textio.all;
|
| 10 |
|
|
USE WORK.all;
|
| 11 |
|
|
LIBRARY STD;
|
| 12 |
|
|
USE STD.TEXTIO.ALL;
|
| 13 |
|
|
|
| 14 |
|
|
entity avr_cm3_test is
|
| 15 |
|
|
end avr_cm3_test;
|
| 16 |
|
|
|
| 17 |
|
|
architecture behavioral of avr_cm3_test is
|
| 18 |
|
|
|
| 19 |
|
|
constant MAX_ROM_SIZE : positive := 512;
|
| 20 |
|
|
constant MAX_RAM_SIZE : positive := 65536;
|
| 21 |
|
|
file inFile_a : Text open read_mode is "program_a.dec";
|
| 22 |
|
|
file inFile_b : Text open read_mode is "program_b.dec";
|
| 23 |
|
|
file inFile_c : Text open read_mode is "program_c.dec";
|
| 24 |
|
|
|
| 25 |
|
|
signal system_clk : std_logic;
|
| 26 |
|
|
signal system_reset : Std_logic;
|
| 27 |
|
|
signal cp2 : std_logic;
|
| 28 |
|
|
signal cp2_cml_1 : std_logic;
|
| 29 |
|
|
signal cp2_cml_2 : std_logic;
|
| 30 |
|
|
signal cmls : integer range 0 to 2;
|
| 31 |
|
|
signal cml0_clk : std_logic;
|
| 32 |
|
|
signal cml1_clk : std_logic;
|
| 33 |
|
|
signal cml2_clk : std_logic;
|
| 34 |
|
|
signal cml0_reset : std_logic;
|
| 35 |
|
|
signal cml1_reset : std_logic;
|
| 36 |
|
|
signal cml2_reset : std_logic;
|
| 37 |
|
|
signal disable_second : std_logic;
|
| 38 |
|
|
|
| 39 |
|
|
signal core_pc_0 : std_logic_vector (15 downto 0);
|
| 40 |
|
|
signal core_pc_1 : std_logic_vector (15 downto 0);
|
| 41 |
|
|
signal core_pc_2 : std_logic_vector (15 downto 0);
|
| 42 |
|
|
|
| 43 |
|
|
signal ireset : std_logic;
|
| 44 |
|
|
signal gnd : std_logic;
|
| 45 |
|
|
signal vcc : std_logic;
|
| 46 |
|
|
signal core_pc : std_logic_vector (15 downto 0);
|
| 47 |
|
|
signal core_inst : std_logic_vector (15 downto 0);
|
| 48 |
|
|
signal core_adr : std_logic_vector (5 downto 0);
|
| 49 |
|
|
signal core_iore : std_logic;
|
| 50 |
|
|
signal core_iowe : std_logic;
|
| 51 |
|
|
signal core_ramadr : std_logic_vector (15 downto 0);
|
| 52 |
|
|
signal core_ramadr_0 : std_logic_vector (15 downto 0);
|
| 53 |
|
|
signal core_ramadr_1 : std_logic_vector (15 downto 0);
|
| 54 |
|
|
signal core_ramadr_2 : std_logic_vector (15 downto 0);
|
| 55 |
|
|
signal core_ramre : std_logic;
|
| 56 |
|
|
signal core_ramre_0 : std_logic;
|
| 57 |
|
|
signal core_ramre_1 : std_logic;
|
| 58 |
|
|
signal core_ramre_2 : std_logic;
|
| 59 |
|
|
signal core_ramwe : std_logic;
|
| 60 |
|
|
signal core_ramwe_0 : std_logic;
|
| 61 |
|
|
signal core_ramwe_1 : std_logic;
|
| 62 |
|
|
signal core_ramwe_2 : std_logic;
|
| 63 |
|
|
signal core_cpuwait : std_logic;
|
| 64 |
|
|
signal core_dbusin : std_logic_vector (7 downto 0);
|
| 65 |
|
|
signal core_dbusout : std_logic_vector (7 downto 0);
|
| 66 |
|
|
signal core_irqlines : std_logic_vector(22 downto 0);
|
| 67 |
|
|
signal core_irqack : std_logic;
|
| 68 |
|
|
signal core_irqackad : std_logic_vector(4 downto 0);
|
| 69 |
|
|
signal sleepi : std_logic;
|
| 70 |
|
|
signal irqok : std_logic;
|
| 71 |
|
|
signal globint : std_logic;
|
| 72 |
|
|
signal core_wdri : std_logic;
|
| 73 |
|
|
|
| 74 |
|
|
component AVR_Core is port(
|
| 75 |
|
|
--Clock and reset
|
| 76 |
|
|
cp2 : in std_logic;
|
| 77 |
|
|
cp2en : in std_logic;
|
| 78 |
|
|
ireset : in std_logic;
|
| 79 |
|
|
-- JTAG OCD support
|
| 80 |
|
|
valid_instr : out std_logic;
|
| 81 |
|
|
insert_nop : in std_logic;
|
| 82 |
|
|
block_irq : in std_logic;
|
| 83 |
|
|
change_flow : out std_logic;
|
| 84 |
|
|
-- Program Memory
|
| 85 |
|
|
pc : out std_logic_vector(15 downto 0);
|
| 86 |
|
|
inst : in std_logic_vector(15 downto 0);
|
| 87 |
|
|
-- I/O control
|
| 88 |
|
|
adr : out std_logic_vector(5 downto 0);
|
| 89 |
|
|
iore : out std_logic;
|
| 90 |
|
|
iowe : out std_logic;
|
| 91 |
|
|
-- Data memory control
|
| 92 |
|
|
ramadr : out std_logic_vector(15 downto 0);
|
| 93 |
|
|
ramre : out std_logic;
|
| 94 |
|
|
ramwe : out std_logic;
|
| 95 |
|
|
cpuwait : in std_logic;
|
| 96 |
|
|
-- Data paths
|
| 97 |
|
|
dbusin : in std_logic_vector(7 downto 0);
|
| 98 |
|
|
dbusout : out std_logic_vector(7 downto 0);
|
| 99 |
|
|
-- Interrupt
|
| 100 |
|
|
irqlines : in std_logic_vector(22 downto 0);
|
| 101 |
|
|
irqack : out std_logic;
|
| 102 |
|
|
irqackad : out std_logic_vector(4 downto 0);
|
| 103 |
|
|
--Sleep Control
|
| 104 |
|
|
sleepi : out std_logic;
|
| 105 |
|
|
irqok : out std_logic;
|
| 106 |
|
|
globint : out std_logic;
|
| 107 |
|
|
--Watchdog
|
| 108 |
|
|
wdri : out std_logic);
|
| 109 |
|
|
end component;
|
| 110 |
|
|
|
| 111 |
|
|
component AVR_Core_cm3 is port(
|
| 112 |
|
|
cp2_cml_1 : in std_logic;
|
| 113 |
|
|
cp2_cml_2 : in std_logic;
|
| 114 |
|
|
--Clock and reset
|
| 115 |
|
|
cp2 : in std_logic;
|
| 116 |
|
|
cp2en : in std_logic;
|
| 117 |
|
|
ireset : in std_logic;
|
| 118 |
|
|
-- JTAG OCD support
|
| 119 |
|
|
valid_instr : out std_logic;
|
| 120 |
|
|
insert_nop : in std_logic;
|
| 121 |
|
|
block_irq : in std_logic;
|
| 122 |
|
|
change_flow : out std_logic;
|
| 123 |
|
|
-- Program Memory
|
| 124 |
|
|
pc : out std_logic_vector(15 downto 0);
|
| 125 |
|
|
inst : in std_logic_vector(15 downto 0);
|
| 126 |
|
|
-- I/O control
|
| 127 |
|
|
adr : out std_logic_vector(5 downto 0);
|
| 128 |
|
|
iore : out std_logic;
|
| 129 |
|
|
iowe : out std_logic;
|
| 130 |
|
|
-- Data memory control
|
| 131 |
|
|
ramadr : out std_logic_vector(15 downto 0);
|
| 132 |
|
|
ramre : out std_logic;
|
| 133 |
|
|
ramwe : out std_logic;
|
| 134 |
|
|
cpuwait : in std_logic;
|
| 135 |
|
|
-- Data paths
|
| 136 |
|
|
dbusin : in std_logic_vector(7 downto 0);
|
| 137 |
|
|
dbusout : out std_logic_vector(7 downto 0);
|
| 138 |
|
|
-- Interrupt
|
| 139 |
|
|
irqlines : in std_logic_vector(22 downto 0);
|
| 140 |
|
|
irqack : out std_logic;
|
| 141 |
|
|
irqackad : out std_logic_vector(4 downto 0);
|
| 142 |
|
|
--Sleep Control
|
| 143 |
|
|
sleepi : out std_logic;
|
| 144 |
|
|
irqok : out std_logic;
|
| 145 |
|
|
globint : out std_logic;
|
| 146 |
|
|
--Watchdog
|
| 147 |
|
|
wdri : out std_logic);
|
| 148 |
|
|
end component;
|
| 149 |
|
|
|
| 150 |
|
|
TYPE std_logic_array_rom IS ARRAY (INTEGER RANGE 0 to (3 * MAX_ROM_SIZE) - 1) of Std_logic_vector(15 downto 0);
|
| 151 |
|
|
SIGNAL rom_array :Std_logic_array_rom;
|
| 152 |
|
|
TYPE std_logic_array_ram IS ARRAY (INTEGER RANGE 0 to (3 * MAX_RAM_SIZE) - 1) of Std_logic_vector(7 downto 0);
|
| 153 |
|
|
SIGNAL ram_array :Std_logic_array_ram;
|
| 154 |
|
|
|
| 155 |
|
|
|
| 156 |
|
|
BEGIN
|
| 157 |
|
|
|
| 158 |
|
|
------------------------------------------------------------------------
|
| 159 |
|
|
-- CMLS indicates current pipe
|
| 160 |
|
|
-- clocks for AVR Core CM3
|
| 161 |
|
|
------------------------------------------------------------------------
|
| 162 |
|
|
cmls_gen : process (system_clk)
|
| 163 |
|
|
begin
|
| 164 |
|
|
if (system_clk'event and system_clk = '1') then
|
| 165 |
|
|
cp2 <= system_clk;
|
| 166 |
|
|
cp2_cml_1 <= system_clk;
|
| 167 |
|
|
cp2_cml_2 <= system_clk;
|
| 168 |
|
|
if (cmls = 2) then
|
| 169 |
|
|
cmls <= 0;
|
| 170 |
|
|
else
|
| 171 |
|
|
cmls <= cmls + 1;
|
| 172 |
|
|
end if;
|
| 173 |
|
|
end if;
|
| 174 |
|
|
if (system_clk'event and system_clk = '0') then
|
| 175 |
|
|
cp2 <= '0';
|
| 176 |
|
|
cp2_cml_1 <= '0';
|
| 177 |
|
|
cp2_cml_2 <= '0';
|
| 178 |
|
|
end if;
|
| 179 |
|
|
end process;
|
| 180 |
|
|
|
| 181 |
|
|
------------------------------------------------------------------------
|
| 182 |
|
|
-- stimuli
|
| 183 |
|
|
------------------------------------------------------------------------
|
| 184 |
|
|
vcc <= '1';
|
| 185 |
|
|
gnd <= '0';
|
| 186 |
|
|
core_cpuwait <= '0';
|
| 187 |
|
|
core_irqlines <= "00000000000000000000000";
|
| 188 |
|
|
|
| 189 |
|
|
------------------------------------------------------------------------
|
| 190 |
|
|
-- ROM
|
| 191 |
|
|
------------------------------------------------------------------------
|
| 192 |
|
|
rom_read_gen:PROCESS
|
| 193 |
|
|
variable thisInt : integer range 0 to 65535;
|
| 194 |
|
|
variable i: integer;
|
| 195 |
|
|
variable inLine: Line;
|
| 196 |
|
|
BEGIN
|
| 197 |
|
|
readline(inFile_a, inLine);
|
| 198 |
|
|
read(inLine, thisInt);
|
| 199 |
|
|
for i in 0 to thisInt - 1 loop
|
| 200 |
|
|
readline(inFile_a, inLine);
|
| 201 |
|
|
read(inLine, thisInt);
|
| 202 |
|
|
rom_array(i) <= conv_std_logic_vector(conv_unsigned(thisInt, 16), 16);
|
| 203 |
|
|
end loop;
|
| 204 |
|
|
readline(inFile_b, inLine);
|
| 205 |
|
|
read(inLine, thisInt);
|
| 206 |
|
|
for i in 0 to thisInt - 1 loop
|
| 207 |
|
|
readline(inFile_b, inLine);
|
| 208 |
|
|
read(inLine, thisInt);
|
| 209 |
|
|
rom_array(MAX_ROM_SIZE + i) <= conv_std_logic_vector(conv_unsigned(thisInt, 16), 16);
|
| 210 |
|
|
end loop;
|
| 211 |
|
|
readline(inFile_c, inLine);
|
| 212 |
|
|
read(inLine, thisInt);
|
| 213 |
|
|
for i in 0 to thisInt - 1 loop
|
| 214 |
|
|
readline(inFile_c, inLine);
|
| 215 |
|
|
read(inLine, thisInt);
|
| 216 |
|
|
rom_array((2 * MAX_ROM_SIZE) + i) <= conv_std_logic_vector(conv_unsigned(thisInt, 16), 16);
|
| 217 |
|
|
end loop;
|
| 218 |
|
|
WAIT FOR 8000 ms;
|
| 219 |
|
|
end process;
|
| 220 |
|
|
|
| 221 |
|
|
core_inst_gen : PROCESS(core_pc, cmls)
|
| 222 |
|
|
BEGIN
|
| 223 |
|
|
if (cmls = 0) then
|
| 224 |
|
|
core_inst <= rom_array(conv_integer(unsigned(core_pc)))(7 downto 0) &
|
| 225 |
|
|
rom_array(conv_integer(unsigned(core_pc)))(15 downto 8);
|
| 226 |
|
|
else
|
| 227 |
|
|
if (cmls = 1) then
|
| 228 |
|
|
core_inst <= rom_array(MAX_ROM_SIZE + conv_integer(unsigned(core_pc)))(7 downto 0) &
|
| 229 |
|
|
rom_array(MAX_ROM_SIZE + conv_integer(unsigned(core_pc)))(15 downto 8);
|
| 230 |
|
|
else
|
| 231 |
|
|
core_inst <= rom_array((2 * MAX_ROM_SIZE) + conv_integer(unsigned(core_pc)))(7 downto 0) &
|
| 232 |
|
|
rom_array((2 * MAX_ROM_SIZE) + conv_integer(unsigned(core_pc)))(15 downto 8);
|
| 233 |
|
|
end if;
|
| 234 |
|
|
end if;
|
| 235 |
|
|
end process;
|
| 236 |
|
|
|
| 237 |
|
|
------------------------------------------------------------------------
|
| 238 |
|
|
-- RAM
|
| 239 |
|
|
------------------------------------------------------------------------
|
| 240 |
|
|
ram_gen : PROCESS(system_clk, system_reset)
|
| 241 |
|
|
variable i: integer;
|
| 242 |
|
|
BEGIN
|
| 243 |
|
|
if (system_reset = '0') then
|
| 244 |
|
|
if (disable_second = '0') then
|
| 245 |
|
|
for i in 0 to ((3 * MAX_RAM_SIZE) - 1) loop
|
| 246 |
|
|
ram_array(i) <= conv_std_logic_vector(0, 8);
|
| 247 |
|
|
end loop;
|
| 248 |
|
|
end if;
|
| 249 |
|
|
else
|
| 250 |
|
|
if (system_clk'event and system_clk = '1') then
|
| 251 |
|
|
if (core_ramwe = '1') then
|
| 252 |
|
|
if (cmls = 0) then
|
| 253 |
|
|
ram_array(conv_integer(unsigned(core_ramadr))) <= core_dbusout;
|
| 254 |
|
|
else
|
| 255 |
|
|
if (cmls = 1) then
|
| 256 |
|
|
ram_array(MAX_RAM_SIZE + conv_integer(unsigned(core_ramadr))) <= core_dbusout;
|
| 257 |
|
|
else
|
| 258 |
|
|
ram_array((2 * MAX_RAM_SIZE) + conv_integer(unsigned(core_ramadr))) <= core_dbusout;
|
| 259 |
|
|
end if;
|
| 260 |
|
|
end if;
|
| 261 |
|
|
end if;
|
| 262 |
|
|
end if;
|
| 263 |
|
|
end if;
|
| 264 |
|
|
end process;
|
| 265 |
|
|
|
| 266 |
|
|
core_dbusin <= ram_array(conv_integer(unsigned(core_ramadr))) when (cmls = 0) else
|
| 267 |
|
|
ram_array(MAX_RAM_SIZE + conv_integer(unsigned(core_ramadr))) when (cmls = 1) else
|
| 268 |
|
|
ram_array((2 * MAX_RAM_SIZE) + conv_integer(unsigned(core_ramadr))) ;
|
| 269 |
|
|
|
| 270 |
|
|
|
| 271 |
|
|
------------------------------------------------------------------------
|
| 272 |
|
|
-- system_clk
|
| 273 |
|
|
------------------------------------------------------------------------
|
| 274 |
|
|
clk_gen:PROCESS
|
| 275 |
|
|
VARIABLE lin:line;
|
| 276 |
|
|
BEGIN
|
| 277 |
|
|
system_clk <= '1';
|
| 278 |
|
|
WAIT FOR 12 ns;
|
| 279 |
|
|
system_clk <= '0';
|
| 280 |
|
|
WAIT FOR 12 ns;
|
| 281 |
|
|
END PROCESS;
|
| 282 |
|
|
|
| 283 |
|
|
------------------------------------------------------------------------
|
| 284 |
|
|
-- system_reset and kill/restart second core
|
| 285 |
|
|
------------------------------------------------------------------------
|
| 286 |
|
|
reset_gen:PROCESS
|
| 287 |
|
|
BEGIN
|
| 288 |
|
|
system_reset <= '0';
|
| 289 |
|
|
disable_second <= '0';
|
| 290 |
|
|
WAIT FOR 110 ns;
|
| 291 |
|
|
system_reset <= '1' ;
|
| 292 |
|
|
WAIT FOR 100000 ns;
|
| 293 |
|
|
WAIT UNTIL (cmls = 0);
|
| 294 |
|
|
disable_second <= '1';
|
| 295 |
|
|
WAIT FOR 100000 ns;
|
| 296 |
|
|
WAIT UNTIL (cmls = 0);
|
| 297 |
|
|
WAIT UNTIL (system_clk = '1');
|
| 298 |
|
|
system_reset <= '0';
|
| 299 |
|
|
WAIT UNTIL (system_clk = '0');
|
| 300 |
|
|
WAIT FOR 2 ns;
|
| 301 |
|
|
system_reset <= '1' ;
|
| 302 |
|
|
WAIT FOR 2 ns;
|
| 303 |
|
|
disable_second <= '0';
|
| 304 |
|
|
WAIT FOR 100000 ns;
|
| 305 |
|
|
ASSERT false REPORT "test passed, done !!!" severity failure;
|
| 306 |
|
|
END PROCESS;
|
| 307 |
|
|
|
| 308 |
|
|
------------------------------------------------------------------------
|
| 309 |
|
|
-- AVR_Core CM3
|
| 310 |
|
|
------------------------------------------------------------------------
|
| 311 |
|
|
AVR_Core_Inst_cm3: AVR_Core_cm3 port map(
|
| 312 |
|
|
cp2_cml_1 => cp2_cml_1,
|
| 313 |
|
|
cp2_cml_2 => cp2_cml_2,
|
| 314 |
|
|
--Clock and reset
|
| 315 |
|
|
cp2 => cp2,
|
| 316 |
|
|
cp2en => vcc,
|
| 317 |
|
|
ireset => ireset,
|
| 318 |
|
|
-- JTAG OCD support
|
| 319 |
|
|
valid_instr => open,
|
| 320 |
|
|
insert_nop => gnd,
|
| 321 |
|
|
block_irq => gnd,
|
| 322 |
|
|
change_flow => open,
|
| 323 |
|
|
-- Program Memory
|
| 324 |
|
|
pc => core_pc,
|
| 325 |
|
|
inst => core_inst,
|
| 326 |
|
|
-- I/O control
|
| 327 |
|
|
adr => core_adr,
|
| 328 |
|
|
iore => core_iore,
|
| 329 |
|
|
iowe => core_iowe,
|
| 330 |
|
|
-- Data memory control
|
| 331 |
|
|
ramadr => core_ramadr,
|
| 332 |
|
|
ramre => core_ramre,
|
| 333 |
|
|
ramwe => core_ramwe,
|
| 334 |
|
|
cpuwait => core_cpuwait,
|
| 335 |
|
|
-- Data paths
|
| 336 |
|
|
dbusin => core_dbusin,
|
| 337 |
|
|
dbusout => core_dbusout,
|
| 338 |
|
|
-- Interrupts
|
| 339 |
|
|
irqlines => core_irqlines,
|
| 340 |
|
|
irqack => core_irqack,
|
| 341 |
|
|
irqackad => core_irqackad,
|
| 342 |
|
|
--Sleep Control
|
| 343 |
|
|
sleepi => sleepi,
|
| 344 |
|
|
irqok => irqok,
|
| 345 |
|
|
globint => globint,
|
| 346 |
|
|
--Watchdog
|
| 347 |
|
|
wdri => core_wdri);
|
| 348 |
|
|
|
| 349 |
|
|
|
| 350 |
|
|
------------------------------------------------------------------------
|
| 351 |
|
|
------------------------------------------------------------------------
|
| 352 |
|
|
------------------------------------------------------------------------
|
| 353 |
|
|
-- Insertion of 3 additional AVR cores for virtual debugging
|
| 354 |
|
|
------------------------------------------------------------------------
|
| 355 |
|
|
------------------------------------------------------------------------
|
| 356 |
|
|
------------------------------------------------------------------------
|
| 357 |
|
|
-- generate individual clocks for AVR 0, 1 and 2
|
| 358 |
|
|
------------------------------------------------------------------------
|
| 359 |
|
|
subckl_gen : process (system_clk)
|
| 360 |
|
|
begin
|
| 361 |
|
|
if (cmls = 0) then
|
| 362 |
|
|
cml0_clk <= system_clk;
|
| 363 |
|
|
cml1_clk <= '0';
|
| 364 |
|
|
cml2_clk <= '0';
|
| 365 |
|
|
else
|
| 366 |
|
|
if (cmls = 1) then
|
| 367 |
|
|
cml0_clk <= '0';
|
| 368 |
|
|
if (disable_second = '0') then
|
| 369 |
|
|
cml1_clk <= system_clk;
|
| 370 |
|
|
end if;
|
| 371 |
|
|
cml2_clk <= '0';
|
| 372 |
|
|
else
|
| 373 |
|
|
cml0_clk <= '0';
|
| 374 |
|
|
cml1_clk <= '0';
|
| 375 |
|
|
cml2_clk <= system_clk;
|
| 376 |
|
|
end if;
|
| 377 |
|
|
end if;
|
| 378 |
|
|
end process;
|
| 379 |
|
|
|
| 380 |
|
|
------------------------------------------------------------------------
|
| 381 |
|
|
-- generate individual resets for AVR 0, 1 and 2
|
| 382 |
|
|
------------------------------------------------------------------------
|
| 383 |
|
|
system_reset_in_gen : PROCESS(system_clk, system_reset, disable_second)
|
| 384 |
|
|
BEGIN
|
| 385 |
|
|
if (disable_second = '0') then
|
| 386 |
|
|
if (system_clk'event and system_clk = '0') then
|
| 387 |
|
|
cml2_reset <= cml1_reset;
|
| 388 |
|
|
cml1_reset <= cml0_reset;
|
| 389 |
|
|
cml0_reset <= system_reset;
|
| 390 |
|
|
end if;
|
| 391 |
|
|
else
|
| 392 |
|
|
cml1_reset <= system_reset;
|
| 393 |
|
|
end if;
|
| 394 |
|
|
end process;
|
| 395 |
|
|
|
| 396 |
|
|
ireset <= cml2_reset AND system_reset;
|
| 397 |
|
|
--ireset <= system_reset;
|
| 398 |
|
|
|
| 399 |
|
|
------------------------------------------------------------------------
|
| 400 |
|
|
-- for processors a comparison of PC is enough
|
| 401 |
|
|
------------------------------------------------------------------------
|
| 402 |
|
|
check_gen : PROCESS(system_clk, system_reset)
|
| 403 |
|
|
BEGIN
|
| 404 |
|
|
if (system_reset = '1') then
|
| 405 |
|
|
if (system_clk'event and system_clk = '0') then
|
| 406 |
|
|
if (cmls = 0) then
|
| 407 |
|
|
if NOT (core_pc = core_pc_0) then
|
| 408 |
|
|
ASSERT false REPORT "PC 0 mismatch" severity failure;
|
| 409 |
|
|
end if;
|
| 410 |
|
|
if NOT (core_ramadr = core_ramadr_0) then
|
| 411 |
|
|
ASSERT false REPORT "RAMADR 0 mismatch" severity failure;
|
| 412 |
|
|
end if;
|
| 413 |
|
|
if NOT (core_ramre = core_ramre_0) then
|
| 414 |
|
|
ASSERT false REPORT "RAMRE 0 mismatch" severity failure;
|
| 415 |
|
|
end if;
|
| 416 |
|
|
if NOT (core_ramwe = core_ramwe_0) then
|
| 417 |
|
|
ASSERT false REPORT "RAMWE 0 mismatch" severity failure;
|
| 418 |
|
|
end if;
|
| 419 |
|
|
else
|
| 420 |
|
|
if (cmls = 1) then
|
| 421 |
|
|
if (disable_second = '0') then
|
| 422 |
|
|
if NOT (core_pc = core_pc_1) then
|
| 423 |
|
|
ASSERT false REPORT "PC 1 mismatch" severity failure;
|
| 424 |
|
|
end if;
|
| 425 |
|
|
if NOT (core_ramadr = core_ramadr_1) then
|
| 426 |
|
|
ASSERT false REPORT "RAMADR 1 mismatch" severity failure;
|
| 427 |
|
|
end if;
|
| 428 |
|
|
if NOT (core_ramre = core_ramre_1) then
|
| 429 |
|
|
ASSERT false REPORT "RAMRE 1 mismatch" severity failure;
|
| 430 |
|
|
end if;
|
| 431 |
|
|
if NOT (core_ramwe = core_ramwe_1) then
|
| 432 |
|
|
ASSERT false REPORT "RAMWE 1 mismatch" severity failure;
|
| 433 |
|
|
end if;
|
| 434 |
|
|
end if;
|
| 435 |
|
|
else
|
| 436 |
|
|
if NOT (core_pc = core_pc_2) then
|
| 437 |
|
|
ASSERT false REPORT "PC 2 mismatch" severity failure;
|
| 438 |
|
|
end if;
|
| 439 |
|
|
if NOT (core_ramadr = core_ramadr_2) then
|
| 440 |
|
|
ASSERT false REPORT "RAMADR 2 mismatch" severity failure;
|
| 441 |
|
|
end if;
|
| 442 |
|
|
if NOT (core_ramre = core_ramre_2) then
|
| 443 |
|
|
ASSERT false REPORT "RAMRE 2 mismatch" severity failure;
|
| 444 |
|
|
end if;
|
| 445 |
|
|
if NOT (core_ramwe = core_ramwe_2) then
|
| 446 |
|
|
ASSERT false REPORT "RAMWE 2 mismatch" severity failure;
|
| 447 |
|
|
end if;
|
| 448 |
|
|
end if;
|
| 449 |
|
|
end if;
|
| 450 |
|
|
end if;
|
| 451 |
|
|
end if;
|
| 452 |
|
|
end process;
|
| 453 |
|
|
|
| 454 |
|
|
|
| 455 |
|
|
------------------------------------------------------------------------
|
| 456 |
|
|
-- AVR_Core virtual 0
|
| 457 |
|
|
------------------------------------------------------------------------
|
| 458 |
|
|
AVR_Core_Inst_0: AVR_Core port map(
|
| 459 |
|
|
--Clock and reset
|
| 460 |
|
|
cp2 => cml0_clk,
|
| 461 |
|
|
cp2en => vcc,
|
| 462 |
|
|
ireset => cml0_reset,
|
| 463 |
|
|
-- JTAG OCD support
|
| 464 |
|
|
valid_instr => open,
|
| 465 |
|
|
insert_nop => gnd,
|
| 466 |
|
|
block_irq => gnd,
|
| 467 |
|
|
change_flow => open,
|
| 468 |
|
|
-- Program Memory
|
| 469 |
|
|
pc => core_pc_0,
|
| 470 |
|
|
inst => core_inst,
|
| 471 |
|
|
-- I/O control
|
| 472 |
|
|
adr => open,
|
| 473 |
|
|
iore => open,
|
| 474 |
|
|
iowe => open,
|
| 475 |
|
|
-- Data memory control
|
| 476 |
|
|
ramadr => core_ramadr_0,
|
| 477 |
|
|
ramre => core_ramre_0,
|
| 478 |
|
|
ramwe => core_ramwe_0,
|
| 479 |
|
|
cpuwait => core_cpuwait,
|
| 480 |
|
|
-- Data paths
|
| 481 |
|
|
dbusin => core_dbusin,
|
| 482 |
|
|
dbusout => open,
|
| 483 |
|
|
-- Interrupts
|
| 484 |
|
|
irqlines => core_irqlines,
|
| 485 |
|
|
irqack => open,
|
| 486 |
|
|
irqackad => open,
|
| 487 |
|
|
--Sleep Control
|
| 488 |
|
|
sleepi => open,
|
| 489 |
|
|
irqok => open,
|
| 490 |
|
|
globint => open,
|
| 491 |
|
|
--Watchdog
|
| 492 |
|
|
wdri => open);
|
| 493 |
|
|
|
| 494 |
|
|
------------------------------------------------------------------------
|
| 495 |
|
|
-- AVR_Core virtual 1
|
| 496 |
|
|
------------------------------------------------------------------------
|
| 497 |
|
|
AVR_Core_Inst_1: AVR_Core port map(
|
| 498 |
|
|
--Clock and reset
|
| 499 |
|
|
cp2 => cml1_clk,
|
| 500 |
|
|
cp2en => vcc,
|
| 501 |
|
|
ireset => cml1_reset,
|
| 502 |
|
|
-- JTAG OCD support
|
| 503 |
|
|
valid_instr => open,
|
| 504 |
|
|
insert_nop => gnd,
|
| 505 |
|
|
block_irq => gnd,
|
| 506 |
|
|
change_flow => open,
|
| 507 |
|
|
-- Program Memory
|
| 508 |
|
|
pc => core_pc_1,
|
| 509 |
|
|
inst => core_inst,
|
| 510 |
|
|
-- I/O control
|
| 511 |
|
|
adr => open,
|
| 512 |
|
|
iore => open,
|
| 513 |
|
|
iowe => open,
|
| 514 |
|
|
-- Data memory control
|
| 515 |
|
|
ramadr => core_ramadr_1,
|
| 516 |
|
|
ramre => core_ramre_1,
|
| 517 |
|
|
ramwe => core_ramwe_1,
|
| 518 |
|
|
cpuwait => core_cpuwait,
|
| 519 |
|
|
-- Data paths
|
| 520 |
|
|
dbusin => core_dbusin,
|
| 521 |
|
|
dbusout => open,
|
| 522 |
|
|
-- Interrupts
|
| 523 |
|
|
irqlines => core_irqlines,
|
| 524 |
|
|
irqack => open,
|
| 525 |
|
|
irqackad => open,
|
| 526 |
|
|
--Sleep Control
|
| 527 |
|
|
sleepi => open,
|
| 528 |
|
|
irqok => open,
|
| 529 |
|
|
globint => open,
|
| 530 |
|
|
--Watchdog
|
| 531 |
|
|
wdri => open);
|
| 532 |
|
|
|
| 533 |
|
|
------------------------------------------------------------------------
|
| 534 |
|
|
-- AVR_Core virtual 2
|
| 535 |
|
|
------------------------------------------------------------------------
|
| 536 |
|
|
AVR_Core_Inst_2: AVR_Core port map(
|
| 537 |
|
|
--Clock and reset
|
| 538 |
|
|
cp2 => cml2_clk,
|
| 539 |
|
|
cp2en => vcc,
|
| 540 |
|
|
ireset => cml2_reset,
|
| 541 |
|
|
-- JTAG OCD support
|
| 542 |
|
|
valid_instr => open,
|
| 543 |
|
|
insert_nop => gnd,
|
| 544 |
|
|
block_irq => gnd,
|
| 545 |
|
|
change_flow => open,
|
| 546 |
|
|
-- Program Memory
|
| 547 |
|
|
pc => core_pc_2,
|
| 548 |
|
|
inst => core_inst,
|
| 549 |
|
|
-- I/O control
|
| 550 |
|
|
adr => open,
|
| 551 |
|
|
iore => open,
|
| 552 |
|
|
iowe => open,
|
| 553 |
|
|
-- Data memory control
|
| 554 |
|
|
ramadr => core_ramadr_2,
|
| 555 |
|
|
ramre => core_ramre_2,
|
| 556 |
|
|
ramwe => core_ramwe_2,
|
| 557 |
|
|
cpuwait => core_cpuwait,
|
| 558 |
|
|
-- Data paths
|
| 559 |
|
|
dbusin => core_dbusin,
|
| 560 |
|
|
dbusout => open,
|
| 561 |
|
|
-- Interrupts
|
| 562 |
|
|
irqlines => core_irqlines,
|
| 563 |
|
|
irqack => open,
|
| 564 |
|
|
irqackad => open,
|
| 565 |
|
|
--Sleep Control
|
| 566 |
|
|
sleepi => open,
|
| 567 |
|
|
irqok => open,
|
| 568 |
|
|
globint => open,
|
| 569 |
|
|
--Watchdog
|
| 570 |
|
|
wdri => open);
|
| 571 |
|
|
|
| 572 |
|
|
end behavioral;
|
| 573 |
|
|
|
| 574 |
|
|
|