Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions helper_scripts/generate_EmulatorConstants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ end

local out = io.stdout

out:write(' uint64 constant CM_MARCHID = ' .. cartesi.MARCHID .. ';\n')
out:write(' bytes32 constant UARCH_PRISTINE_STATE_HASH = 0x' .. hexstring(cartesi.UARCH_PRISTINE_STATE_HASH) .. ';\n')
out:write(' uint64 constant UARCH_CYCLE_ADDRESS = 0x' .. hex(cartesi.machine:get_reg_address("uarch_cycle")) .. ';\n')
out:write(' uint64 constant UARCH_CYCLE_MAX = 0x' .. hex(cartesi.UARCH_CYCLE_MAX) .. ';\n')
Expand Down
1 change: 1 addition & 0 deletions src/EmulatorConstants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pragma solidity ^0.8.30;
library EmulatorConstants {
// START OF AUTO-GENERATED CODE

uint64 constant CM_MARCHID = 21;
bytes32 constant UARCH_PRISTINE_STATE_HASH =
0x1187b59e3fe94897c23582998adb33d3df9e8c962f6d1696dfd91adcfabb3a23;
uint64 constant UARCH_CYCLE_ADDRESS = 0x400008;
Expand Down
26 changes: 26 additions & 0 deletions test/EmulatorConstants.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright Cartesi and individual authors (see AUTHORS)
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import {Test} from "forge-std/Test.sol";

import {EmulatorConstants} from "src/EmulatorConstants.sol";

pragma solidity ^0.8.30;

contract EmulatorConstantsTest is Test {
function testCmMarchId() public pure {
assertEq(EmulatorConstants.CM_MARCHID, 21);
}
}
Loading