Skip to content

Commit

Permalink
chore(deps): upgrade prettier
Browse files Browse the repository at this point in the history
reformat all code with the new prettier version
  • Loading branch information
urish committed Feb 11, 2025
1 parent a2dd0c2 commit 9ce22e4
Show file tree
Hide file tree
Showing 17 changed files with 160 additions and 66 deletions.
4 changes: 2 additions & 2 deletions benchmark/benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function createBenchmark(benchmarkName: string): Benchmark {
// As a sanity if duration_ms is 0 just double the count.
profile.iterationCount << 1,
// Otherwise try to guess how many iterations we have to do to get the right time.
Math.round((MIN_SAMPLE_DURATION / durationMs) * profile.iterationCount)
Math.round((MIN_SAMPLE_DURATION / durationMs) * profile.iterationCount),
);
profile.noImprovementCount = 0;
runAgain = true;
Expand Down Expand Up @@ -120,7 +120,7 @@ export function createBenchmark(benchmarkName: string): Benchmark {
const percent = (100 - (profile.bestTime / fastest.bestTime) * 100).toFixed(0);
return ' ' + profile.profileName + ': ' + time + ' ' + unit + '(' + percent + '%)';
})
.join('\n')}`
.join('\n')}`,
);
};
return benchmark;
Expand Down
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
5 changes: 4 additions & 1 deletion demo/src/cpu-performance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ export class CPUPerformance {
private samples = new Float32Array(64);
private sampleIndex = 0;

constructor(private cpu: CPU, private MHZ: number) {}
constructor(
private cpu: CPU,
private MHZ: number,
) {}

reset() {
this.prevTime = 0;
Expand Down
148 changes: 106 additions & 42 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,17 @@
],
"devDependencies": {
"@types/node": "^18.0.0",
"@types/prettier": "^2.3.2",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"@wokwi/elements": "^0.16.2",
"acorn": "^7.3.1",
"eslint": "^8.31.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.1.3",
"husky": "^6.0.0",
"lint-staged": "^9.5.0",
"prettier": "^2.3.2",
"prettier": "^3.5.0",
"rimraf": "^3.0.2",
"tsx": "^4.19.2",
"typescript": "^4.9.4",
Expand Down
5 changes: 4 additions & 1 deletion src/cpu/cpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ export class CPU {
nextInterrupt: i16 = -1;
maxInterrupt: i16 = 0;

constructor(public progMem: Uint16Array, private sramBytes = 8192) {
constructor(
public progMem: Uint16Array,
private sramBytes = 8192,
) {
this.reset();
}

Expand Down
8 changes: 4 additions & 4 deletions src/cpu/instruction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export function avrInstruction(cpu: CPU) {
cpu.cycles++;
cpu.data[(opcode & 0x1f0) >> 4] = cpu.readData(
cpu.dataView.getUint16(28, true) +
((opcode & 7) | ((opcode & 0xc00) >> 7) | ((opcode & 0x2000) >> 8))
((opcode & 7) | ((opcode & 0xc00) >> 7) | ((opcode & 0x2000) >> 8)),
);
} else if ((opcode & 0xfe0f) === 0x8000) {
/* LDZ, 1000 000d dddd 0000 */
Expand All @@ -419,7 +419,7 @@ export function avrInstruction(cpu: CPU) {
cpu.cycles++;
cpu.data[(opcode & 0x1f0) >> 4] = cpu.readData(
cpu.dataView.getUint16(30, true) +
((opcode & 7) | ((opcode & 0xc00) >> 7) | ((opcode & 0x2000) >> 8))
((opcode & 7) | ((opcode & 0xc00) >> 7) | ((opcode & 0x2000) >> 8)),
);
} else if (opcode === 0x95c8) {
/* LPM, 1001 0101 1100 1000 */
Expand Down Expand Up @@ -716,7 +716,7 @@ export function avrInstruction(cpu: CPU) {
cpu.writeData(
cpu.dataView.getUint16(28, true) +
((opcode & 7) | ((opcode & 0xc00) >> 7) | ((opcode & 0x2000) >> 8)),
cpu.data[(opcode & 0x1f0) >> 4]
cpu.data[(opcode & 0x1f0) >> 4],
);
cpu.cycles++;
} else if ((opcode & 0xfe0f) === 0x8200) {
Expand Down Expand Up @@ -744,7 +744,7 @@ export function avrInstruction(cpu: CPU) {
cpu.writeData(
cpu.dataView.getUint16(30, true) +
((opcode & 7) | ((opcode & 0xc00) >> 7) | ((opcode & 0x2000) >> 8)),
cpu.data[(opcode & 0x1f0) >> 4]
cpu.data[(opcode & 0x1f0) >> 4],
);
cpu.cycles++;
} else if ((opcode & 0xfc00) === 0x1800) {
Expand Down
5 changes: 4 additions & 1 deletion src/peripherals/adc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ export class AVRADC {
enableMask: ADIE,
};

constructor(private cpu: CPU, private config: ADCConfig) {
constructor(
private cpu: CPU,
private config: ADCConfig,
) {
cpu.writeHooks[config.ADCSRA] = (value, oldValue) => {
if (value & ADEN && !(oldValue && ADEN)) {
this.conversionCycles = 25;
Expand Down
2 changes: 1 addition & 1 deletion src/peripherals/clock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class AVRClock {
constructor(
private cpu: CPU,
private baseFreqHz: u32,
private config: AVRClockConfig = clockConfig
private config: AVRClockConfig = clockConfig,
) {
this.cpu.writeHooks[this.config.CLKPR] = (clkpr) => {
if ((!this.clockEnabledCycles || this.clockEnabledCycles < cpu.cycles) && clkpr === CLKPCE) {
Expand Down
2 changes: 1 addition & 1 deletion src/peripherals/eeprom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class AVREEPROM {
constructor(
private cpu: CPU,
private backend: EEPROMBackend,
private config: AVREEPROMConfig = eepromConfig
private config: AVREEPROMConfig = eepromConfig,
) {
this.cpu.writeHooks[this.config.EECR] = (eecr) => {
const { EEARH, EEARL, EECR, EEDR } = this.config;
Expand Down
Loading

0 comments on commit 9ce22e4

Please sign in to comment.