mirror of
https://github.com/Ed94/perfaware.git
synced 2024-12-21 22:44:46 -08:00
Configured the project to begin working on part one.
This commit is contained in:
parent
5d3b099970
commit
a12ba641f1
19
.vscode/c_cpp_properties.json
vendored
Normal file
19
.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE",
|
||||
"_UNICODE"
|
||||
],
|
||||
"windowsSdkVersion": "10.0.22621.0",
|
||||
"compilerPath": "cl.exe",
|
||||
"compileCommands": "${workspaceFolder}/part_1/build/compile_commands.json"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"*.rmd": "markdown",
|
||||
"zpl.h": "c"
|
||||
}
|
||||
}
|
16
README.md
16
README.md
@ -1,2 +1,16 @@
|
||||
# perfaware
|
||||
Homework for Casey's Performance Aware Programming course
|
||||
Homework for Casey's [Performance Aware Programming course](https://www.computerenhance.com/p/table-of-contents)
|
||||
|
||||
[Material Source](https://github.com/cmuratori/computer_enhance)
|
||||
|
||||
Thirdparty Libraries:
|
||||
* [zpl](https://github.com/zpl-c) - Used instead of the C/C++ standard library.
|
||||
|
||||
Tools:
|
||||
* [scoop](https://scoop.sh) : Windows package manager
|
||||
* clang : C/C++ compiler
|
||||
```scoop install llvm```
|
||||
* meson : Build system
|
||||
```scoop install meson```
|
||||
* nasm : x86 Assembler
|
||||
```scoop install nasm```
|
||||
|
7
part_1/build.bat
Normal file
7
part_1/build.bat
Normal file
@ -0,0 +1,7 @@
|
||||
@echo off
|
||||
|
||||
if not exist build\nul (
|
||||
meson setup build
|
||||
)
|
||||
|
||||
ninja -C build
|
13
part_1/clean.bat
Normal file
13
part_1/clean.bat
Normal file
@ -0,0 +1,13 @@
|
||||
@echo off
|
||||
|
||||
if exist build\nul (
|
||||
@RD /S /Q "build"
|
||||
)
|
||||
|
||||
if exist tests\listing_0037_single_register_mov (
|
||||
DEL /Q tests\listing_0037_single_register_mov
|
||||
)
|
||||
|
||||
if exist tests\listing_0038_many_register_mov (
|
||||
DEL /Q tests\listing_0038_many_register_mov
|
||||
)
|
5
part_1/meson.build
Normal file
5
part_1/meson.build
Normal file
@ -0,0 +1,5 @@
|
||||
project( 'sim_8086', 'c', 'cpp' )
|
||||
|
||||
include_thirdparty = include_directories( '../thirdparty' )
|
||||
|
||||
executable( 'sim_8086', 'sim_8086.c', include_directories : include_thirdparty )
|
12
part_1/sim_8086.c
Normal file
12
part_1/sim_8086.c
Normal file
@ -0,0 +1,12 @@
|
||||
#define ZPL_IMPLEMENTATION
|
||||
#include "zpl.h"
|
||||
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
zpl_printf("sim 8086!");
|
||||
|
||||
return 0;
|
||||
}
|
8
part_1/test.bat
Normal file
8
part_1/test.bat
Normal file
@ -0,0 +1,8 @@
|
||||
@echo off
|
||||
|
||||
echo Assembling: listing_0037_single_register_mov.asm
|
||||
call nasm ".\tests\listing_0037_single_register_mov.asm"
|
||||
|
||||
|
||||
echo Assembling: listing_0038_many_register_mov.asm
|
||||
call nasm ".\tests\listing_0038_many_register_mov.asm"
|
19
part_1/tests/listing_0037_single_register_mov.asm
Normal file
19
part_1/tests/listing_0037_single_register_mov.asm
Normal file
@ -0,0 +1,19 @@
|
||||
; ========================================================================
|
||||
;
|
||||
; (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved.
|
||||
;
|
||||
; This software is provided 'as-is', without any express or implied
|
||||
; warranty. In no event will the authors be held liable for any damages
|
||||
; arising from the use of this software.
|
||||
;
|
||||
; Please see https://computerenhance.com for further information
|
||||
;
|
||||
; ======================================================================== */
|
||||
|
||||
; ========================================================================
|
||||
; LISTING 37
|
||||
; ========================================================================
|
||||
|
||||
bits 16
|
||||
|
||||
mov cx, bx
|
29
part_1/tests/listing_0038_many_register_mov.asm
Normal file
29
part_1/tests/listing_0038_many_register_mov.asm
Normal file
@ -0,0 +1,29 @@
|
||||
; ========================================================================
|
||||
;
|
||||
; (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved.
|
||||
;
|
||||
; This software is provided 'as-is', without any express or implied
|
||||
; warranty. In no event will the authors be held liable for any damages
|
||||
; arising from the use of this software.
|
||||
;
|
||||
; Please see https://computerenhance.com for further information
|
||||
;
|
||||
; ======================================================================== */
|
||||
|
||||
; ========================================================================
|
||||
; LISTING 38
|
||||
; ========================================================================
|
||||
|
||||
bits 16
|
||||
|
||||
mov cx, bx
|
||||
mov ch, ah
|
||||
mov dx, bx
|
||||
mov si, bx
|
||||
mov bx, di
|
||||
mov al, cl
|
||||
mov ch, ch
|
||||
mov bx, ax
|
||||
mov bx, si
|
||||
mov sp, di
|
||||
mov bp, ax
|
58
perfaware.10x
Normal file
58
perfaware.10x
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0"?>
|
||||
<N10X>
|
||||
<Workspace>
|
||||
<IncludeFilter>*.*,</IncludeFilter>
|
||||
<ExcludeFilter>*.obj,*.lib,*.pch,*.dll,*.pdb,.vs,Debug,Release,x64,obj,*.user,Intermediate,</ExcludeFilter>
|
||||
<SyncFiles>true</SyncFiles>
|
||||
<Recursive>true</Recursive>
|
||||
<ShowEmptyFolders>true</ShowEmptyFolders>
|
||||
<IsVirtual>false</IsVirtual>
|
||||
<IsFolder>false</IsFolder>
|
||||
<BuildCommand>.\build.bat</BuildCommand>
|
||||
<RebuildCommand></RebuildCommand>
|
||||
<BuildFileCommand></BuildFileCommand>
|
||||
<CleanCommand>.\clean.bat</CleanCommand>
|
||||
<BuildWorkingDirectory>.\part_1</BuildWorkingDirectory>
|
||||
<CancelBuild></CancelBuild>
|
||||
<RunCommand>part_1/build/sim_8086.exe</RunCommand>
|
||||
<DebugCommand>part_1/build/sim_8086.exe</DebugCommand>
|
||||
<ExePathCommand>part_1/build/sim_8086.exe</ExePathCommand>
|
||||
<DebugSln></DebugSln>
|
||||
<UseVisualStudioEnvBat>false</UseVisualStudioEnvBat>
|
||||
<Configurations>
|
||||
<Configuration>Debug</Configuration>
|
||||
<Configuration>Release</Configuration>
|
||||
</Configurations>
|
||||
<Platforms>
|
||||
<Platform>x64</Platform>
|
||||
</Platforms>
|
||||
<AdditionalIncludePaths>
|
||||
<AdditionalIncludePath>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.35.32215\include</AdditionalIncludePath>
|
||||
<AdditionalIncludePath>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.35.32215\ATLMFC\include</AdditionalIncludePath>
|
||||
<AdditionalIncludePath>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\VS\include</AdditionalIncludePath>
|
||||
<AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt</AdditionalIncludePath>
|
||||
<AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um</AdditionalIncludePath>
|
||||
<AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared</AdditionalIncludePath>
|
||||
<AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt</AdditionalIncludePath>
|
||||
<AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt</AdditionalIncludePath>
|
||||
<AdditionalIncludePath>C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um</AdditionalIncludePath>
|
||||
</AdditionalIncludePaths>
|
||||
<Defines></Defines>
|
||||
<ConfigProperties>
|
||||
<ConfigAndPlatform>
|
||||
<Name>Debug:x64</Name>
|
||||
<Defines></Defines>
|
||||
<ForceIncludes></ForceIncludes>
|
||||
</ConfigAndPlatform>
|
||||
<Config>
|
||||
<Name>Debug</Name>
|
||||
<Defines></Defines>
|
||||
</Config>
|
||||
<Platform>
|
||||
<Name>x64</Name>
|
||||
<Defines></Defines>
|
||||
</Platform>
|
||||
</ConfigProperties>
|
||||
<Children></Children>
|
||||
</Workspace>
|
||||
</N10X>
|
100
thirdparty/.clang-format
vendored
Normal file
100
thirdparty/.clang-format
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
# Format Style Options - Created with Clang Power Tools
|
||||
---
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: BlockIndent
|
||||
AlignArrayOfStructures: Right
|
||||
AlignConsecutiveAssignments:
|
||||
Enabled: true
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: true
|
||||
AlignCompound: true
|
||||
PadOperators: true
|
||||
AlignConsecutiveBitFields: AcrossComments
|
||||
AlignConsecutiveDeclarations: AcrossComments
|
||||
AlignConsecutiveMacros: AcrossComments
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: false
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortLambdasOnASingleLine: None
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BitFieldColonSpacing: Both
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakBeforeBraces: Allman
|
||||
BreakBeforeInheritanceComma: true
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeConceptDeclarations: true
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
ColumnLimit: 180
|
||||
CompactNamespaces: true
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth : 4
|
||||
ContinuationIndentWidth: 4
|
||||
DeriveLineEnding: true
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
IncludeBlocks: Preserve
|
||||
IndentCaseBlocks: true
|
||||
IndentCaseLabels: true
|
||||
IndentExternBlock: Indent
|
||||
IndentGotoLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentRequires: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
Language: Cpp
|
||||
NamespaceIndentation: All
|
||||
PointerAlignment: Left
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: true
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceAroundPointerQualifiers: After
|
||||
SpaceBeforeCaseColon: true
|
||||
SpaceBeforeCpp11BracedList: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyBlock: true
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesInAngles: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInConditionalStatement: true
|
||||
SpacesInParentheses: true
|
||||
SpacesInSquareBrackets: true
|
||||
Standard: c++17
|
||||
TabWidth: 4
|
||||
UseTab: ForIndentation
|
||||
...
|
82
thirdparty/format.ps1
vendored
Normal file
82
thirdparty/format.ps1
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
<#
|
||||
.DESCRIPTION
|
||||
Helper script to format all header and source files in the repository.
|
||||
By default, the script will recursively search under the repo root for
|
||||
files to format. Users can give explicit parameters indicating how the
|
||||
search should include and exclude filetypes.
|
||||
If users don't want the search functionality, they can instead provide
|
||||
an explicit list of files to format.
|
||||
.PARAMETER RepoRoot
|
||||
Full path to the root of the repository which is the target of the search.
|
||||
Will default to the root of the current working directory.
|
||||
.PARAMETER Include
|
||||
Array of filetype extensions to target for formatting.
|
||||
By default, targets standard extensions for header and source files.
|
||||
Follows the same rules as the -Include parameter for Get-ChildItem.
|
||||
.PARAMETER Exclude
|
||||
Array of filetype extensions to exclude from formatting.
|
||||
By default, excludes generated XAML files.
|
||||
Follows the same rules as the -Exclude paramter for Get-ChildItem.
|
||||
.PARAMETER Files
|
||||
Array of files to format. The script will exit if one of the provided
|
||||
filepaths does not exist.
|
||||
.EXAMPLE
|
||||
.\clang-format-all.ps1
|
||||
Formats all header and source files under the repository root.
|
||||
.EXAMPLE
|
||||
.\clang-format-all.ps1 -RepoRoot 'S:\repos\calculator' -Include '*.h', '*.cpp' -Exclude '*.g.*'
|
||||
Formats all *.h and *.cpp files under 'S:\repos\calculator', excluding files with an extension
|
||||
like *.g.*
|
||||
.EXAMPLE
|
||||
.\clang-format-all.ps1 -File 'S:\repos\calculator\src\CalcViewModel\UnitConverterViewModel.h', 'S:\repos\calculator\src\CalcViewModel\MemoryItemViewModel.cpp'
|
||||
Formats the specified files.
|
||||
#>
|
||||
[CmdletBinding( DefaultParameterSetName = 'Search' )]
|
||||
param(
|
||||
[Parameter( ParameterSetName = 'Search' )]
|
||||
[ValidateScript({ Test-Path -PathType Container -Path $_ })]
|
||||
[string] $RepoRoot = "$( (Get-Item .).FullName )/thirdparty",
|
||||
|
||||
[Parameter( ParameterSetName = 'Search' )]
|
||||
[string[]] $Include = ( '*.h', '*.hh', '*.hpp', '*.c', '*.cc', '*.cpp' ),
|
||||
|
||||
[Parameter( ParameterSetName = 'Search' )]
|
||||
[string[]] $Exclude = ( '*.g.*', "zpl.h" ),
|
||||
|
||||
[Parameter(
|
||||
ParameterSetName = 'Explicit',
|
||||
Mandatory)]
|
||||
[ValidateScript({
|
||||
$_ | Where-Object { -not (Test-Path -PathType Leaf -Path $_) } |
|
||||
ForEach-Object { throw "Could not find file: [$_]" }
|
||||
|
||||
return $true
|
||||
})]
|
||||
[string[]] $Files
|
||||
)
|
||||
|
||||
if ($PSCmdlet.ParameterSetName -eq 'Explicit')
|
||||
{
|
||||
# Use the file paths we were given.
|
||||
$targetFiles = @($Files)
|
||||
}
|
||||
else
|
||||
{
|
||||
# Gather the files to be formatted.
|
||||
$targetFiles = @(
|
||||
Get-ChildItem -Recurse -Path $RepoRoot -Include $Include -Exclude $Exclude |
|
||||
Select-Object -ExpandProperty FullName
|
||||
)
|
||||
}
|
||||
|
||||
# Format the files.
|
||||
$formatParams = @(
|
||||
'-i' # In-place
|
||||
'-style=file' # Search for a .clang-format file in the parent directory of the source file.
|
||||
'-verbose'
|
||||
)
|
||||
|
||||
if ( $targetFiles )
|
||||
{
|
||||
clang-format $formatParams $targetFiles
|
||||
}
|
18369
thirdparty/zpl.h
vendored
Normal file
18369
thirdparty/zpl.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user