-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Bender: Align to latest Cheshire revision with peripherals clk gating - SW: Add testbench to check peripherals clk gating
- Loading branch information
Showing
4 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2024 ETH Zurich and University of Bologna. | ||
// Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// Lorenzo Leone <lleone@iis.ee.ethz.ch> | ||
// | ||
// This test aims to check if the clock gating registers | ||
// inside Cheshire can be correctly driven from Chimera. | ||
// The test is not automated; each peripheral's clock | ||
// signal must be manually checked by looking at the waveforms. | ||
|
||
#include <stdint.h> | ||
#include "regs/cheshire.h" | ||
|
||
#define CHESHIRE_REGS_BASE 0x03000000 | ||
|
||
int main() { | ||
volatile uint32_t *regPtr = 0; | ||
uint8_t expVal; | ||
|
||
regPtr = | ||
(volatile uint32_t *)(CHESHIRE_REGS_BASE + CHESHIRE_CLK_GATE_EN_PERIPHERALS_REG_OFFSET); | ||
|
||
// |------------------------------| | ||
// | READ RST VALUE | | ||
// |------------------------------| | ||
if (*regPtr != 0) return 1; | ||
|
||
// |------------------------------| | ||
// | ENABLE CLK GATE | | ||
// |------------------------------| | ||
expVal = 0x00007F; | ||
*regPtr |= expVal; | ||
if (*regPtr ^ expVal) return 2; | ||
|
||
// |------------------------------| | ||
// | DISABLE CLK GATE | | ||
// |------------------------------| | ||
expVal = 0x0000; | ||
*regPtr &= expVal; | ||
if (*regPtr ^ expVal) return 3; | ||
|
||
return 0; | ||
} |