Line 19... |
Line 19... |
/* You should have received a copy of the GNU Lesser General Public License */
|
/* You should have received a copy of the GNU Lesser General Public License */
|
/* along with this source; if not, write to the Free Software Foundation, */
|
/* along with this source; if not, write to the Free Software Foundation, */
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
/* */
|
/* */
|
/*===========================================================================*/
|
/*===========================================================================*/
|
/* CPU OPERATING MODES */
|
/* CPU OPERATING MODES (FPGA VERSION) */
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
/* Test the CPU Operating modes: */
|
/* Test the CPU Operating modes: */
|
/* - CPUOFF (<=> R2[4]): turn off CPU. */
|
/* - CPUOFF (<=> R2[4]): turn off CPU. */
|
/* - OSCOFF (<=> R2[5]): turn off LFXT_CLK. */
|
/* - OSCOFF (<=> R2[5]): turn off LFXT_CLK. */
|
/* - SCG1 (<=> R2[7]): turn off SMCLK. */
|
/* - SCG1 (<=> R2[7]): turn off SMCLK. */
|
/* */
|
/* */
|
/* Author(s): */
|
/* Author(s): */
|
/* - Olivier Girard, olgirard@gmail.com */
|
/* - Olivier Girard, olgirard@gmail.com */
|
/* */
|
/* */
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
/* $Rev: 180 $ */
|
/* $Rev: 202 $ */
|
/* $LastChangedBy: olivier.girard $ */
|
/* $LastChangedBy: olivier.girard $ */
|
/* $LastChangedDate: 2013-02-25 22:23:18 +0100 (Mon, 25 Feb 2013) $ */
|
/* $LastChangedDate: 2015-07-01 23:13:32 +0200 (Wed, 01 Jul 2015) $ */
|
/*===========================================================================*/
|
/*===========================================================================*/
|
|
|
integer smclk_cnt;
|
integer smclk_cnt;
|
always @(negedge mclk)
|
always @(negedge mclk)
|
if (smclk_en) smclk_cnt <= smclk_cnt+1;
|
if (smclk_en) smclk_cnt <= smclk_cnt+1;
|
Line 56... |
Line 56... |
$display(" ===============================================");
|
$display(" ===============================================");
|
repeat(5) @(posedge mclk);
|
repeat(5) @(posedge mclk);
|
stimulus_done = 0;
|
stimulus_done = 0;
|
|
|
`ifdef ASIC_CLOCKING
|
`ifdef ASIC_CLOCKING
|
$display(" ===============================================");
|
tb_skip_finish("| (this test is not supported in ASIC mode) |");
|
$display("| SIMULATION SKIPPED |");
|
|
$display("| (this test is not supported in ASIC mode) |");
|
|
$display(" ===============================================");
|
|
$finish;
|
|
`else
|
`else
|
|
|
// SCG1 (<=> R2[7]): turn off SMCLK
|
// SCG1 (<=> R2[7]): turn off SMCLK
|
//--------------------------------------------------------
|
//--------------------------------------------------------
|
|
|
Line 133... |
Line 129... |
|
|
@(r15==16'h2005);
|
@(r15==16'h2005);
|
aclk_cnt = 0;
|
aclk_cnt = 0;
|
smclk_cnt = 0;
|
smclk_cnt = 0;
|
repeat (104) @(posedge mclk);
|
repeat (104) @(posedge mclk);
|
if (aclk_cnt !== 16'h0004) tb_error("====== OSCOFF TEST 5: ACLK IS NOT RUNNING =====");
|
if (aclk_cnt !== 16'h0000) tb_error("====== OSCOFF TEST 5: ACLK IS NOT STOPPED =====");
|
if (smclk_cnt !== 16'h0004) tb_error("====== OSCOFF TEST 5: SMCLK IS NOT RUNNING ON LFXT1 =====");
|
if (smclk_cnt !== 16'h0000) tb_error("====== OSCOFF TEST 5: SMCLK IS NOT STOPPED =====");
|
|
|
@(r15==16'h2006);
|
@(r15==16'h2006);
|
aclk_cnt = 0;
|
aclk_cnt = 0;
|
smclk_cnt = 0;
|
smclk_cnt = 0;
|
repeat (104) @(posedge mclk);
|
repeat (104) @(posedge mclk);
|
Line 189... |
Line 185... |
@(negedge mclk);
|
@(negedge mclk);
|
inst_cnt = 0;
|
inst_cnt = 0;
|
repeat (80) @(negedge mclk);
|
repeat (80) @(negedge mclk);
|
if (inst_cnt <= 16'h0030) tb_error("====== CPUOFF TEST 6: CPU IS NOT RUNNING =====");
|
if (inst_cnt <= 16'h0030) tb_error("====== CPUOFF TEST 6: CPU IS NOT RUNNING =====");
|
|
|
|
// DMA_SCG1
|
|
//--------------------------------------------------------
|
|
`ifdef DMA_IF_EN
|
|
@(r15==16'h4001);
|
|
dma_en = 1'b1;
|
|
aclk_cnt = 0;
|
|
smclk_cnt = 0;
|
|
repeat (104) @(posedge mclk);
|
|
dma_en = 1'b0;
|
|
if (aclk_cnt !== 16'h0004) tb_error("====== DMA_SCG1 TEST 1: ACLK IS NOT RUNNING =====");
|
|
if (smclk_cnt !== 16'h0000) tb_error("====== DMA_SCG1 TEST 1: SMCLK IS RUNNING =====");
|
|
|
|
@(r15==16'h4002);
|
|
dma_en = 1'b1;
|
|
aclk_cnt = 0;
|
|
smclk_cnt = 0;
|
|
repeat (104) @(posedge mclk);
|
|
dma_en = 1'b0;
|
|
if (aclk_cnt !== 16'h0003) tb_error("====== DMA_SCG1 TEST 2: ACLK IS NOT RUNNING =====");
|
|
if (smclk_cnt !== 16'h0000) tb_error("====== DMA_SCG1 TEST 2: SMCLK IS RUNNING =====");
|
|
|
|
@(r15==16'h4003);
|
|
dma_en = 1'b1;
|
|
aclk_cnt = 0;
|
|
smclk_cnt = 0;
|
|
repeat (104) @(posedge mclk);
|
|
dma_en = 1'b0;
|
|
if (aclk_cnt !== 16'h0003) tb_error("====== DMA_SCG1 TEST 3: ACLK IS NOT RUNNING =====");
|
|
if (smclk_cnt !== 16'h000D) tb_error("====== DMA_SCG1 TEST 3: SMCLK IS NOT RUNNING =====");
|
|
|
|
@(r15==16'h4004);
|
|
dma_en = 1'b1;
|
|
aclk_cnt = 0;
|
|
smclk_cnt = 0;
|
|
repeat (104) @(posedge mclk);
|
|
dma_en = 1'b0;
|
|
if (aclk_cnt !== 16'h0004) tb_error("====== DMA_SCG1 TEST 4: ACLK IS NOT RUNNING =====");
|
|
if (smclk_cnt !== 16'h000D) tb_error("====== DMA_SCG1 TEST 4: SMCLK IS NOT RUNNING =====");
|
|
|
|
@(r15==16'h4005);
|
|
dma_en = 1'b1;
|
|
aclk_cnt = 0;
|
|
smclk_cnt = 0;
|
|
repeat (104) @(posedge mclk);
|
|
dma_en = 1'b0;
|
|
if (aclk_cnt !== 16'h0003) tb_error("====== DMA_SCG1 TEST 5: ACLK IS NOT RUNNING =====");
|
|
if (smclk_cnt !== 16'h0000) tb_error("====== DMA_SCG1 TEST 5: SMCLK IS RUNNING =====");
|
|
|
|
@(r15==16'h4006);
|
|
dma_en = 1'b1;
|
|
aclk_cnt = 0;
|
|
smclk_cnt = 0;
|
|
repeat (104) @(posedge mclk);
|
|
dma_en = 1'b0;
|
|
if (aclk_cnt !== 16'h0003) tb_error("====== DMA_SCG1 TEST 6: ACLK IS NOT RUNNING =====");
|
|
if (smclk_cnt !== 16'h000D) tb_error("====== DMA_SCG1 TEST 6: SMCLK IS NOT RUNNING =====");
|
|
`endif
|
|
|
|
@(r15==16'h5000);
|
|
|
|
// DMA_OSCOFF
|
|
//--------------------------------------------------------
|
|
`ifdef DMA_IF_EN
|
|
@(r15==16'h5001);
|
|
dma_en = 1'b1;
|
|
aclk_cnt = 0;
|
|
smclk_cnt = 0;
|
|
repeat (104) @(posedge mclk);
|
|
dma_en = 1'b0;
|
|
if (aclk_cnt !== 16'h0000) tb_error("====== DMA_OSCOFF TEST 1: ACLK IS RUNNING =====");
|
|
if (smclk_cnt !== 16'h000D) tb_error("====== DMA_OSCOFF TEST 1: SMCLK IS RUNNING =====");
|
|
|
|
@(r15==16'h5002);
|
|
dma_en = 1'b1;
|
|
aclk_cnt = 0;
|
|
smclk_cnt = 0;
|
|
repeat (104) @(posedge mclk);
|
|
dma_en = 1'b0;
|
|
if (aclk_cnt !== 16'h0004) tb_error("====== DMA_OSCOFF TEST 2: ACLK IS NOT RUNNING =====");
|
|
if (smclk_cnt !== 16'h000D) tb_error("====== DMA_OSCOFF TEST 2: SMCLK IS NOT RUNNING =====");
|
|
|
|
@(r15==16'h5003);
|
|
dma_en = 1'b1;
|
|
aclk_cnt = 0;
|
|
smclk_cnt = 0;
|
|
repeat (104) @(posedge mclk);
|
|
dma_en = 1'b0;
|
|
if (aclk_cnt !== 16'h0000) tb_error("====== DMA_OSCOFF TEST 3: ACLK IS RUNNING =====");
|
|
if (smclk_cnt !== 16'h000D) tb_error("====== DMA_OSCOFF TEST 3: SMCLK IS NOT RUNNING =====");
|
|
|
|
@(r15==16'h5004);
|
|
dma_en = 1'b1;
|
|
aclk_cnt = 0;
|
|
smclk_cnt = 0;
|
|
repeat (104) @(posedge mclk);
|
|
dma_en = 1'b0;
|
|
if (aclk_cnt !== 16'h0003) tb_error("====== DMA_OSCOFF TEST 4: ACLK IS NOT RUNNING =====");
|
|
if (smclk_cnt !== 16'h000D) tb_error("====== DMA_OSCOFF TEST 4: SMCLK IS NOT RUNNING =====");
|
|
|
|
@(r15==16'h5005);
|
|
dma_en = 1'b1;
|
|
aclk_cnt = 0;
|
|
smclk_cnt = 0;
|
|
repeat (104) @(posedge mclk);
|
|
dma_en = 1'b0;
|
|
if (aclk_cnt !== 16'h0000) tb_error("====== DMA_OSCOFF TEST 5: ACLK IS RUNNING =====");
|
|
if (smclk_cnt !== 16'h000D) tb_error("====== DMA_OSCOFF TEST 5: SMCLK IS NOT RUNNING =====");
|
|
|
|
@(r15==16'h5006);
|
|
dma_en = 1'b1;
|
|
aclk_cnt = 0;
|
|
smclk_cnt = 0;
|
|
repeat (104) @(posedge mclk);
|
|
dma_en = 1'b0;
|
|
if (aclk_cnt !== 16'h0003) tb_error("====== DMA_OSCOFF TEST 6: ACLK IS NOT RUNNING =====");
|
|
if (smclk_cnt !== 16'h000D) tb_error("====== DMA_OSCOFF TEST 6: SMCLK IS NOT RUNNING =====");
|
|
`endif
|
|
|
|
@(r15==16'h6000);
|
`endif
|
`endif
|
|
|
stimulus_done = 1;
|
stimulus_done = 1;
|
end
|
end
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|