Line 82... |
Line 82... |
m_core->eval();
|
m_core->eval();
|
}
|
}
|
|
|
void setsdcard(const char *fn) {
|
void setsdcard(const char *fn) {
|
m_sdcard.load(fn);
|
m_sdcard.load(fn);
|
|
|
|
printf("LOADING SDCARD FROM: \'%s\'\n", fn);
|
}
|
}
|
|
|
void tick(void) {
|
void tick(void) {
|
int flash_miso, sdcard_miso;
|
int flash_miso, sdcard_miso;
|
|
|
Line 154... |
Line 156... |
writeout = true;
|
writeout = true;
|
else if ((((m_core->v__DOT__wb_addr ^ 0x0120)&(~0x03))==0)
|
else if ((((m_core->v__DOT__wb_addr ^ 0x0120)&(~0x03))==0)
|
&&(m_core->v__DOT__wb_cyc))
|
&&(m_core->v__DOT__wb_cyc))
|
writeout = true;
|
writeout = true;
|
|
|
writeout = (writeout)||(m_core->i_rx_stb)
|
/*
|
||((m_core->o_tx_stb)&&(!m_core->i_tx_busy));
|
writeout = (writeout)||(m_core->i_rx_stb)
|
writeout = (writeout)||(m_core->v__DOT____Vcellinp__genbus____pinNumber9);
|
||((m_core->o_tx_stb)&&(!m_core->i_tx_busy));
|
writeout = (writeout)||(m_core->v__DOT__wb_stb);
|
writeout = (writeout)||(m_core->v__DOT____Vcellinp__genbus____pinNumber9);
|
writeout = (writeout)||(m_core->v__DOT__wb_err);
|
writeout = (writeout)||(m_core->v__DOT__wb_stb);
|
|
writeout = (writeout)||(m_core->v__DOT__wb_err);
|
|
*/
|
|
|
if ((writeout)||(m_last_writeout)) {
|
if ((writeout)||(m_last_writeout)) {
|
printf("%08lx:", m_tickcount);
|
printf("%08lx:", m_tickcount);
|
|
|
/*
|
/*
|
Line 191... |
Line 195... |
(m_core->v__DOT____Vcellinp__genbus____pinNumber9)?'a':' ',
|
(m_core->v__DOT____Vcellinp__genbus____pinNumber9)?'a':' ',
|
(m_core->v__DOT__dwb_stall)?'S':
|
(m_core->v__DOT__dwb_stall)?'S':
|
(m_core->v__DOT____Vcellinp__genbus____pinNumber10)?'s':' ',
|
(m_core->v__DOT____Vcellinp__genbus____pinNumber10)?'s':' ',
|
(m_core->v__DOT__wb_err)?'E':'.');
|
(m_core->v__DOT__wb_err)?'E':'.');
|
|
|
/*
|
printf(" RUNWB %d@0x%08x %3x %3x %d %d/%d %d:%09lx",
|
printf(" RUNWB %d@0x%08x %3x %3x %d %d/%d %d:%09lx",
|
m_core->v__DOT__genbus__DOT__runwb__DOT__wb_state,
|
m_core->v__DOT__genbus__DOT__runwb__DOT__wb_state,
|
m_core->v__DOT__wbu_addr,
|
m_core->v__DOT__wbu_addr,
|
m_core->v__DOT__genbus__DOT__runwb__DOT__r_len,
|
m_core->v__DOT__genbus__DOT__runwb__DOT__r_len,
|
m_core->v__DOT__genbus__DOT__runwb__DOT__r_acks_needed,
|
m_core->v__DOT__genbus__DOT__runwb__DOT__r_acks_needed,
|
m_core->v__DOT__genbus__DOT__runwb__DOT__w_eow,
|
m_core->v__DOT__genbus__DOT__runwb__DOT__w_eow,
|
m_core->v__DOT__genbus__DOT__runwb__DOT__last_ack,
|
m_core->v__DOT__genbus__DOT__runwb__DOT__last_ack,
|
m_core->v__DOT__genbus__DOT__runwb__DOT__zero_acks,
|
m_core->v__DOT__genbus__DOT__runwb__DOT__zero_acks,
|
m_core->v__DOT__genbus__DOT__exec_stb,
|
m_core->v__DOT__genbus__DOT__exec_stb,
|
m_core->v__DOT__genbus__DOT__exec_word);
|
m_core->v__DOT__genbus__DOT__exec_word);
|
|
*/
|
|
|
|
/*
|
/*
|
printf("%c[%d%d%d%d,%d:%04x%c]@%06x(%d) ->%06x%c",
|
printf("%c[%d%d%d%d,%d:%04x%c]@%06x(%d) ->%06x%c",
|
(m_core->v__DOT__sdram_sel)?'!':' ',
|
(m_core->v__DOT__sdram_sel)?'!':' ',
|
m_core->o_ram_cs_n, m_core->o_ram_ras_n,
|
m_core->o_ram_cs_n, m_core->o_ram_ras_n,
|
Line 245... |
Line 247... |
:(m_core->v__DOT__sdram_data),
|
:(m_core->v__DOT__sdram_data),
|
(m_core->v__DOT__sdram__DOT__r_addr));
|
(m_core->v__DOT__sdram__DOT__r_addr));
|
*/
|
*/
|
|
|
/*
|
/*
|
printf("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%2x %s%s %2d %2d",
|
printf("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%2x %s%s %2d %2d",
|
// (m_core->v__DOT__zippy__DOT__dbg_ack)?"A":"-",
|
// (m_core->v__DOT__zippy__DOT__dbg_ack)?"A":"-",
|
// (m_core->v__DOT__zippy__DOT__dbg_stall)?"S":"-",
|
// (m_core->v__DOT__zippy__DOT__dbg_stall)?"S":"-",
|
// (m_core->v__DOT__zippy__DOT__sys_dbg_cyc)?"D":"-",
|
// (m_core->v__DOT__zippy__DOT__sys_dbg_cyc)?"D":"-",
|
(m_core->v__DOT__zippy__DOT__cpu_lcl_cyc)?"L":"-",
|
(m_core->v__DOT__zippy__DOT__cpu_lcl_cyc)?"L":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__r_halted)?"Z":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__r_halted)?"Z":"-",
|
Line 260... |
Line 262... |
(m_core->v__DOT__zippy__DOT__thecpu__DOT__mem_cyc_lcl)?"L":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__mem_cyc_lcl)?"L":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__r_dcdvalid)?"D":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__r_dcdvalid)?"D":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__dcd_ce)?"d":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__dcd_ce)?"d":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__opvalid)?"O":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__opvalid)?"O":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__op_ce)?"k":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__op_ce)?"k":"-",
|
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__opvalid_alu)?"A":"-",
|
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__alu_ce)?"a":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__opvalid_mem)?"M":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__opvalid_mem)?"M":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__mem_ce)?"m":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__mem_ce)?"m":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__new_pc)?"N":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__new_pc)?"N":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__clear_pipeline)?"C":"-",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__clear_pipeline)?"C":"-",
|
(m_core->v__DOT__zippy__DOT__cmd_addr),
|
(m_core->v__DOT__zippy__DOT__cmd_addr),
|
Line 278... |
Line 282... |
m_core->v__DOT__zippy__DOT__thecpu__DOT__upc,
|
m_core->v__DOT__zippy__DOT__thecpu__DOT__upc,
|
m_core->v__DOT__zippy__DOT__thecpu__DOT__instruction,
|
m_core->v__DOT__zippy__DOT__thecpu__DOT__instruction,
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__instruction_decoder__DOT__genblk3__DOT__r_early_branch)?"EB":" ",
|
(m_core->v__DOT__zippy__DOT__thecpu__DOT__instruction_decoder__DOT__genblk3__DOT__r_early_branch)?"EB":" ",
|
m_core->v__DOT__zippy__DOT__thecpu__DOT__instruction_decoder__DOT__genblk3__DOT__r_branch_pc
|
m_core->v__DOT__zippy__DOT__thecpu__DOT__instruction_decoder__DOT__genblk3__DOT__r_branch_pc
|
);
|
);
|
|
|
|
printf(" %s[%02x]=%08x(%08x)",
|
|
m_core->v__DOT__zippy__DOT__thecpu__DOT__wr_reg_ce?"WR":"--",
|
|
m_core->v__DOT__zippy__DOT__thecpu__DOT__wr_reg_id,
|
|
m_core->v__DOT__zippy__DOT__thecpu__DOT__wr_gpreg_vl,
|
|
m_core->v__DOT__zippy__DOT__thecpu__DOT__wr_spreg_vl);
|
*/
|
*/
|
|
|
|
|
/*
|
/*
|
printf("SDSPI[%d,%d(%d),(%d)] ",
|
printf("SDSPI[%d,%d(%d),(%d)] ",
|
m_core->v__DOT__sdcard_controller__DOT__r_cmd_busy,
|
m_core->v__DOT__sdcard_controller__DOT__r_cmd_busy,
|
m_core->v__DOT__sdcard_controller__DOT__r_sdspi_clk,
|
m_core->v__DOT__sdcard_controller__DOT__r_sdspi_clk,
|
m_core->v__DOT__sdcard_controller__DOT__r_cmd_state,
|
m_core->v__DOT__sdcard_controller__DOT__r_cmd_state,
|
Line 299... |
Line 310... |
m_core->v__DOT__sdcard_controller__DOT__lowlevel__DOT__r_byte,
|
m_core->v__DOT__sdcard_controller__DOT__lowlevel__DOT__r_byte,
|
m_core->v__DOT__sdcard_controller__DOT__lowlevel__DOT__r_ireg,
|
m_core->v__DOT__sdcard_controller__DOT__lowlevel__DOT__r_ireg,
|
m_core->v__DOT__sdcard_controller__DOT__ll_out_stb,
|
m_core->v__DOT__sdcard_controller__DOT__ll_out_stb,
|
m_core->v__DOT__sdcard_controller__DOT__ll_out_dat
|
m_core->v__DOT__sdcard_controller__DOT__ll_out_dat
|
);
|
);
|
printf(" CRC=%02x/%d",
|
printf(" CRC=%02x/%2d",
|
m_core->v__DOT__sdcard_controller__DOT__r_cmd_crc,
|
m_core->v__DOT__sdcard_controller__DOT__r_cmd_crc,
|
m_core->v__DOT__sdcard_controller__DOT__r_cmd_crc_cnt);
|
m_core->v__DOT__sdcard_controller__DOT__r_cmd_crc_cnt);
|
printf(" SPI(%d,%d,%d/%d,%d)->?",
|
printf(" SPI(%d,%d,%d/%d,%d)->?",
|
m_core->o_sf_cs_n,
|
m_core->o_sf_cs_n,
|
m_core->o_sd_cs_n,
|
m_core->o_sd_cs_n,
|
m_core->o_spi_sck, m_core->v__DOT__sdcard_sck,
|
m_core->o_spi_sck, m_core->v__DOT__sdcard_sck,
|
m_core->o_spi_mosi);
|
m_core->o_spi_mosi);
|
*/
|
|
|
|
/*
|
|
printf(" CK=%d,LN=%d",
|
printf(" CK=%d,LN=%d",
|
m_core->v__DOT__sdcard_controller__DOT__r_sdspi_clk,
|
m_core->v__DOT__sdcard_controller__DOT__r_sdspi_clk,
|
m_core->v__DOT__sdcard_controller__DOT__r_lgblklen);
|
m_core->v__DOT__sdcard_controller__DOT__r_lgblklen);
|
*/
|
|
|
|
/*
|
|
if (m_core->v__DOT__sdcard_controller__DOT__r_use_fifo){
|
if (m_core->v__DOT__sdcard_controller__DOT__r_use_fifo){
|
printf(" FIFO");
|
printf(" FIFO");
|
if (m_core->v__DOT__sdcard_controller__DOT__r_fifo_wr)
|
if (m_core->v__DOT__sdcard_controller__DOT__r_fifo_wr)
|
printf("-WR");
|
printf("-WR(%04x,%d,%d,%d)",
|
|
m_core->v__DOT__sdcard_controller__DOT__fifo_rd_crc_reg,
|
|
m_core->v__DOT__sdcard_controller__DOT__fifo_rd_crc_stb,
|
|
m_core->v__DOT__sdcard_controller__DOT__ll_fifo_pkt_state,
|
|
m_core->v__DOT__sdcard_controller__DOT__r_have_data_response_token);
|
else
|
else
|
printf("-RD");
|
printf("-RD(%04x,%d,%d,%d)",
|
|
m_core->v__DOT__sdcard_controller__DOT__fifo_wr_crc_reg,
|
|
m_core->v__DOT__sdcard_controller__DOT__fifo_wr_crc_stb,
|
|
m_core->v__DOT__sdcard_controller__DOT__ll_fifo_wr_state,
|
|
m_core->v__DOT__sdcard_controller__DOT__ll_fifo_wr_complete
|
|
);
|
}
|
}
|
|
|
if (m_core->v__DOT__sdcard_controller__DOT__ll_fifo_rd)
|
if (m_core->v__DOT__sdcard_controller__DOT__ll_fifo_rd)
|
printf(" LL-RD");
|
printf(" LL-RD");
|
if (m_core->v__DOT__sdcard_controller__DOT__ll_fifo_wr)
|
if (m_core->v__DOT__sdcard_controller__DOT__ll_fifo_wr)
|
printf(" LL-WR");
|
printf(" LL-WR");
|
if (m_core->v__DOT__sdcard_controller__DOT__r_have_start_token)
|
if (m_core->v__DOT__sdcard_controller__DOT__r_have_start_token)
|
printf(" START-TOK");
|
printf(" START-TOK");
|
printf(" %3d", m_core->v__DOT__sdcard_controller__DOT__ll_fifo_addr);
|
printf(" %3d/%02x",
|
|
m_core->v__DOT__sdcard_controller__DOT__ll_fifo_addr,
|
|
m_core->v__DOT__sdcard_controller__DOT__fifo_byte&0x0ff);
|
*/
|
*/
|
|
|
|
|
/*
|
/*
|
printf(" DMAC[%d]: %08x/%08x/%08x(%03x) -- (%d,%d,%c)%c%c:@%08x-[%4d,%4d/%4d,%4d-#%4d]%08x",
|
printf(" DMAC[%d]: %08x/%08x/%08x(%03x) -- (%d,%d,%c)%c%c:@%08x-[%4d,%4d/%4d,%4d-#%4d]%08x",
|
m_core->v__DOT__zippy__DOT__dma_controller__DOT__dma_state,
|
m_core->v__DOT__zippy__DOT__dma_controller__DOT__dma_state,
|
m_core->v__DOT__zippy__DOT__dma_controller__DOT__cfg_waddr,
|
m_core->v__DOT__zippy__DOT__dma_controller__DOT__cfg_waddr,
|
m_core->v__DOT__zippy__DOT__dma_controller__DOT__cfg_raddr,
|
m_core->v__DOT__zippy__DOT__dma_controller__DOT__cfg_raddr,
|
Line 385... |
Line 405... |
tb = new BUSMASTER_TB;
|
tb = new BUSMASTER_TB;
|
|
|
// signal(SIGINT, busmaster_kill);
|
// signal(SIGINT, busmaster_kill);
|
|
|
tb->reset();
|
tb->reset();
|
|
if (argc > 1)
|
|
tb->setsdcard(argv[1]);
|
|
else
|
tb->setsdcard("/dev/zero");
|
tb->setsdcard("/dev/zero");
|
|
|
while(1)
|
while(1)
|
tb->tick();
|
tb->tick();
|
|
|