bus_csr=csr_bus.Interface(csr_data_width, csr_address_width))
self.add_csr_master(self.wishbone2csr.csr)
self.config["CSR_DATA_WIDTH"] = csr_data_width
- self.add_constant("CSR_DATA_WIDTH", csr_data_width)
self.register_mem("csr", self.soc_mem_map["csr"], self.wishbone2csr.wishbone)
# Add UART
self.submodules.identifier = identifier.Identifier(ident)
self.add_csr("identifier_mem", allow_user_defined=True)
self.config["CLOCK_FREQUENCY"] = int(clk_freq)
- self.add_constant("SYSTEM_CLOCK_FREQUENCY", int(clk_freq))
# Add Timer
if with_timer:
main_ram_size = 2**(geom_settings.bankbits +
geom_settings.rowbits +
geom_settings.colbits)*phy.settings.databits//8
- self.add_constant("L2_SIZE", self.l2_size)
+ self.config["L2_SIZE"] = self.l2_size
# add a Wishbone interface to the DRAM
wb_sdram = wishbone.Interface()
flush_cpu_icache();
#endif
flush_cpu_dcache();
-#ifdef L2_SIZE
+#ifdef CONFIG_L2_SIZE
flush_l2_cache();
#endif
boot_helper(r1, r2, r3, addr);
timer0_en_write(0);
timer0_reload_write(0);
- timer0_load_write(SYSTEM_CLOCK_FREQUENCY/4);
+ timer0_load_write(CONFIG_CLOCK_FREQUENCY/4);
timer0_en_write(1);
timer0_update_value_write(1);
recognized = 0;
else if(strcmp(token, "crc") == 0) crc(get_token(&c), get_token(&c));
else if(strcmp(token, "ident") == 0) ident();
-#ifdef L2_SIZE
+#ifdef CONFIG_L2_SIZE
else if(strcmp(token, "flushl2") == 0) flush_l2_cache();
#endif
#ifdef CSR_CTRL_BASE
#else
printf("Unknown");
#endif
- printf(" @ %dMHz\n", SYSTEM_CLOCK_FREQUENCY/1000000);
+ printf(" @ %dMHz\n", CONFIG_CLOCK_FREQUENCY/1000000);
printf("\e[1mROM\e[0m: %dKB\n", ROM_SIZE/1024);
printf("\e[1mSRAM\e[0m: %dKB\n", SRAM_SIZE/1024);
-#ifdef L2_SIZE
- printf("\e[1mL2\e[0m: %dKB\n", L2_SIZE/1024);
+#ifdef CONFIG_L2_SIZE
+ printf("\e[1mL2\e[0m: %dKB\n", CONFIG_L2_SIZE/1024);
#endif
#ifdef MAIN_RAM_SIZE
printf("\e[1mMAIN-RAM\e[0m: %dKB\n", MAIN_RAM_SIZE/1024);
array[i] = ONEZERO;
}
flush_cpu_dcache();
-#ifdef L2_SIZE
+#ifdef CONFIG_L2_SIZE
flush_l2_cache();
#endif
for(i=0;i<MEMTEST_BUS_SIZE/4;i++) {
array[i] = ZEROONE;
}
flush_cpu_dcache();
-#ifdef L2_SIZE
+#ifdef CONFIG_L2_SIZE
flush_l2_cache();
#endif
for(i=0;i<MEMTEST_BUS_SIZE/4;i++) {
seed_32 = 0;
flush_cpu_dcache();
-#ifdef L2_SIZE
+#ifdef CONFIG_L2_SIZE
flush_l2_cache();
#endif
for(i=0;i<MEMTEST_DATA_SIZE/4;i++) {
seed_16 = 0;
flush_cpu_dcache();
-#ifdef L2_SIZE
+#ifdef CONFIG_L2_SIZE
flush_l2_cache();
#endif
for(i=0;i<MEMTEST_ADDR_SIZE/4;i++) {
#endif
}
-#ifdef L2_SIZE
+#ifdef CONFIG_L2_SIZE
void flush_l2_cache(void)
{
unsigned int i;
- for(i=0;i<2*L2_SIZE/4;i++) {
+ for(i=0;i<2*CONFIG_L2_SIZE/4;i++) {
((volatile unsigned int *) MAIN_RAM_BASE)[i];
}
}
int t;
timer0_en_write(0);
- t = 2*SYSTEM_CLOCK_FREQUENCY;
+ t = 2*CONFIG_CLOCK_FREQUENCY;
timer0_reload_write(t);
timer0_load_write(t);
timer0_en_write(1);
{
timer0_en_write(0);
timer0_reload_write(0);
- timer0_load_write(SYSTEM_CLOCK_FREQUENCY/10*ds);
+ timer0_load_write(CONFIG_CLOCK_FREQUENCY/10*ds);
timer0_en_write(1);
timer0_update_value_write(1);
while(timer0_value_read()) timer0_update_value_write(1);
self.constants = self.build_constants()
# Load csr_data_width from the constants, otherwise it must be provided
- constant_csr_data_width = self.constants.d.get('csr_data_width', None)
+ constant_csr_data_width = self.constants.d.get("config_csr_data_width", None)
if csr_data_width is None:
csr_data_width = constant_csr_data_width
if csr_data_width is None:
- raise KeyError('csr_data_width not found in constants, please provide!')
+ raise KeyError("csr_data_width not found in constants, please provide!")
if csr_data_width != constant_csr_data_width:
- raise KeyError('csr_data_width of {} provided but {} found in constants'.format(
+ raise KeyError("csr_data_width of {} provided but {} found in constants".format(
csr_data_width, constant_csr_data_width))
self.csr_data_width = csr_data_width