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
|
---|---|---|---|---|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2351.asm | ljhsiun2/medusa | 9 | 169834 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x180bd, %r12
nop
nop
add $19283, %rbx
movups (%r12), %xmm2
vpextrq $0, %xmm2, %rsi
nop
nop
nop
add $44132, %rdi
lea addresses_D_ht+0xeb2d, %rsi
lea addresses_WC_ht+0x1578d, %rdi
nop
nop
nop
nop
xor $17664, %r11
mov $17, %rcx
rep movsl
nop
and $18478, %rsi
lea addresses_A_ht+0x126e1, %r12
nop
nop
add $32515, %rax
movb (%r12), %bl
sub %r12, %r12
lea addresses_D_ht+0xc75, %r12
xor %r11, %r11
movb (%r12), %bl
nop
nop
nop
nop
sub %rax, %rax
lea addresses_A_ht+0x15a0d, %rsi
lea addresses_A_ht+0x1cca1, %rdi
clflush (%rsi)
nop
nop
and $1763, %r11
mov $86, %rcx
rep movsl
add $32903, %rdi
lea addresses_D_ht+0x9add, %rsi
nop
sub $30356, %rcx
vmovups (%rsi), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %r11
nop
nop
sub $27924, %r11
lea addresses_A_ht+0xc7cc, %rdi
nop
nop
nop
nop
add $32101, %rsi
movb (%rdi), %bl
nop
xor $26442, %r11
lea addresses_WC_ht+0xc58d, %rax
nop
nop
nop
nop
xor $11044, %r12
mov (%rax), %rdi
nop
nop
nop
nop
nop
dec %r11
lea addresses_normal_ht+0x2c1d, %rbx
nop
and %r12, %r12
movb $0x61, (%rbx)
and %r12, %r12
lea addresses_UC_ht+0xc0d, %rcx
nop
nop
nop
nop
cmp %rsi, %rsi
mov (%rcx), %di
nop
nop
and %rax, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// Load
mov $0xec5, %rdi
xor %rcx, %rcx
mov (%rdi), %bx
nop
nop
nop
nop
nop
dec %rdi
// Store
lea addresses_WC+0x1a78d, %rbp
nop
nop
nop
sub %rsi, %rsi
movw $0x5152, (%rbp)
nop
dec %rbp
// Store
lea addresses_UC+0xcf8d, %rsi
nop
nop
sub $30946, %r15
movb $0x51, (%rsi)
nop
nop
nop
xor $60716, %rbp
// Faulty Load
lea addresses_normal+0x1cf8d, %r10
nop
nop
nop
nop
dec %rdi
movups (%r10), %xmm5
vpextrq $1, %xmm5, %rbp
lea oracles, %r10
and $0xff, %rbp
shlq $12, %rbp
mov (%r10,%rbp,1), %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'same': False, 'size': 2, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_P', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 2, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 1, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 4, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'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
*/
|
kernel/src/asm/startup.asm | avdgrinten/windozz | 1 | 162230 | <filename>kernel/src/asm/startup.asm<gh_stars>1-10
; The Windozz Project
; Copyright (C) 2018-2019 by the Windozz authors.
bits 64
KSTACK equ 131072
section .startup
; kernel entry from boot loader
global _start
_start:
cld
; clear the BSS
extern bss
extern bssend
mov rdi, bss
mov rcx, bssend
sub rcx, rdi
xor rax, rax
rep stosb
mov rsp, stack_top
mov rdi, rbp
extern kmain
call kmain
; shouldn't be possible to ever reach here
.hang:
hlt
jmp .hang
section .bss
align 16
stack_bottom: resb KSTACK
stack_top:
section .rodata
align 16
global smp_trampoline16
global smp_trampoline16_size
smp_trampoline16:
incbin "src/asm/smpboot.bin"
end_smp_trampoline16:
align 16
smp_trampoline16_size: dw end_smp_trampoline16 - smp_trampoline16
section .text
global smp_trampoline
align 16
smp_trampoline:
mov rdi, KSTACK ; good kernel stack
extern kmalloc
call kmalloc
add rax, KSTACK
mov rsp, rax
extern smp_kmain
call smp_kmain
; impossible to reach here
.hang:
hlt
jmp .hang
|
patches/patch.asm | mega65dev/rom-assembler | 0 | 20877 | <filename>patches/patch.asm<gh_stars>0
;[[system.macros]]
; ***************************************************************************************************************
; ***************************************************************************************************************
;
; Name: patch.asm
; Purpose: Fixes
; Created: 4th January 2020
; Author: <NAME> (<EMAIL>)
;
; ***************************************************************************************************************
; ***************************************************************************************************************
; ***************************************************************************************************************
;
; At present ACME does not support BRA opcode $83. BRL replaces this.
;
; ***************************************************************************************************************
!macro lbra addr {
!byte $83
!word (addr-*-1) & $FFFF
}
!macro lbcc addr {
!byte $93
!word (addr-*-1) & $FFFF
}
!macro lbcs addr {
!byte $B3
!word (addr-*-1) & $FFFF
}
!macro lbne addr {
!byte $D3
!word (addr-*-1) & $FFFF
}
!macro lbeq addr {
!byte $F3
!word (addr-*-1) & $FFFF
}
!macro lbpl addr {
!byte $13
!word (addr-*-1) & $FFFF
}
!macro lbmi addr {
!byte $33
!word (addr-*-1) & $FFFF
}
!macro lbvs addr {
!byte $73
!word (addr-*-1) & $FFFF
}
!macro lbvc addr {
!byte $53
!word (addr-*-1) & $FFFF
}
|
ASM_x86/LinuxAPI_08_mkdir.asm | XlogicX/Learn | 43 | 167504 | ;Simple example of creating a directory with the mkdir API call. API calls found in this example program:
; mkdir, exit
; High level description of what theis example program does:
; Create a new directroy called 'newdir' using the mkdir API call
; exits gracefully with exit().
section .text
global _start
_start:
; Create a new directroy called 'newdir' using the mkdir API call
;------------------------------------------------------------------------------
mov eax, 39 ;mkdir
mov ebx, newdir ;pointer to the directory name
mov ecx, 600o ;Read/Write for Owner
int 0x80
; Exit program
;------------------------------------------------------------------------------
mov eax, 1
int 0x80
section .data
newdir db 'newdir', 0x00
; ------------------------------
; | Some bitfield explanations |
; ------------------------------
; Mode Octal codes
;------------------------------------------------------------------------------
; Read 4
; Write 2
; Execute 1 |
programs/oeis/339/A339825.asm | jmorken/loda | 1 | 102973 | <gh_stars>1-10
; A339825: Odd bisection of the infinite Fibonacci word A003849.
; 1,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,1,0,0,1,1
mul $0,2
cal $0,82389 ; a(n) = floor((n+2)*phi) - floor((n+1)*phi) where phi=(1+sqrt(5))/2.
mov $1,2
div $1,$0
div $1,2
|
tpantlr2-code/code/structures/Comment.g4 | cgonul/antlr-poc | 10 | 7391 | grammar Comment;
file : (ID {System.out.println($ID.text);})+ ;
ID : 'a'..'z'+ ;
LINE_COMMENT : '//' .*? '\r'? '\n' -> skip ;
COMMENT : '/*' .*? '*/' -> skip ;
WS : (' '|'\t'|'\n')+ -> skip ;
|
source/textio/a-wtedit.ads | ytomino/drake | 33 | 9461 | <filename>source/textio/a-wtedit.ads
pragma License (Unrestricted);
with Ada.Text_IO.Editing;
package Ada.Wide_Text_IO.Editing is
-- modified
-- type Picture is private;
subtype Picture is Text_IO.Editing.Picture;
function Valid (
Pic_String : String;
Blank_When_Zero : Boolean := False)
return Boolean
renames Text_IO.Editing.Valid;
function To_Picture (
Pic_String : String;
Blank_When_Zero : Boolean := False)
return Picture
renames Text_IO.Editing.To_Picture;
function Pic_String (Pic : Picture) return String
renames Text_IO.Editing.Pic_String;
function Blank_When_Zero (Pic : Picture) return Boolean
renames Text_IO.Editing.Blank_When_Zero;
Max_Picture_Length : constant := 30; -- implementation_defined
Picture_Error : exception
renames Text_IO.Editing.Picture_Error;
Default_Currency : constant Wide_String := "$";
Default_Fill : constant Wide_Character := '*';
Default_Separator : constant Wide_Character := ',';
Default_Radix_Mark : constant Wide_Character := '.';
generic
type Num is delta <> digits <>;
Default_Currency : Wide_String := Editing.Default_Currency;
Default_Fill : Wide_Character := Editing.Default_Fill;
Default_Separator : Wide_Character := Editing.Default_Separator;
Default_Radix_Mark : Wide_Character := Editing.Default_Radix_Mark;
package Decimal_Output is
-- for renaming
package Strings is new Text_IO.Editing.Decimal_Output (Num);
function Length (
Pic : Picture;
Currency : Wide_String := Default_Currency)
return Natural
renames Strings.Overloaded_Length;
function Valid (
Item : Num;
Pic : Picture;
Currency : Wide_String := Default_Currency)
return Boolean
renames Strings.Overloaded_Valid;
function Image (
Item : Num;
Pic : Picture;
Currency : Wide_String := Default_Currency;
Fill : Wide_Character := Default_Fill;
Separator : Wide_Character := Default_Separator;
Radix_Mark : Wide_Character := Default_Radix_Mark)
return Wide_String
renames Strings.Overloaded_Image;
procedure Put (
File : File_Type; -- Output_File_Type
Item : Num;
Pic : Picture;
Currency : Wide_String := Default_Currency;
Fill : Wide_Character := Default_Fill;
Separator : Wide_Character := Default_Separator;
Radix_Mark : Wide_Character := Default_Radix_Mark)
renames Strings.Overloaded_Put;
procedure Put (
Item : Num;
Pic : Picture;
Currency : Wide_String := Default_Currency;
Fill : Wide_Character := Default_Fill;
Separator : Wide_Character := Default_Separator;
Radix_Mark : Wide_Character := Default_Radix_Mark)
renames Strings.Overloaded_Put;
procedure Put (
To : out Wide_String;
Item : Num;
Pic : Picture;
Currency : Wide_String := Default_Currency;
Fill : Wide_Character := Default_Fill;
Separator : Wide_Character := Default_Separator;
Radix_Mark : Wide_Character := Default_Radix_Mark)
renames Strings.Overloaded_Put;
end Decimal_Output;
end Ada.Wide_Text_IO.Editing;
|
tools-src/gnu/gcc/gcc/ada/mdlltool.adb | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 20910 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- M D L L . T O O L S --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Interface to externals tools used to build DLL and import libraries
with Ada.Text_IO;
with Ada.Exceptions;
with Ada.Unchecked_Deallocation;
with Sdefault;
package body MDLL.Tools is
use Ada;
use GNAT;
Dlltool_Name : constant String := "dlltool";
Dlltool_Exec : OS_Lib.String_Access;
Gcc_Name : constant String := "gcc";
Gcc_Exec : OS_Lib.String_Access;
Gnatbind_Name : constant String := "gnatbind";
Gnatbind_Exec : OS_Lib.String_Access;
Gnatlink_Name : constant String := "gnatlink";
Gnatlink_Exec : OS_Lib.String_Access;
procedure Free is
new Ada.Unchecked_Deallocation (OS_Lib.Argument_List,
OS_Lib.Argument_List_Access);
procedure Print_Command (Tool_Name : in String;
Arguments : in OS_Lib.Argument_List);
-- display the command runned when in Verbose mode
-------------------
-- Print_Command --
-------------------
procedure Print_Command (Tool_Name : in String;
Arguments : in OS_Lib.Argument_List) is
begin
if Verbose then
Text_IO.Put (Tool_Name);
for K in Arguments'Range loop
Text_IO.Put (" " & Arguments (K).all);
end loop;
Text_IO.New_Line;
end if;
end Print_Command;
-----------------
-- Delete_File --
-----------------
procedure Delete_File (Filename : in String) is
File : constant String := Filename & ASCII.Nul;
Success : Boolean;
begin
OS_Lib.Delete_File (File'Address, Success);
end Delete_File;
-------------
-- Dlltool --
-------------
procedure Dlltool (Def_Filename : in String;
DLL_Name : in String;
Library : in String;
Exp_Table : in String := "";
Base_File : in String := "";
Build_Import : in Boolean)
is
Arguments : OS_Lib.Argument_List (1 .. 11);
A : Positive;
Success : Boolean;
Def_Opt : aliased String := "--def";
Def_V : aliased String := Def_Filename;
Dll_Opt : aliased String := "--dllname";
Dll_V : aliased String := DLL_Name;
Lib_Opt : aliased String := "--output-lib";
Lib_V : aliased String := Library;
Exp_Opt : aliased String := "--output-exp";
Exp_V : aliased String := Exp_Table;
Bas_Opt : aliased String := "--base-file";
Bas_V : aliased String := Base_File;
No_Suf_Opt : aliased String := "-k";
begin
Arguments (1 .. 4) := (1 => Def_Opt'Unchecked_Access,
2 => Def_V'Unchecked_Access,
3 => Dll_Opt'Unchecked_Access,
4 => Dll_V'Unchecked_Access);
A := 4;
if Kill_Suffix then
A := A + 1;
Arguments (A) := No_Suf_Opt'Unchecked_Access;
end if;
if Library /= "" and then Build_Import then
A := A + 1;
Arguments (A) := Lib_Opt'Unchecked_Access;
A := A + 1;
Arguments (A) := Lib_V'Unchecked_Access;
end if;
if Exp_Table /= "" then
A := A + 1;
Arguments (A) := Exp_Opt'Unchecked_Access;
A := A + 1;
Arguments (A) := Exp_V'Unchecked_Access;
end if;
if Base_File /= "" then
A := A + 1;
Arguments (A) := Bas_Opt'Unchecked_Access;
A := A + 1;
Arguments (A) := Bas_V'Unchecked_Access;
end if;
Print_Command ("dlltool", Arguments (1 .. A));
OS_Lib.Spawn (Dlltool_Exec.all, Arguments (1 .. A), Success);
if not Success then
Exceptions.Raise_Exception (Tools_Error'Identity,
Dlltool_Name & " execution error.");
end if;
end Dlltool;
---------
-- Gcc --
---------
procedure Gcc (Output_File : in String;
Files : in Argument_List;
Options : in Argument_List;
Base_File : in String := "";
Build_Lib : in Boolean := False)
is
use Sdefault;
Arguments : OS_Lib.Argument_List
(1 .. 5 + Files'Length + Options'Length);
A : Natural := 0;
Success : Boolean;
C_Opt : aliased String := "-c";
Out_Opt : aliased String := "-o";
Out_V : aliased String := Output_File;
Bas_Opt : aliased String := "-Wl,--base-file," & Base_File;
Lib_Opt : aliased String := "-mdll";
Lib_Dir : aliased String := "-L" & Object_Dir_Default_Name.all;
begin
A := A + 1;
if Build_Lib then
Arguments (A) := Lib_Opt'Unchecked_Access;
else
Arguments (A) := C_Opt'Unchecked_Access;
end if;
A := A + 1;
Arguments (A .. A + 2) := (Out_Opt'Unchecked_Access,
Out_V'Unchecked_Access,
Lib_Dir'Unchecked_Access);
A := A + 2;
if Base_File /= "" then
A := A + 1;
Arguments (A) := Bas_Opt'Unchecked_Access;
end if;
A := A + 1;
Arguments (A .. A + Files'Length - 1) := Files;
A := A + Files'Length - 1;
if Build_Lib then
A := A + 1;
Arguments (A .. A + Options'Length - 1) := Options;
A := A + Options'Length - 1;
else
declare
Largs : Argument_List (Options'Range);
L : Natural := Largs'First - 1;
begin
for K in Options'Range loop
if Options (K) (1 .. 2) /= "-l" then
L := L + 1;
Largs (L) := Options (K);
end if;
end loop;
A := A + 1;
Arguments (A .. A + L - 1) := Largs (1 .. L);
A := A + L - 1;
end;
end if;
Print_Command ("gcc", Arguments (1 .. A));
OS_Lib.Spawn (Gcc_Exec.all, Arguments (1 .. A), Success);
if not Success then
Exceptions.Raise_Exception (Tools_Error'Identity,
Gcc_Name & " execution error.");
end if;
end Gcc;
--------------
-- Gnatbind --
--------------
procedure Gnatbind (Alis : in Argument_List;
Args : in Argument_List := Null_Argument_List)
is
Arguments : OS_Lib.Argument_List (1 .. 1 + Alis'Length + Args'Length);
Success : Boolean;
No_Main_Opt : aliased String := "-n";
begin
Arguments (1) := No_Main_Opt'Unchecked_Access;
Arguments (2 .. 1 + Alis'Length) := Alis;
Arguments (2 + Alis'Length .. Arguments'Last) := Args;
Print_Command ("gnatbind", Arguments);
OS_Lib.Spawn (Gnatbind_Exec.all, Arguments, Success);
if not Success then
Exceptions.Raise_Exception (Tools_Error'Identity,
Gnatbind_Name & " execution error.");
end if;
end Gnatbind;
--------------
-- Gnatlink --
--------------
procedure Gnatlink (Ali : in String;
Args : in Argument_List := Null_Argument_List)
is
Arguments : OS_Lib.Argument_List (1 .. 1 + Args'Length);
Success : Boolean;
Ali_Name : aliased String := Ali;
begin
Arguments (1) := Ali_Name'Unchecked_Access;
Arguments (2 .. Arguments'Last) := Args;
Print_Command ("gnatlink", Arguments);
OS_Lib.Spawn (Gnatlink_Exec.all, Arguments, Success);
if not Success then
Exceptions.Raise_Exception (Tools_Error'Identity,
Gnatlink_Name & " execution error.");
end if;
end Gnatlink;
------------
-- Locate --
------------
procedure Locate is
use type OS_Lib.String_Access;
begin
-- dlltool
Dlltool_Exec := OS_Lib.Locate_Exec_On_Path (Dlltool_Name);
if Dlltool_Exec = null then
Exceptions.Raise_Exception (Tools_Error'Identity,
Dlltool_Name & " not found in path");
elsif Verbose then
Text_IO.Put_Line ("using " & Dlltool_Exec.all);
end if;
-- gcc
Gcc_Exec := OS_Lib.Locate_Exec_On_Path (Gcc_Name);
if Gcc_Exec = null then
Exceptions.Raise_Exception (Tools_Error'Identity,
Gcc_Name & " not found in path");
elsif Verbose then
Text_IO.Put_Line ("using " & Gcc_Exec.all);
end if;
-- gnatbind
Gnatbind_Exec := OS_Lib.Locate_Exec_On_Path (Gnatbind_Name);
if Gnatbind_Exec = null then
Exceptions.Raise_Exception (Tools_Error'Identity,
Gnatbind_Name & " not found in path");
elsif Verbose then
Text_IO.Put_Line ("using " & Gnatbind_Exec.all);
end if;
-- gnatlink
Gnatlink_Exec := OS_Lib.Locate_Exec_On_Path (Gnatlink_Name);
if Gnatlink_Exec = null then
Exceptions.Raise_Exception (Tools_Error'Identity,
Gnatlink_Name & " not found in path");
elsif Verbose then
Text_IO.Put_Line ("using " & Gnatlink_Exec.all);
Text_IO.New_Line;
end if;
end Locate;
end MDLL.Tools;
|
UPC_Summerschool_2019/on_off_led.X/maincode.asm | tocache/picomones | 5 | 242209 | <filename>UPC_Summerschool_2019/on_off_led.X/maincode.asm
;UPC Summer School 2019
;Template written by Kalun
list p=18f4550 ;The microcontroller of the project
#include <p18f4550.inc> ;Library for the register's labels
CONFIG FOSC = XT_XT ; Oscillator Selection bits (XT oscillator (XT))
CONFIG PWRT = ON ; Power-up Timer Enable bit (PWRT enabled)
CONFIG BOR = OFF ; Brown-out Reset Enable bits (Brown-out Reset disabled in hardware and software)
CONFIG WDT = OFF ; Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
CONFIG PBADEN = OFF ; PORTB A/D Enable bit (PORTB<4:0> pins are configured as digital I/O on Reset)
CONFIG MCLRE = ON ; MCLR Pin Enable bit (MCLR pin enabled; RE3 input pin disabled)
CONFIG LVP = OFF ; Single-Supply ICSP Enable bit (Single-Supply ICSP disabled)
cblock 0x0020 ; Block declaration for RAM beggining at address 0x0020
var_i
var_j
var_k
endc
org 0x0000 ;Reset vector address
goto beginning
org 0x0020 ;User program area
beginning:
bcf TRISD, 0 ;RD0 port as an output
loop:
bsf LATD, 0 ;RD0 high
call delay_100ms ;100ms delay routine
bcf LATD, 0 ;RD0 low
call delay_100ms ;100ms delay routine
goto loop
delay_100ms:
movlw .100
movwf var_i
u1: call sub1
decfsz var_i, f
goto u1
return
sub1:
movlw .100
movwf var_j
u2: call sub2
decfsz var_j, f
goto u2
return
sub2:
movlw .10
movwf var_k
u3: decfsz var_k, f
goto u3
return
end |
theorems/cw/cohomology/ReconstructedFirstCohomologyGroup.agda | mikeshulman/HoTT-Agda | 0 | 13633 | {-# OPTIONS --without-K --rewriting #-}
open import HoTT
open import cohomology.ChainComplex
open import cohomology.Theory
open import groups.KernelImage
open import cw.CW
module cw.cohomology.ReconstructedFirstCohomologyGroup {i : ULevel} (OT : OrdinaryTheory i) where
open OrdinaryTheory OT
import cw.cohomology.TipCoboundary OT as TC
import cw.cohomology.HigherCoboundary OT as HC
import cw.cohomology.TipAndAugment OT as TAA
open import cw.cohomology.WedgeOfCells OT
open import cw.cohomology.Descending OT
open import cw.cohomology.ReconstructedCochainComplex OT
import cw.cohomology.FirstCohomologyGroup OT as FCG
import cw.cohomology.FirstCohomologyGroupOnDiag OT as FCGD
import cw.cohomology.CohomologyGroupsTooHigh OT as CGTH
private
≤-dec-has-all-paths : {m n : ℕ} → has-all-paths (Dec (m ≤ n))
≤-dec-has-all-paths = prop-has-all-paths (Dec-level ≤-is-prop)
private
abstract
first-cohomology-group-descend : ∀ {n} (⊙skel : ⊙Skeleton {i} (3 + n))
→ cohomology-group (cochain-complex ⊙skel) 1
== cohomology-group (cochain-complex (⊙cw-init ⊙skel)) 1
first-cohomology-group-descend {n = O} ⊙skel
= ap2 (λ δ₁ δ₂ → Ker/Im δ₂ δ₁ (CXₙ/Xₙ₋₁-is-abelian (⊙cw-take (lteSR lteS) ⊙skel) 1))
(coboundary-first-template-descend-from-far {n = 2} ⊙skel (ltSR ltS) ltS)
(coboundary-higher-template-descend-from-one-above ⊙skel)
first-cohomology-group-descend {n = S n} ⊙skel -- n = S n
= ap2 (λ δ₁ δ₂ → Ker/Im δ₂ δ₁ (CXₙ/Xₙ₋₁-is-abelian (⊙cw-take (≤-+-l 1 (lteSR $ lteSR $ inr (O<S n))) ⊙skel) 1))
(coboundary-first-template-descend-from-far {n = 3 + n} ⊙skel (ltSR (ltSR (O<S n))) (<-+-l 1 (ltSR (O<S n))))
(coboundary-higher-template-descend-from-far {n = 3 + n} ⊙skel (<-+-l 1 (ltSR (O<S n))) (<-+-l 2 (O<S n)))
first-cohomology-group-β : ∀ (⊙skel : ⊙Skeleton {i} 2)
→ cohomology-group (cochain-complex ⊙skel) 1
== Ker/Im
(HC.cw-co∂-last ⊙skel)
(TC.cw-co∂-head (⊙cw-init ⊙skel))
(CXₙ/Xₙ₋₁-is-abelian (⊙cw-init ⊙skel) 1)
first-cohomology-group-β ⊙skel
= ap2 (λ δ₁ δ₂ → Ker/Im δ₂ δ₁ (CXₙ/Xₙ₋₁-is-abelian (⊙cw-init ⊙skel) 1))
( coboundary-first-template-descend-from-two ⊙skel
∙ coboundary-first-template-β (⊙cw-init ⊙skel))
(coboundary-higher-template-β ⊙skel)
first-cohomology-group-β-one-below : ∀ (⊙skel : ⊙Skeleton {i} 1)
→ cohomology-group (cochain-complex ⊙skel) 1
== Ker/Im
(cst-hom {H = Lift-group {j = i} Unit-group})
(TC.cw-co∂-head ⊙skel)
(CXₙ/Xₙ₋₁-is-abelian ⊙skel 1)
first-cohomology-group-β-one-below ⊙skel
= ap
(λ δ₁ → Ker/Im
(cst-hom {H = Lift-group {j = i} Unit-group})
δ₁ (CXₙ/Xₙ₋₁-is-abelian ⊙skel 1))
(coboundary-first-template-β ⊙skel)
abstract
first-cohomology-group : ∀ {n} (⊙skel : ⊙Skeleton {i} n)
→ ⊙has-cells-with-choice 0 ⊙skel i
→ C 1 ⊙⟦ ⊙skel ⟧ ≃ᴳ cohomology-group (cochain-complex ⊙skel) 1
first-cohomology-group {n = 0} ⊙skel ac =
CGTH.C-cw-iso-ker/im 1 ltS (TAA.C2×CX₀ ⊙skel 0) ⊙skel ac
first-cohomology-group {n = 1} ⊙skel ac =
coe!ᴳ-iso (first-cohomology-group-β-one-below ⊙skel)
∘eᴳ FCGD.C-cw-iso-ker/im ⊙skel ac
first-cohomology-group {n = 2} ⊙skel ac =
coe!ᴳ-iso (first-cohomology-group-β ⊙skel)
∘eᴳ FCG.C-cw-iso-ker/im ⊙skel ac
first-cohomology-group {n = S (S (S n))} ⊙skel ac =
coe!ᴳ-iso (first-cohomology-group-descend ⊙skel)
∘eᴳ first-cohomology-group (⊙cw-init ⊙skel) (⊙init-has-cells-with-choice ⊙skel ac)
∘eᴳ C-cw-descend-at-lower ⊙skel (<-+-l 1 (O<S n)) ac
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0.log_21829_699.asm | ljhsiun2/medusa | 9 | 15775 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r13
push %r14
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x631a, %rdi
clflush (%rdi)
nop
nop
and $52329, %rdx
movb $0x61, (%rdi)
nop
nop
dec %r11
lea addresses_UC_ht+0x11b5a, %r13
nop
nop
nop
inc %r14
vmovups (%r13), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $1, %xmm0, %r11
nop
nop
add $63729, %r10
lea addresses_A_ht+0x694a, %rdx
nop
and %r12, %r12
mov $0x6162636465666768, %rdi
movq %rdi, (%rdx)
nop
nop
nop
nop
cmp %r11, %r11
lea addresses_WC_ht+0xf096, %r11
nop
add %r10, %r10
and $0xffffffffffffffc0, %r11
movntdqa (%r11), %xmm3
vpextrq $0, %xmm3, %rdx
cmp $6235, %r11
lea addresses_WT_ht+0x1135a, %rsi
lea addresses_WT_ht+0x13d65, %rdi
sub %r14, %r14
mov $24, %rcx
rep movsw
nop
nop
nop
nop
nop
add $9138, %rcx
lea addresses_A_ht+0x1035a, %r12
nop
nop
nop
nop
lfence
mov $0x6162636465666768, %rdx
movq %rdx, %xmm7
movups %xmm7, (%r12)
nop
nop
cmp $38076, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r14
pop %r13
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r8
push %rax
push %rbp
push %rsi
// Store
mov $0x776f74000000047a, %r13
clflush (%r13)
nop
nop
nop
nop
nop
add %r10, %r10
mov $0x5152535455565758, %rax
movq %rax, %xmm5
vmovups %ymm5, (%r13)
nop
nop
nop
nop
and $61076, %r13
// Load
lea addresses_WT+0x1766a, %r13
nop
nop
nop
nop
sub $50224, %rsi
vmovups (%r13), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %r10
nop
add %r12, %r12
// Store
mov $0x5691e90000000b18, %r10
xor %rbp, %rbp
movw $0x5152, (%r10)
nop
nop
sub $27895, %rax
// Store
lea addresses_normal+0x9132, %r13
nop
nop
nop
xor $12653, %rax
movw $0x5152, (%r13)
nop
nop
nop
cmp $35572, %rax
// Faulty Load
lea addresses_RW+0xcb5a, %r8
nop
nop
nop
nop
add $27107, %rsi
mov (%r8), %r12d
lea oracles, %r13
and $0xff, %r12
shlq $12, %r12
mov (%r13,%r12,1), %r12
pop %rsi
pop %rbp
pop %rax
pop %r8
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_NC', 'AVXalign': False, 'size': 32}}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WT', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 1, 'type': 'addresses_NC', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_normal', 'AVXalign': False, 'size': 2}}
[Faulty Load]
{'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 1}}
{'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}}
{'src': {'NT': True, 'same': False, 'congruent': 2, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
Transynther/x86/_processed/AVXALIGN/_st_sm_/i9-9900K_12_0xa0.log_21829_524.asm | ljhsiun2/medusa | 9 | 10727 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x6a15, %r9
nop
nop
nop
nop
nop
xor $29126, %r12
mov (%r9), %rax
nop
nop
nop
nop
nop
add %r13, %r13
lea addresses_WC_ht+0x171d5, %r12
nop
nop
nop
nop
nop
sub $59059, %r11
movb $0x61, (%r12)
add %r13, %r13
lea addresses_normal_ht+0xc805, %rax
add $3076, %r12
movb $0x61, (%rax)
nop
nop
sub %rbx, %rbx
lea addresses_normal_ht+0x755d, %rsi
lea addresses_A_ht+0x12175, %rdi
nop
and %r9, %r9
mov $104, %rcx
rep movsl
cmp %rsi, %rsi
lea addresses_A_ht+0xdd5, %rsi
lea addresses_D_ht+0xd9d5, %rdi
nop
nop
nop
nop
xor %r11, %r11
mov $36, %rcx
rep movsq
nop
nop
nop
sub %r13, %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r15
push %r8
push %rbp
push %rbx
push %rsi
// Store
lea addresses_D+0x165d5, %r10
and $27704, %rbx
mov $0x5152535455565758, %r12
movq %r12, %xmm3
movups %xmm3, (%r10)
nop
nop
nop
nop
add $55836, %r10
// Load
lea addresses_UC+0x164d5, %r15
nop
nop
nop
nop
nop
inc %rsi
vmovups (%r15), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %r12
nop
sub $36433, %rbx
// Store
lea addresses_normal+0xe1d5, %r15
nop
nop
nop
nop
nop
dec %rbp
mov $0x5152535455565758, %rbx
movq %rbx, %xmm4
vmovups %ymm4, (%r15)
nop
nop
xor $49348, %r8
// Store
lea addresses_WT+0xf0ed, %rbp
nop
nop
nop
nop
sub $43922, %r12
movl $0x51525354, (%rbp)
nop
nop
nop
add $24950, %rbp
// Store
lea addresses_A+0xb2d5, %rbx
clflush (%rbx)
nop
nop
nop
nop
add %r12, %r12
mov $0x5152535455565758, %r8
movq %r8, %xmm1
movups %xmm1, (%rbx)
sub $64023, %r8
// Load
lea addresses_normal+0xe1d5, %r10
nop
nop
and $22947, %r15
mov (%r10), %ebp
nop
nop
and %r8, %r8
// Store
lea addresses_WC+0x13435, %rbp
sub $2143, %r15
mov $0x5152535455565758, %r12
movq %r12, %xmm2
movups %xmm2, (%rbp)
nop
nop
nop
nop
nop
xor $58010, %rbx
// Faulty Load
lea addresses_normal+0xe1d5, %r10
nop
nop
add $64962, %r15
mov (%r10), %ebx
lea oracles, %rbp
and $0xff, %rbx
shlq $12, %rbx
mov (%rbp,%rbx,1), %rbx
pop %rsi
pop %rbx
pop %rbp
pop %r8
pop %r15
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_D', 'AVXalign': False, 'size': 16}}
{'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_UC', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 2, 'type': 'addresses_WT', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_A', 'AVXalign': False, 'size': 16}}
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WC', 'AVXalign': False, 'size': 16}}
[Faulty Load]
{'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1}}
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_A_ht'}}
{'src': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
programs/oeis/343/A343442.asm | neoneye/loda | 22 | 90887 | ; A343442: If n = Product (p_j^k_j) then a(n) = Product (p_j + 2), with a(1) = 1.
; 1,4,5,4,7,20,9,4,5,28,13,20,15,36,35,4,19,20,21,28,45,52,25,20,7,60,5,36,31,140,33,4,65,76,63,20,39,84,75,28,43,180,45,52,35,100,49,20,9,28,95,60,55,20,91,36,105,124,61,140,63,132,45,4,105,260,69,76,125,252
add $0,1
mov $1,1
mov $2,2
mov $3,$0
mov $4,$0
lpb $3
mov $5,$4
lpb $5
add $6,1
mov $7,$0
div $0,$2
mod $7,$2
cmp $7,0
sub $5,$7
lpe
cmp $6,0
cmp $6,0
mov $7,$2
add $7,2
pow $7,$6
mul $1,$7
add $2,1
mul $6,$8
sub $7,1
cmp $7,1
cmp $7,0
sub $3,$7
lpe
mov $0,$1
|
agda-stdlib-0.9/src/Relation/Binary/Flip.agda | qwe2/try-agda | 1 | 16064 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Many properties which hold for _∼_ also hold for flip _∼_
------------------------------------------------------------------------
open import Relation.Binary
module Relation.Binary.Flip where
open import Function
open import Data.Product
implies : ∀ {a b ℓ₁ ℓ₂} {A : Set a} {B : Set b}
(≈ : REL A B ℓ₁) (∼ : REL A B ℓ₂) →
≈ ⇒ ∼ → flip ≈ ⇒ flip ∼
implies _ _ impl = impl
reflexive : ∀ {a ℓ} {A : Set a} (∼ : Rel A ℓ) →
Reflexive ∼ → Reflexive (flip ∼)
reflexive _ refl = refl
irreflexive : ∀ {a b ℓ₁ ℓ₂} {A : Set a} {B : Set b}
(≈ : REL A B ℓ₁) (∼ : REL A B ℓ₂) →
Irreflexive ≈ ∼ → Irreflexive (flip ≈) (flip ∼)
irreflexive _ _ irrefl = irrefl
symmetric : ∀ {a ℓ} {A : Set a} (∼ : Rel A ℓ) →
Symmetric ∼ → Symmetric (flip ∼)
symmetric _ sym = sym
transitive : ∀ {a ℓ} {A : Set a} (∼ : Rel A ℓ) →
Transitive ∼ → Transitive (flip ∼)
transitive _ trans = flip trans
antisymmetric : ∀ {a ℓ₁ ℓ₂} {A : Set a} (≈ : Rel A ℓ₁) (≤ : Rel A ℓ₂) →
Antisymmetric ≈ ≤ → Antisymmetric (flip ≈) (flip ≤)
antisymmetric _ _ antisym = antisym
asymmetric : ∀ {a ℓ} {A : Set a} (< : Rel A ℓ) →
Asymmetric < → Asymmetric (flip <)
asymmetric _ asym = asym
respects : ∀ {a ℓ p} {A : Set a} (∼ : Rel A ℓ) (P : A → Set p) →
Symmetric ∼ → P Respects ∼ → P Respects flip ∼
respects _ _ sym resp ∼ = resp (sym ∼)
respects₂ : ∀ {a ℓ₁ ℓ₂} {A : Set a} (∼₁ : Rel A ℓ₁) (∼₂ : Rel A ℓ₂) →
Symmetric ∼₂ → ∼₁ Respects₂ ∼₂ → flip ∼₁ Respects₂ flip ∼₂
respects₂ _ _ sym (resp₁ , resp₂) =
((λ {_} {_} {_} ∼ → resp₂ (sym ∼)) , λ {_} {_} {_} ∼ → resp₁ (sym ∼))
decidable : ∀ {a b ℓ} {A : Set a} {B : Set b} (∼ : REL A B ℓ) →
Decidable ∼ → Decidable (flip ∼)
decidable _ dec x y = dec y x
total : ∀ {a ℓ} {A : Set a} (∼ : Rel A ℓ) →
Total ∼ → Total (flip ∼)
total _ tot x y = tot y x
trichotomous : ∀ {a ℓ₁ ℓ₂} {A : Set a} (≈ : Rel A ℓ₁) (< : Rel A ℓ₂) →
Trichotomous ≈ < → Trichotomous (flip ≈) (flip <)
trichotomous _ _ compare x y = compare y x
isEquivalence : ∀ {a ℓ} {A : Set a} {≈ : Rel A ℓ} →
IsEquivalence ≈ → IsEquivalence (flip ≈)
isEquivalence {≈ = ≈} eq = record
{ refl = reflexive ≈ Eq.refl
; sym = symmetric ≈ Eq.sym
; trans = transitive ≈ Eq.trans
}
where module Eq = IsEquivalence eq
setoid : ∀ {s₁ s₂} → Setoid s₁ s₂ → Setoid s₁ s₂
setoid S = record
{ _≈_ = flip S._≈_
; isEquivalence = isEquivalence S.isEquivalence
} where module S = Setoid S
isPreorder : ∀ {a ℓ₁ ℓ₂} {A : Set a} {≈ : Rel A ℓ₁} {∼ : Rel A ℓ₂} →
IsPreorder ≈ ∼ → IsPreorder (flip ≈) (flip ∼)
isPreorder {≈ = ≈} {∼} pre = record
{ isEquivalence = isEquivalence Pre.isEquivalence
; reflexive = implies ≈ ∼ Pre.reflexive
; trans = transitive ∼ Pre.trans
}
where module Pre = IsPreorder pre
preorder : ∀ {p₁ p₂ p₃} → Preorder p₁ p₂ p₃ → Preorder p₁ p₂ p₃
preorder P = record
{ _∼_ = flip P._∼_
; _≈_ = flip P._≈_
; isPreorder = isPreorder P.isPreorder
} where module P = Preorder P
isDecEquivalence : ∀ {a ℓ} {A : Set a} {≈ : Rel A ℓ} →
IsDecEquivalence ≈ → IsDecEquivalence (flip ≈)
isDecEquivalence {≈ = ≈} dec = record
{ isEquivalence = isEquivalence Dec.isEquivalence
; _≟_ = decidable ≈ Dec._≟_
}
where module Dec = IsDecEquivalence dec
decSetoid : ∀ {s₁ s₂} → DecSetoid s₁ s₂ → DecSetoid s₁ s₂
decSetoid S = record
{ _≈_ = flip S._≈_
; isDecEquivalence = isDecEquivalence S.isDecEquivalence
} where module S = DecSetoid S
isPartialOrder : ∀ {a ℓ₁ ℓ₂} {A : Set a} {≈ : Rel A ℓ₁} {≤ : Rel A ℓ₂} →
IsPartialOrder ≈ ≤ →
IsPartialOrder (flip ≈) (flip ≤)
isPartialOrder {≈ = ≈} {≤} po = record
{ isPreorder = isPreorder Po.isPreorder
; antisym = antisymmetric ≈ ≤ Po.antisym
}
where module Po = IsPartialOrder po
poset : ∀ {p₁ p₂ p₃} → Poset p₁ p₂ p₃ → Poset p₁ p₂ p₃
poset O = record
{ _≈_ = flip O._≈_
; _≤_ = flip O._≤_
; isPartialOrder = isPartialOrder O.isPartialOrder
} where module O = Poset O
isStrictPartialOrder :
∀ {a ℓ₁ ℓ₂} {A : Set a} {≈ : Rel A ℓ₁} {< : Rel A ℓ₂} →
IsStrictPartialOrder ≈ < → IsStrictPartialOrder (flip ≈) (flip <)
isStrictPartialOrder {≈ = ≈} {<} spo = record
{ isEquivalence = isEquivalence Spo.isEquivalence
; irrefl = irreflexive ≈ < Spo.irrefl
; trans = transitive < Spo.trans
; <-resp-≈ = respects₂ < ≈ Spo.Eq.sym Spo.<-resp-≈
}
where module Spo = IsStrictPartialOrder spo
strictPartialOrder :
∀ {s₁ s₂ s₃} →
StrictPartialOrder s₁ s₂ s₃ → StrictPartialOrder s₁ s₂ s₃
strictPartialOrder O = record
{ _≈_ = flip O._≈_
; _<_ = flip O._<_
; isStrictPartialOrder = isStrictPartialOrder O.isStrictPartialOrder
} where module O = StrictPartialOrder O
isTotalOrder :
∀ {a ℓ₁ ℓ₂} {A : Set a} {≈ : Rel A ℓ₁} {≤ : Rel A ℓ₂} →
IsTotalOrder ≈ ≤ → IsTotalOrder (flip ≈) (flip ≤)
isTotalOrder {≈ = ≈} {≤} to = record
{ isPartialOrder = isPartialOrder To.isPartialOrder
; total = total ≤ To.total
}
where module To = IsTotalOrder to
totalOrder : ∀ {t₁ t₂ t₃} → TotalOrder t₁ t₂ t₃ → TotalOrder t₁ t₂ t₃
totalOrder O = record
{ _≈_ = flip O._≈_
; _≤_ = flip O._≤_
; isTotalOrder = isTotalOrder O.isTotalOrder
} where module O = TotalOrder O
isDecTotalOrder :
∀ {a ℓ₁ ℓ₂} {A : Set a} {≈ : Rel A ℓ₁} {≤ : Rel A ℓ₂} →
IsDecTotalOrder ≈ ≤ → IsDecTotalOrder (flip ≈) (flip ≤)
isDecTotalOrder {≈ = ≈} {≤} dec = record
{ isTotalOrder = isTotalOrder Dec.isTotalOrder
; _≟_ = decidable ≈ Dec._≟_
; _≤?_ = decidable ≤ Dec._≤?_
}
where module Dec = IsDecTotalOrder dec
decTotalOrder :
∀ {d₁ d₂ d₃} → DecTotalOrder d₁ d₂ d₃ → DecTotalOrder d₁ d₂ d₃
decTotalOrder O = record
{ _≈_ = flip O._≈_
; _≤_ = flip O._≤_
; isDecTotalOrder = isDecTotalOrder O.isDecTotalOrder
} where module O = DecTotalOrder O
isStrictTotalOrder :
∀ {a ℓ₁ ℓ₂} {A : Set a} {≈ : Rel A ℓ₁} {< : Rel A ℓ₂} →
IsStrictTotalOrder ≈ < → IsStrictTotalOrder (flip ≈) (flip <)
isStrictTotalOrder {≈ = ≈} {<} sto = record
{ isEquivalence = isEquivalence Sto.isEquivalence
; trans = transitive < Sto.trans
; compare = trichotomous ≈ < Sto.compare
; <-resp-≈ = respects₂ < ≈ Sto.Eq.sym Sto.<-resp-≈
}
where module Sto = IsStrictTotalOrder sto
strictTotalOrder :
∀ {s₁ s₂ s₃} → StrictTotalOrder s₁ s₂ s₃ → StrictTotalOrder s₁ s₂ s₃
strictTotalOrder O = record
{ _≈_ = flip O._≈_
; _<_ = flip O._<_
; isStrictTotalOrder = isStrictTotalOrder O.isStrictTotalOrder
} where module O = StrictTotalOrder O
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c6/c64109g.ada | best08618/asylo | 7 | 30233 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c6/c64109g.ada
-- C64109G.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 SLICES OF ARRAYS ARE PASSED CORRECTLY TO SUBPROGRAMS.
-- SPECIFICALLY,
-- (A) CHECK ALL PARAMETER MODES.
-- CPP 8/28/84
-- PWN 05/31/96 Corrected spelling problem.
WITH REPORT; USE REPORT;
PROCEDURE C64109G IS
BEGIN
TEST ("C64109G", "CHECK THAT SLICES OF ARRAYS ARE PASSED " &
"CORRECTLY TO SUBPROGRAMS");
--------------------------------------------
DECLARE -- (A)
SUBTYPE SUBINT IS INTEGER RANGE 1..5;
TYPE ARRAY_TYPE IS ARRAY (SUBINT RANGE <>) OF INTEGER;
ARR : ARRAY_TYPE (1..5) := (1..3 => 7, 4..5 => 9);
BOOL : BOOLEAN;
PROCEDURE P1 (S : ARRAY_TYPE) IS
BEGIN
IF S(IDENT_INT(3)) /= 7 THEN
FAILED ("IN PARAMETER NOT PASSED CORRECTLY - (A)");
END IF;
IF S(4) /= 9 THEN
FAILED ("IN PARAMETER NOT PASSED CORRECTLY - (A)2");
END IF;
END P1;
FUNCTION F1 (S : ARRAY_TYPE) RETURN BOOLEAN IS
BEGIN
IF S(3) /= 7 THEN
FAILED ("IN PARAMETER NOT PASSED CORRECTLY - (A)");
END IF;
IF S(IDENT_INT(4)) /= 9 THEN
FAILED ("IN PARAMETER NOT PASSED CORRECTLY - (A)2");
END IF;
RETURN TRUE;
END F1;
PROCEDURE P2 (S : IN OUT ARRAY_TYPE) IS
BEGIN
IF S(3) /= 7 THEN
FAILED ("IN OUT PARAM NOT PASSED CORRECTLY - (A)");
END IF;
IF S(4) /= 9 THEN
FAILED ("IN OUT PARAM NOT PASSED CORRECTLY - (A)2");
END IF;
FOR I IN 3 .. 4 LOOP
S(I) := 5;
END LOOP;
END P2;
PROCEDURE P3 (S : OUT ARRAY_TYPE) IS
BEGIN
FOR I IN 3 .. 4 LOOP
S(I) := 3;
END LOOP;
END P3;
BEGIN -- (A)
P1 (ARR(3..4));
IF ARR(3) /= 7 THEN
FAILED ("IN PARAM CHANGED BY PROCEDURE - (A)");
END IF;
IF ARR(4) /= 9 THEN
FAILED ("IN PARAM CHANGED BY PROCEDURE - (A)2");
END IF;
BOOL := F1 (ARR(IDENT_INT(3)..IDENT_INT(4)));
IF ARR(3) /= 7 THEN
FAILED ("IN PARAM CHANGED BY FUNCTION - (A)");
END IF;
IF ARR(4) /= 9 THEN
FAILED ("IN PARAM CHANGED BY FUNCTION - (A)2");
END IF;
P2 (ARR(3..4));
FOR I IN 3 .. 4 LOOP
IF ARR(I) /= 5 THEN
FAILED ("IN OUT PARAM RETURNED INCORRECTLY - (A)");
END IF;
END LOOP;
P3 (ARR(IDENT_INT(3)..4));
FOR I IN 3 .. 4 LOOP
IF ARR(I) /= 3 THEN
FAILED ("OUT PARAM RETURNED INCORRECTLY - (A)");
END IF;
END LOOP;
END;
RESULT;
END C64109G;
|
oeis/274/A274832.asm | neoneye/loda-programs | 11 | 168702 | <filename>oeis/274/A274832.asm
; A274832: Values of n such that 2*n+1 and 7*n+1 are both triangular numbers (A000217).
; Submitted by <NAME>
; 0,27,297,24570,267030,22064157,239792967,19813588740,215333817660,17792580624687,193369528466037,15977717587380510,173645621228683890,14347972600887073617,155933574493829667507,12884463417879004727880,140028176249837812737720,11570233801282745358562947,125745146338779862008805377,10390057069088487452984798850,112919001384048066246094491150,9330259677807660450034990804677,101401137497728824709130844247647,8378562800614209995643968757801420,91058108553959100540733252039896180
mov $2,$0
mul $0,2
mod $2,2
add $0,$2
seq $0,48910 ; Indices of 9-gonal numbers that are also square.
div $0,48
mul $0,27
|
Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-3.ada | LaudateCorpus1/RosettaCodeData | 1 | 30898 | type Link is limited record
Next : not null access Link := Link'Unchecked_Access;
Prev : not null access Link := Link'Unchecked_Access;
Data : Integer;
end record;
|
pastry.als | bolt12/alloy-pastry-dht | 0 | 4759 | <gh_stars>0
open util/ordering[Id] as I
open util/ordering[Time] as T
sig Time {} // Assinatura relacionada com o tempo
one sig Network {
connected : Node set -> set Time // Esta relação indica quais os Nodos conectados, num momento
}
abstract sig Id {
succ: one Id, // Sucessor de um certo Id no anel
ant: one Id // Antecessor de um certo Id no anel
}
sig Key extends Id {} // Chave, pode ser guardas em hashtables
sig Node extends Id {
hashtable: Key set -> set Time,
neighboursHT: Key set -> set Time, // Chaves guardadas pelos vizinhos
lset: Node set -> set Time, // Vizinhos à esquerda
rset: Node set -> set Time // Vizinhos à direita
}
one sig First in Id {} // Primeiro Id no anel
one sig Last in Id {} // Ultimo Id no anel
/* Forçar formato em anel */
fact RingShape {
// Igualar o First e o Last da ordem total à ordem do anel
First = first
Last = last
// O First é vizinho do Last e vice-versa
First.ant = Last
Last.succ = First
// Não existe circularidade entre o First e o Last no anel
all i:Id-Last | i.succ = i.next
all i:Id-First | i.ant = i.prev
}
/* Funções para auxiliar o tema */
fun Connected[t:Time,n:Node]: set Node {
{n:Node | n in Network.connected.t }
}
/* INVARIANTES */
// Chaves armazenadas por um determinado Nodo encontram-se
// na área de cobertura desse nodo
pred inv1[t:Time] {
all n:Network.connected.t,k:Key {
k in n.hashtable.t and gt[k,n] => no n':Network.connected.t | n' in (n.^next & k.^prev)
}
all n:Network.connected.t,k:Key {
k in n.hashtable.t and lt[k,n] => no n':Network.connected.t | n' in (n.^prev & k.^next)
}
}
// Cada chave é coberta apenas por um nodo conectado
pred inv2[t:Time] {
all k:Key | lone (hashtable.t).k
all k:Key | one (hashtable.t).k => (hashtable.t).k in Network.connected.t
}
// Cada nodo conectado guarda as chaves dos vizinhos
pred inv3[t:Time] {
all n:Network.connected.t | n.neighboursHT.t = (n.lset.t + n.rset.t).hashtable.t
}
// Os lset's e rset's são constituidos por apenas nodos conectados
pred inv4[t:Time] {
((Network.connected.t).rset.t + (Network.connected.t).lset.t) in Network.connected.t
}
// Qualquer dois nodos se o primeiro é vizinho do segundo, então o segundo é vizinho do primeiro
pred inv5[t:Time] {
all n1,n2:Network.connected.t | n1 in n2.lset.t => n2 in n1.rset.t
all n1,n2:Network.connected.t | n1 in n2.rset.t => n2 in n1.lset.t
}
// O lset e o rset de um Nodo tem um
// conjunto dos menores nodos conectados consecutivos
pred inv6[t:Time] {
/* Caso geral */
all n:Network.connected.t-First | some n.lset.t => n.lset.t in n.^ant
all n1:Network.connected.t-First,n2:Network.connected.t | n2 in n1.lset.t => ! some n3:Network.connected.t {
n3 in (n1.^prev & n2.^next) and n3 not in n1.lset.t
}
all n:Network.connected.t-Last | some n.rset.t => n.rset.t in n.^succ
all n1:Network.connected.t-Last,n2:Network.connected.t | n2 in n1.rset.t => ! some n3:Network.connected.t {
n3 in (n1.^next & n2.^prev) and n3 not in n1.rset.t
}
/* Caso para o First e Last */
all n:First | n in Network.connected.t => n.lset.t in Last.*prev
all n:Last | n in Network.connected.t => n.rset.t in First.*next
all n1:First,n2:Network.connected.t | n1 in Network.connected.t and n2 in n1.lset.t => ! some n3:Network.connected.t {
n3 in n2.^next and n3 not in n1.lset.t
}
all n1:Last,n2:Network.connected.t | n1 in Network.connected.t and n2 in n1.rset.t => ! some n3:Network.connected.t {
n3 in n2.^prev and n3 not in n1.rset.t
}
}
// Todos os nodos conectados possuem no minimo um Nodo no seu lset e rset
// quando existem pelo menos dois nodos conectados na rede
pred inv7[t:Time] {
! lone Network.connected.t => all n:Network.connected.t | some n.lset.t
! lone Network.connected.t => all n:Network.connected.t | some n.rset.t
}
// Um nodo não se encontra no seu lset nem rset
pred inv8[t:Time] {
all n:Network.connected.t | n not in n.lset.t
all n:Network.connected.t | n not in n.rset.t
}
pred invs[t:Time] {
inv1[t]
inv2[t]
inv3[t]
inv4[t]
inv5[t]
inv6[t]
inv7[t]
inv8[t]
}
/* Funções auxiliares */
fun minInRing[t:Time]: lone Node {
min[Network.connected.t]
}
fun maxInRing[t:Time]: lone Node {
max[Network.connected.t]
}
fun nextNodeInRing[t:Time,n:Node]: lone Node {
min[{ n1:Network.connected.t-n | gt[n1,n] }]
}
fun prevNodeInRing[t:Time,n:Node]: lone Node {
max[{ n1:Network.connected.t-n | lt[n1,n] }]
}
/* Operações */
/***** ESTADO INICIAL *****/
pred init[t:Time] {
no Network.connected.t
no hashtable.t
no rset.t
no lset.t
no neighboursHT.t
}
check initIsValid {
all t:Time | init[t] => invs[t]
} for 5
/***** JOIN *****/
pred join[t1,t2:Time,n:Node] {
// Pré-condições
n not in Network.connected.t1
no n.hashtable.t1
no n.neighboursHT.t1
no n.rset.t1
no n.lset.t1
// Pós-condições
Network.connected.t2 = Network.connected.t1 + n
/* Acordar lset e rsets */
(#Network.connected.t1 >= 1) and lt[n,minInRing[t1]] =>
lset.t2 = lset.t1 + n->maxInRing[t1] + nextNodeInRing[t1,n]->n
rset.t2 = rset.t1 + n->nextNodeInRing[t1,n] + maxInRing[t1]->n
(#Network.connected.t1 >= 1) and gt[n,maxInRing[t1]] =>
lset.t2 = lset.t1 + n->prevNodeInRing[t1,n] + minInRing[t1]->n
rset.t2 = rset.t1 + n->minInRing[t1] + prevNodeInRing[t1,n]->n
(#Network.connected.t1 >= 1) and ! gt[n,maxInRing[t1]] and !lt[n,minInRing[t1]] =>
lset.t2 = lset.t1 + n->prevNodeInRing[t1,n] + nextNodeInRing[t1,n]->n
rset.t2 = rset.t1 + n->nextNodeInRing[t1,n] + prevNodeInRing[t1,n]->n
// O nodo sabe quais as chaves dos vizinhos
(! lone Network.connected.t2) => neighboursHT.t2 = neighboursHT.t1 + n->(n.lset.t2 + n.rset.t2).hashtable.t2
// Frame conditions
hashtable.t2 = hashtable.t1
/* Network ainda é pequena (<2 Nodos) */
lone Network.connected.t2 => lset.t2 = lset.t1
lone Network.connected.t2 => rset.t2 = rset.t1
lone Network.connected.t2 => neighboursHT.t2 = neighboursHT.t1
}
run joinIsConsistent {
some t:Time,n:Node | join[t,t.next,n]
} for 5
check joinIsValid {
all t:Time | init[t] => invs[t]
all t:Time-T/last,n:Node | invs[t] and join[t,t.next,n] => invs[t.next]
} for 5
/***** DISJOIN *****/
/*
Não é preservado o invariante 7 e, devido a falta de tempo não conseguimos
corrigir.
pred disjoin[t1,t2:Time,n:Node] {
// Pré-condições
n in Network.connected.t1
// Pós-condições
Network.connected.t2 = Network.connected.t1 - n
// Vizinhos também removem nodo
rset.t2 = ((rset.t1 - ((rset.t1).n)->n) + (n.lset.t1)->(n.rset.t1)) - (iden & (Node->Node)) - n->(n.rset.t1)
lset.t2 = ((lset.t1 - ((lset.t1).n)->n) + (n.rset.t1)->(n.lset.t1)) - (iden & (Node->Node)) - n->(n.rset.t1)
// Os vizinhos ficam com as chaves do nodo
n != minInRing[t1] => hashtable.t2 = ((hashtable.t1 - n->Key) + prevNodeInRing[t1,n]->(n.hashtable.t1))
n != minInRing[t1] => neighboursHT.t2 = neighboursHT.t1 +
prevNodeInRing[t1,n]->(prevNodeInRing[t1,n].lset.t2 + prevNodeInRing[t1,n].rset.t2).hashtable.t2 +
nextNodeInRing[t1,n]->(nextNodeInRing[t1,n].lset.t2 + nextNodeInRing[t1,n].rset.t2).hashtable.t2 +
(prevNodeInRing[t1,n].lset.t2 + prevNodeInRing[t1,n].rset.t2)->prevNodeInRing[t1,n].hashtable.t2 -
prevNodeInRing[t1,n]->(n.hashtable.t1)
n = minInRing[t1] => hashtable.t2 = ((hashtable.t1 - n->Key) + nextNodeInRing[t1,n]->(n.hashtable.t1))
n = minInRing[t1] => neighboursHT.t2 = neighboursHT.t1 +
nextNodeInRing[t1,n]->(nextNodeInRing[t1,n].lset.t2 + nextNodeInRing[t1,n].rset.t2).hashtable.t2 +
nextNodeInRing[t1,n]->(nextNodeInRing[t1,n].lset.t2 + nextNodeInRing[t1,n].rset.t2).hashtable.t2 +
(nextNodeInRing[t1,n].lset.t2 + nextNodeInRing[t1,n].rset.t2)->nextNodeInRing[t1,n].hashtable.t2 -
nextNodeInRing[t1,n]->(n.hashtable.t1)
// Frame conditions
}
run disjoinIsConsistent {
some t:Time,n:Node | disjoin[t,t.next,n]
} for 5
check disjoinIsValid {
all t:Time | init[t] => invs[t]
all t:Time-T/last,n:Node | invs[t] and disjoin[t,t.next,n] => invs[t.next]
} for 5
*/
/***** PUT KEY *****/
pred putKey[t1,t2:Time,k:Key,n:Node]{
--Pré-condições
n in Network.connected.t1
k not in (Network.connected.t1).hashtable.t1
gt[k,n] => no n':Network.connected.t1 | n' in (n.^next & k.^prev)
lt[k,n] => no n':Network.connected.t1 | n' in (n.^prev & k.^next)
--Pós-condições
hashtable.t2 = hashtable.t1 + n->k
neighboursHT.t2 = neighboursHT.t1 + (n.lset.t1+ n.rset.t1)->k + ((lset.t1+rset.t1).n)->k
--Frame conditions
Network.connected.t2 = Network.connected.t1
lset.t2 = lset.t1
rset.t2 = rset.t1
}
run putKeyIsConsistent {
some t:Time,k:Key,n:Node | putKey[t,t.next,k,n]
} for 5
check putKeyIsValid {
all t:Time | init[t] => invs[t]
all t:Time-T/last,k:Key,n:Node | invs[t] and putKey[t,t.next,k,n] => invs[t.next]
} for 5
/*** DELETE KEY ***/
pred deleteKey[t1,t2:Time,k:Key]{
--Pré-condições
k in (Network.connected.t1).hashtable.t1
--Pós-condições
hashtable.t2 = hashtable.t1 - Node->k
neighboursHT.t2 = neighboursHT.t1 - ((Network.connected.t1).lset.t1 + (Network.connected.t1).rset.t1)->k
- ((lset.t1+rset.t1).(Network.connected.t1))->k
--Frame conditions
Network.connected.t2 = Network.connected.t1
lset.t2 = lset.t1
rset.t2 = rset.t1
}
run deleteKeyIsConsistent {
some t:Time,k:Key | deleteKey[t,t.next,k]
} for 5
check deleteKeyIsValid {
all t:Time | init[t] => invs[t]
all t:Time-T/last,k:Key | invs[t] and deleteKey[t,t.next,k] => invs[t.next]
} for 5
/*** PROPRIEDADES ***/
/* Descomentar para verificar as propriedades */
/*** TRACE IDIOM ***/
/*
fact Trace {
init[T/first]
all t:Time-T/last | some n:Node,k:Key | join[t,t.next,n] or putKey[t,t.next,k,n] or deleteKey[t,t.next,k]
}
check TraceIsValid {
all t:Time | invs[t]
}
// Eventualmente todos os nodos vão estar conectados
assert AllJoin {
no t:Time | Network.connected.t = Node
}
// Eventualmente vão existir nodos conectados
assert NeverJoin {
no t:Time | some Network.connected.t
}
check AllJoin for 5 but exactly 2 Node
check NeverJoin for 5 but exactly 2 Node
*/
|
tools-src/gnu/gcc/gcc/ada/gnatmake.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 3998 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T M A K E --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
procedure Gnatmake;
-- The driver for the gnatmake tool. This utility can be used to
-- automatically (re)compile a set of ada sources by giving the name
-- of the root compilation unit or the source file containing it.
-- For more information on gnatmake (its precise usage, flags and algorithm)
-- please refer to the body of gnatmake.
|
text/item_names.asm | adhi-thirumala/EvoYellow | 0 | 171812 | ItemNames:
db "MASTER BALL@"
db "ULTRA BALL@"
db "GREAT BALL@"
db "POKé BALL@"
db "TOWN MAP@"
db "SADDLE@"
db "?????@"
db "SAFARI BALL@"
db "POKéDEX@"
db "MOON STONE@"
db "ANTIDOTE@"
db "BURN HEAL@"
db "ICE HEAL@"
db "AWAKENING@"
db "PARLYZ HEAL@"
db "FULL RESTORE@"
db "LEFTOVERS @"
db "HYPER POTION@"
db "MoomooMILK @"
db "BERRY @"
db "BOULDERBADGE@"
db "CASCADEBADGE@"
db "THUNDERBADGE@"
db "RAINBOWBADGE@"
db "SOULBADGE@"
db "MARSHBADGE@"
db "VOLCANOBADGE@"
db "EARTHBADGE@"
db "ESCAPE ROPE@"
db "REPEL@"
db "OLD AMBER@"
db "FIRE STONE@"
db "THUNDERSTONE@"
db "WATER STONE@"
db "HP UP@"
db "PROTEIN@"
db "IRON@"
db "CARBOS@"
db "CALCIUM@"
db "RARE CANDY@"
db "DOME FOSSIL@"
db "HELIX FOSSIL@"
db "SECRET KEY@"
db "?????@"
db "VOUCHER@"
db "X ACCURACY@"
db "LEAF STONE@"
db "CARD KEY@"
db "NUGGET@"
db "NO UP@"
db "POKé DOLL@"
db "FULL HEAL@"
db "REVIVE@"
db "MAX REVIVE@"
db "GUARD SPEC.@"
db "SUPER REPEL@"
db "MAX REPEL@"
db "DIRE HIT@"
db "COIN@"
db "FRESH WATER@"
db "SODA POP@"
db "LEMONADE@"
db "S.S.TICKET@"
db "GOLD TEETH@"
db "X ATTACK@"
db "X DEFEND@"
db "X SPEED@"
db "X SPECIAL@"
db "COIN CASE@"
db "OAK's PARCEL@"
db "ITEMFINDER@"
db "SILPH SCOPE@"
db "POKé FLUTE@"
db "LIFT KEY@"
db "EXP.ALL@"
db "OLD ROD@"
db "GOOD ROD@"
db "SUPER ROD@"
db "PP UP@"
db "ETHER@"
db "MAX ETHER@"
db "ELIXER@"
db "MAX ELIXER@"
db "B2F@"
db "B1F@"
db "1F@"
db "2F@"
db "3F@"
db "4F@"
db "5F@"
db "6F@"
db "7F@"
db "8F@"
db "9F@"
db "10F@"
db "11F@"
db "B4F@"
db "Sun Stone@"
db "Frost Stone@"
db "Love Stone@" |
programs/oeis/008/A008335.asm | neoneye/loda | 22 | 80874 | <filename>programs/oeis/008/A008335.asm
; A008335: Number of primes dividing p+1 as p runs through the primes.
; 1,1,2,1,2,2,2,2,2,3,1,2,3,2,2,2,3,2,2,2,2,2,3,3,2,3,2,2,3,3,1,3,3,3,3,2,2,2,3,3,3,3,2,2,3,2,2,2,3,3,3,3,2,3,3,3,3,2,2,3,2,3,3,3,2,3,2,2,3,3,3,3,2,3,3,2,4,2,3,3,4,2,2,3,3,3,3,2,4,2,3,3,2,3,2,3,4,3,2,2
seq $0,6005 ; The odd prime numbers together with 1.
seq $0,1221 ; Number of distinct primes dividing n (also called omega(n)).
|
src/shaders/h264/mc/save_4x4_Y.asm | me176c-dev/android_hardware_intel-vaapi-driver | 192 | 92790 | /*
* Save Intra_4x4 decoded Y picture data to frame buffer
* Copyright © <2010>, Intel Corporation.
*
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
*
* This file was originally licensed under the following license
*
* 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.
*
*/
#if !defined(__SAVE_4X4_Y__) // Make sure this is only included once
#define __SAVE_4X4_Y__
// Module name: save_4x4_Y.asm
//
// Save Intra_4x4 decoded Y picture data to frame buffer
// Note: Each 4x4 block is stored in 1 GRF register in the order of block raster scan order,
// i.e. 0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15
save_4x4_Y:
mov (1) MSGSRC.2:ud 0x000F000F:ud {NoDDClr} // Block width and height (16x16)
mov (2) MSGSRC.0:ud I_ORIX<2;2,1>:w {NoDDChk} // X, Y offset
#ifdef DEV_ILK
add (1) MSGDSC MSGDSC MSG_LEN(8)+DWBWMSGDSC_WC-DWBRMSGDSC_RC-0x00200000:ud // Set message descriptor
#else
add (1) MSGDSC MSGDSC MSG_LEN(8)+DWBWMSGDSC_WC-DWBRMSGDSC_RC-0x00020000:ud // Set message descriptor
#endif // DEV_ILK
$for(0; <8; 2) {
mov (16) MSGPAYLOAD(%1)<1> DEC_Y(%1)<16;4,1>
mov (16) MSGPAYLOAD(%1,16)<1> DEC_Y(%1,4)<16;4,1>
mov (16) MSGPAYLOAD(%1+1)<1> DEC_Y(%1,8)<16;4,1>
mov (16) MSGPAYLOAD(%1+1,16)<1> DEC_Y(%1,12)<16;4,1>
}
// Update message descriptor based on previous read setup
//
send (8) REG_WRITE_COMMIT_Y<1>:ud MSGHDR MSGSRC<8;8,1>:ud DAPWRITE MSGDSC
RETURN
// End of save_4x4_Y
#endif // !defined(__SAVE_4X4_Y__)
|
data/moves/assist_exception_moves.asm | AtmaBuster/pokeplat-gen2 | 6 | 6898 | AssistExceptionMoves:
dw ASSIST
dw CHATTER
dw COPYCAT
dw COUNTER
dw COVET
dw DESTINY_BOND
dw DETECT
dw ENDURE
dw FEINT
dw FOCUS_PUNCH
dw FOLLOW_ME
dw HELPING_HAND
dw ME_FIRST
dw METRONOME
dw MIMIC
dw MIRROR_COAT
dw MIRROR_MOVE
dw PROTECT
dw SKETCH
dw SLEEP_TALK
dw SNATCH
dw STRUGGLE
dw SWITCHEROO
dw THIEF
dw TRICK
dw -1
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_918.asm | ljhsiun2/medusa | 9 | 4059 | .global s_prepare_buffers
s_prepare_buffers:
push %rax
push %rbp
push %rcx
push %rdx
lea addresses_D_ht+0x18d73, %rdx
nop
nop
nop
nop
nop
xor %rax, %rax
vmovups (%rdx), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %rbp
nop
nop
nop
xor %rcx, %rcx
pop %rdx
pop %rcx
pop %rbp
pop %rax
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_D+0x9e23, %rsi
lea addresses_D+0x14633, %rdi
clflush (%rsi)
nop
nop
cmp %rax, %rax
mov $56, %rcx
rep movsl
nop
nop
and $32523, %rcx
// Store
lea addresses_PSE+0x16873, %rcx
nop
nop
nop
cmp %r11, %r11
mov $0x5152535455565758, %rbp
movq %rbp, %xmm3
vmovups %ymm3, (%rcx)
nop
nop
sub %rsi, %rsi
// Faulty Load
lea addresses_normal+0x15c73, %rsi
nop
nop
and $23401, %r11
vmovups (%rsi), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %rax
lea oracles, %rsi
and $0xff, %rax
shlq $12, %rax
mov (%rsi,%rax,1), %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 32, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'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
*/
|
programs/oeis/077/A077958.asm | neoneye/loda | 22 | 88900 | <gh_stars>10-100
; A077958: Expansion of 1/(1-2*x^3).
; 1,0,0,2,0,0,4,0,0,8,0,0,16,0,0,32,0,0,64,0,0,128,0,0,256,0,0,512,0,0,1024,0,0,2048,0,0,4096,0,0,8192,0,0,16384,0,0,32768,0,0,65536,0,0,131072,0,0,262144,0,0,524288,0,0,1048576,0,0,2097152,0,0,4194304,0,0,8388608,0,0,16777216,0,0,33554432,0,0,67108864,0,0,134217728,0,0,268435456,0,0,536870912,0,0,1073741824,0,0,2147483648,0,0,4294967296,0,0,8589934592
mov $2,$0
lpb $0
mov $0,$2
dif $0,3
add $1,1
mul $1,2
lpe
pow $1,$0
mov $0,$1
|
Lib/site-packages/wx-2.8-msw-unicode/wx/tools/Editra/tests/syntax/netwide_assembler.nasm | ekkipermana/robotframework-test | 27 | 3287 | ; Syntax Highlighting Test File for NASM
; Some Comments about this file
; Hello World in NASM
section .text
_start:
push dword len
push dword msg
push dword 1
mov eax, 0x4
call _syscall
add esp, 12
push dword 0
mov eax, 0x1
call _syscall
_syscall:
int 0x80
ret
msg db "Hello World",0xa
len equ $ - msg
|
platform-core/src/main/resources/DataModel.g4 | xj2jx/wecube-platform | 0 | 3786 | <filename>platform-core/src/main/resources/DataModel.g4
grammar DataModel;
route
: link fetch
| entity fetch
;
link
: entity by bwd_node
| fwd_node to entity
| link fetch to entity
| link by bwd_node
;
fetch
: DOT attr
;
to
: GT
;
by
: TILDE
;
fwd_node
: entity DOT attr
;
bwd_node
: LP attr RP entity
;
entity
: pkg SC ety
;
pkg
: ID
| DQM
;
ety
: ID
;
attr
: ID
;
TILDE : '~';
GT : '>';
DOT : '.';
LP : '(';
RP : ')';
DC : ':'':';
SC : ':';
DQM : '"''"';
//LSB : '[';
//RSB : ']';
//MEMBER: LSB ID RSB;
ID : Letter LetterOrDigit*;
PKG_ID : ID;
fragment Letter: [a-zA-Z!@#$%^&*_-];
fragment Digit: [0-9];
fragment LetterOrDigit: Letter | Digit;
WS : [ \t\r\n]+ -> skip; // skip spaces, tabs, newlines |
programs/oeis/072/A072481.asm | neoneye/loda | 22 | 80447 | <reponame>neoneye/loda
; A072481: a(n) = Sum_{k=1..n} Sum_{d=1..k} (k mod d).
; 0,0,0,1,2,6,9,17,25,37,50,72,89,117,148,184,220,271,318,382,443,513,590,688,773,876,988,1113,1237,1388,1526,1693,1860,2044,2241,2459,2657,2890,3138,3407,3665,3962,4246,4571,4899,5238,5596,5999,6373,6787,7207,7656,8110,8615,9107,9636,10156,10709,11287,11922,12508,13153,13825,14518,15211,15949,16674,17464,18263,19103,19938,20842,21694,22617,23573,24554,25546,26595,27631,28744,29830,30956,32119,33363,34550,35798,37085,38425,39760,41182,42549,43985,45436,46944,48495,50115,51674,53328,55006,56725
mov $3,$0
mov $5,$0
lpb $3
mov $0,$5
mov $2,0
sub $3,1
sub $0,$3
mov $6,0
lpb $0
sub $0,1
add $2,1
mov $4,$0
mod $4,$2
add $6,$4
lpe
add $1,$6
lpe
mov $0,$1
|
programs/oeis/131/A131506.asm | neoneye/loda | 22 | 1121 | <gh_stars>10-100
; A131506: 2n+1 appears 2n-1 times.
; 3,5,5,5,7,7,7,7,7,9,9,9,9,9,9,9,11,11,11,11,11,11,11,11,11,13,13,13,13,13,13,13,13,13,13,13,15,15,15,15,15,15,15,15,15,15,15,15,15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,19,19,19,19,19,19,19,19,19,19,19
lpb $0
add $1,2
sub $0,$1
trn $0,1
lpe
div $1,2
mul $1,2
add $1,3
mov $0,$1
|
release/src/router/gmp/source/mpn/powerpc64/logops_n.asm | zhoutao0712/rtn11pb1 | 184 | 28776 | dnl PowerPC-64 mpn_and_n, mpn_andn_n, mpn_nand_n, mpn_ior_n, mpn_iorn_n,
dnl mpn_nior_n, mpn_xor_n, mpn_xnor_n -- mpn bitwise logical operations.
dnl Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C POWER3/PPC630: 1.75
C POWER4/PPC970: 2.10
C n POWER3/PPC630 POWER4/PPC970
C 1 15.00 15.33
C 2 7.50 7.99
C 3 5.33 6.00
C 4 4.50 4.74
C 5 4.20 4.39
C 6 3.50 3.99
C 7 3.14 3.64
C 8 3.00 3.36
C 9 3.00 3.36
C 10 2.70 3.25
C 11 2.63 3.11
C 12 2.58 3.00
C 13 2.61 3.02
C 14 2.42 2.82
C 15 2.40 2.79
C 50 2.08 2.67
C 100 1.85 2.31
C 200 1.80 2.18
C 400 1.77 2.14
C 1000 1.76 2.10#
C 2000 1.75# 2.13
C 4000 2.30 2.57
C 8000 2.62 2.58
C 16000 2.52 4.25
C 32000 2.49 16.25
C 64000 2.66 18.76
ifdef(`OPERATION_and_n',
` define(`func',`mpn_and_n')
define(`logop', `and')')
ifdef(`OPERATION_andn_n',
` define(`func',`mpn_andn_n')
define(`logop', `andc')')
ifdef(`OPERATION_nand_n',
` define(`func',`mpn_nand_n')
define(`logop', `nand')')
ifdef(`OPERATION_ior_n',
` define(`func',`mpn_ior_n')
define(`logop', `or')')
ifdef(`OPERATION_iorn_n',
` define(`func',`mpn_iorn_n')
define(`logop', `orc')')
ifdef(`OPERATION_nior_n',
` define(`func',`mpn_nior_n')
define(`logop', `nor')')
ifdef(`OPERATION_xor_n',
` define(`func',`mpn_xor_n')
define(`logop', `xor')')
ifdef(`OPERATION_xnor_n',
` define(`func',`mpn_xnor_n')
define(`logop', `eqv')')
C INPUT PARAMETERS
C rp r3
C up r4
C vp r5
C n r6
MULFUNC_PROLOGUE(mpn_and_n mpn_andn_n mpn_nand_n mpn_ior_n mpn_iorn_n mpn_nior_n mpn_xor_n mpn_xnor_n)
ASM_START()
PROLOGUE(func)
ld r8, 0(r4) C read lowest u limb
ld r9, 0(r5) C read lowest v limb
addi r6, r6, 3 C compute branch count (1)
rldic. r0, r6, 3, 59 C r0 = (n-1 & 3) << 3; cr0 = (n == 4(t+1))?
cmpldi cr6, r0, 16 C cr6 = (n cmp 4t + 3)
ifdef(`HAVE_ABI_mode32',
` rldicl r6, r6, 62,34', C ...branch count
` rldicl r6, r6, 62, 2') C ...branch count
mtctr r6
ld r6, 0(r4) C read lowest u limb (again)
ld r7, 0(r5) C read lowest v limb (again)
add r5, r5, r0 C offset vp
add r4, r4, r0 C offset up
add r3, r3, r0 C offset rp
beq cr0, L(L01)
blt cr6, L(L10)
beq cr6, L(L11)
b L(L00)
L(oop): ld r8, -24(r4)
ld r9, -24(r5)
logop r10, r6, r7
std r10, -32(r3)
L(L00): ld r6, -16(r4)
ld r7, -16(r5)
logop r10, r8, r9
std r10, -24(r3)
L(L11): ld r8, -8(r4)
ld r9, -8(r5)
logop r10, r6, r7
std r10, -16(r3)
L(L10): ld r6, 0(r4)
ld r7, 0(r5)
logop r10, r8, r9
std r10, -8(r3)
L(L01): addi r5, r5, 32
addi r4, r4, 32
addi r3, r3, 32
bdnz L(oop)
logop r10, r6, r7
std r10, -32(r3)
blr
EPILOGUE()
|
core/lib/two-semi-categories/TwoSemiCategories.agda | AntoineAllioux/HoTT-Agda | 294 | 7611 | {-# OPTIONS --without-K --rewriting #-}
module lib.two-semi-categories.TwoSemiCategories where
open import lib.two-semi-categories.FunCategory public
open import lib.two-semi-categories.Functor public
open import lib.two-semi-categories.FunctorInverse public
open import lib.two-semi-categories.FundamentalCategory public
open import lib.two-semi-categories.FunextFunctors public
open import lib.two-semi-categories.GroupToCategory public
|
examples/examplesPaperJFP/Coalgebra.agda | agda/ooAgda | 23 | 8504 | module examplesPaperJFP.Coalgebra where
open import Size
F : Set → Set
mapF : ∀{A B} (f : A → B) → (F A → F B)
--- Dummy implementation to satisfy Agda's positivity checker.
F X = X
mapF f x = f x
S : Set
t : S → F S
data S′ : Set where
S = S′
t x = x
record νF : Set where
coinductive
field force : F νF
open νF using (force)
{-# TERMINATING #-}
unfoldF : ∀{S} (t : S → F S) → (S → νF)
force (unfoldF t s) = mapF (unfoldF t) (t s)
|
src/mqtt_clients.adb | jpuente/Temperature_Sensor | 0 | 4896 |
with GNAT.Sockets.Server; use GNAT.Sockets.Server;
with Strings_Edit.Integers; use Strings_Edit.Integers;
pragma Warnings(Off);
with System.IO; -- for debugging
pragma Warnings(On);
package body MQTT_Clients is
-------------------------
-- On_Connect_Accepted --
-------------------------
procedure On_Connect_Accepted
(Pier : in out MQTT_Client;
Session_Present : Boolean)
is
begin
System.IO.Put_Line("MQTT connect accepted");
end On_Connect_Accepted;
-------------------------
-- On_Connect_Rejected --
-------------------------
procedure On_Connect_Rejected
(Pier : in out MQTT_Client;
Response : Connect_Response)
is
begin
System.IO.Put_Line("Connect rejected " & Image (Response));
end On_Connect_Rejected;
----------------------
-- On_Ping_Response --
----------------------
procedure On_Ping_Response (Pier : in out MQTT_Client) is
begin
System.IO.Put_Line("Ping response");
end On_Ping_Response;
----------------
-- On_Publish --
----------------
procedure On_Publish
(Pier : in out MQTT_Client;
Topic : String;
Message : Stream_Element_Array;
Packet : Packet_Identification;
Duplicate : Boolean;
Retain : Boolean)
is
begin
System.IO.Put_Line("Message " & Topic & " = " & Image(Message));
On_Publish (MQTT_Pier (Pier),
Topic,
Message,
Packet,
Duplicate,
Retain);
end On_Publish;
----------------------------------
-- On_Subscribe_Acknowledgement --
----------------------------------
procedure On_Subscribe_Acknowledgement
(Pier : in out MQTT_Client;
Packet : Packet_Identifier;
Codes : Return_Code_List)
is
begin
for Code of Codes loop
if Code.Success then
System.IO.Put_Line ("Subscribed " & Image (Integer (Packet))
& ":" & QoS_Level'Image (Code.QoS));
else
System.IO.Put_Line ("Subscribe " & Image (Integer (Packet))
& ": failed");
end if;
end loop;
end On_Subscribe_Acknowledgement;
begin
System.IO.Set_Output(System.IO.Standard_Error);
end MQTT_Clients;
|
oeis/060/A060946.asm | neoneye/loda-programs | 11 | 15772 | ; A060946: Trace of Vandermonde matrix of numbers 1,2,...,n, i.e., the matrix A with A[i,j] = i^(j-1), 1 <= i <= n, 1 <= j <= n.
; 1,3,12,76,701,8477,126126,2223278,45269999,1045269999,26982694600,769991065288,24068076187769,817782849441913,30010708874832538,1182932213481679514,49844124089148547995,2235755683827845079963,106363105981739086612804,5349243105981739086612804,283567672552933287723809205,15803016643653822260298660277,923649451419649997667039221606,56495973486848155183045433923430,3609209652287349084538666771814055,240383039660254937961333831710283431,16663586307920913084192801632419538720
mov $3,1
lpb $0
mov $2,$3
add $2,$0
pow $2,$0
sub $0,1
add $1,$2
lpe
mov $0,$1
add $0,1
|
programs/oeis/040/A040540.asm | jmorken/loda | 1 | 105001 | <reponame>jmorken/loda<gh_stars>1-10
; A040540: Continued fraction for sqrt(564).
; 23,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1,46,1,2,1
mov $5,2
mov $8,$0
lpb $5
mov $0,$8
sub $5,1
add $0,$5
sub $0,1
div $0,2
add $2,2
mov $4,1
mov $7,$0
div $0,$2
sub $2,2
mov $3,$5
add $4,$0
add $4,$0
mul $4,22
add $4,$7
mov $6,$4
lpb $3
mov $1,$6
sub $3,1
lpe
lpe
lpb $8
sub $1,$6
mov $8,0
lpe
add $1,1
|
Cubical/Algebra/CommMonoid.agda | FernandoLarrain/cubical | 1 | 13694 | <reponame>FernandoLarrain/cubical
{-# OPTIONS --safe #-}
module Cubical.Algebra.CommMonoid where
open import Cubical.Algebra.CommMonoid.Base public
open import Cubical.Algebra.CommMonoid.Properties public
|
programs/oeis/128/A128543.asm | neoneye/loda | 22 | 6758 | ; A128543: a(n) = floor(2^(n-2)*3*n).
; 1,6,18,48,120,288,672,1536,3456,7680,16896,36864,79872,172032,368640,786432,1671168,3538944,7471104,15728640,33030144,69206016,144703488,301989888,629145600,1308622848,2717908992,5637144576,11676942336,24159191040,49928994816,103079215104,212600881152,438086664192,901943132160,1855425871872,3813930958848,7834020347904,16080357556224,32985348833280,67619965108224,138538465099776,283673999966208,580542139465728,1187472557998080,2427721674129408,4960996464525312,10133099161583616,20688410788233216,42221246506598400,86131342873460736,175640385467449344,358036170375954432,729583139634020352,1486187877032263680,3026418949592973312,6160924290242838528,12538021362599460864,25508388289426489344,51881467707308113920,105492317671526498304,214443399856873537536,435804328741388156928,885443715538058477568,1798557547186681282560,3652455326594491219968,7415591117631239749632,15052543164146994118656,30547808186063017476096,61981060087664093429760,125733007606404303814656,255007790074960841539584,517099129874226150899712,1048365359197061237440512,2125064917291340346163200,4306798232377116434890752,8726933260343104354910208,17680540111863951680077824,35814427406083389300670464,72535549176877750482370560,146884487083177444726800384,297395751625198776977719296,602045058168085329003675648,1218597226171546208103825408,2466208672013843516400599040,4990445783369189233187094528,10096948445421382867145981952,20426010648208774535835549696,41316248811149566674758270976,83560952651763168555690885120,168978815362454407523730456576,341671450842764955872158285824,690770541921242193393711316992,1396396364313908950086212124672,2822503289570667026770003230720,5704427701027032306735164424192,11527697645825461119860644773888,23293079779193715252501921398784,47061528533473016530565106499584,95073795017117205112252740403200
mov $1,$0
mul $0,3
add $0,3
mov $2,2
pow $2,$1
mul $0,$2
div $0,2
|
Examples/Recursive_Fibonacci.asm | Pyxxil/rust-lc3-as | 3 | 245227 | ;
; A program that recursively calaculates and outputs a given amount of fibonacci numbers
; (3 to 23 inclusively).
;
; --------------------------------------------------------------
; What each Register is used for in the three parts of the program
; -- Getting input
; -- Converting the current fibonacci number to ASCII
; -- Recursively finding the Nth Fibonacci Number
; --------------------------------------------------------------
;
; Getting input | Converting to ASCII | Recursion
; R0 -- Input and output | R0 -- Output | R0 -- Result stack pointer
; R1 -- The current input | R1 -- Unused | R1 -- Unused
; R2 -- Unused | R2 -- The digit position | R2 -- Stack pointer
; R3 -- Used to compare values | R3 -- Number of digits output | R3 -- The current N
; R4 -- Used to multiply by ten | R4 -- The current place | R4 -- Temporary Value stack pointer
; R5 -- Used as the character count | R5 -- The number to convert | R5 -- The fibonacci number
; R6 -- Used to multiply by ten | R6 -- The current digit | R6 -- Temporary Values
; R7 -- Return address | R7 -- Return address | R7 -- Return address
;
.ORIG 0x3000
; Start by putting the prompt to the screen.
OUT_PROMPT:
LEA R0, PROMPT ; Load the prompt into R0.
PUTS ; Put it to the display.
; Initialise Registers for the first part of the program.
.SET R5, #10 ; Set R5 to ten, its our character counter.
LD R1, NUMBER ; Load the number into R1.
JSR CLEAR_FLAG ; Clear any flags added.
; Repeatedly retrieve a character as input until a newline is pressed, or 10
; characters have been input.
GET_INPUT:
GETC ; Get a character.
OUT ; Put the character to the output.
ADD R3, R0, #-10 ; Check if the input was the newline character.
BRz CHECK_INPUT ; If yes, check what the input was.
; Compare input character against 9.
LD R3, NINE ; Load the value in NINE into R3.
.SUB R3, R0, R3 ; Check that R0 is < '9'
BRp FLAG_THAT ; If the character's ascii value is greater
; than 9's, flag it.
; Compare input character against 0.
LD R3, ZERO ; Load the value of ZER0 into R3.
.SUB R3, R0, R3 ; Check that R0 > '0'
BRn FLAG_THAT ; If the character's ascii value is less than 0's,
; flag it.
; So, the character is a digit. Update the number.
ADD R6, R5, #-10 ; Check the amount of characters input.
BRn CHECK_ZERO ; Make sure that if the first character was a 0,
; pass it.
BRz SET_TO ; If this is the first character, then set the
; count to this number.
BR MULTIPLY_BY_TEN ; Always multiply the current number by ten if
; it doesn't get updated by the above.
; The user entered too many characters, so print a prompt telling them so, and go back
; to the beginning of the program.
TOO_MANY_CHARS:
LEA R0, TOO_MANY
PUTS
BR OUT_PROMPT
TOO_MANY .STRINGZ "\nEntered too many characters (Max 10).\n"
; Decrement the input counter by one.
DECREMENT_INPUT_COUNTER:
ADD R5, R5, #-1 ; Subtract 1 from the loop counter stored in R5.
BRz TOO_MANY_CHARS ; We've reached the max character count, so start
; again.
BR GET_INPUT
; Set the number to the input.
SET_TO:
ADD R1, R3, #0 ; Set the number to the current input.
BR DECREMENT_INPUT_COUNTER
; Multiply the number by 10
MULTIPLY_BY_TEN:
JSR CHECK_FLAG ; Jump to check if we have flagged something,
; this will only return here if we have not flagged something.
ADD R4, R1, R1 ; Store 2x R1 in R4.
.LSHIFT R1, 3 ; R1 = R1 << 3
ADD R1, R4, R1 ; R1 = 8xR1 + 2xR1
ADD R1, R1, R3 ; Add the current number.
ADD R4, R1, #-16 ; We don't want numbers greater than 23.
ADD R4, R4, #-7 ; Because we can't add numbers less than -16,
; we do this twice.
BRp FLAG_THAT ; If the number is greater than 23, no need to
; keep going.
BR DECREMENT_INPUT_COUNTER
; Check if we've flagged something, and if so then skip over the input.
CHECK_FLAG:
LD R4, FLAG ; Load the value in FLAG into R4.
ADD R4, R4, #-1 ; Add -1 to it.
; If the value in R4 is 0, then the FLAG was set.
BRz DECREMENT_INPUT_COUNTER
RET
; Check if the previous number input was a zero, and if so just flag it because
; its not useable.
CHECK_ZERO:
ADD R6, R1, #-1 ; Set R6 to be equal to R1 - 1.
BRn FLAG_THAT ; If R6 is less than 0, then R1 must have been 0,
; so flag it.
BR MULTIPLY_BY_TEN ; Otherwise, multiply the current number by 10.
; Something incorrect was entered.
FLAG_THAT:
LEA R4, FLAG ; Load the address of FLAG into R4.
.SET R6, #1 ; Reset R6.
STR R6, R4, #0 ; Set the flag.
BR DECREMENT_INPUT_COUNTER
; Clear the flag
CLEAR_FLAG:
LEA R4, FLAG ; Load the address of FLAG into R4.
AND R6, R6, #0 ; Reset R6.
STR R6, R4, #0 ; Store R6's value (0) into the address of R4,
; with offset 0.
RET
; Check the input for anything incorrect
CHECK_INPUT:
LD R3, FLAG ; Load whats in FLAG to R3.
ADD R3, R3, #-1 ; If R3 == 1, then something went wrong
BRzp OUT_PROMPT ; so start again.
ADD R4, R1, #-1 ; We also don't want numbers less than 1
BRn OUT_PROMPT ; so start again.
; Note, we don't have to check if the number is greater than 23 because
; we already did that in MULTIPLY_BY_TEN.
ST R1, NUMBER ; Store the value of R1 into the address.
BR INIT_LOOP ; Get ready to find the Nth Fibonacci number.
; Take a number in R5 and convert each digit to ASCII to print to the display.
CONVERT_TO_ASCII:
ST R7, SAVER7 ; Store the return address.
LEA R2, NUMBERS ; Load the numbers to use into R2.
AND R6, R6, #0 ; The digit in the current place.
AND R3, R3, #0 ; The number of digits displayed.
; Outer loop to initialise for the inner loop
OUTER_LOOP:
LDR R4, R2, #0 ; Load the current place into R4.
BRz END ; If that number is 0, we're done.
.NEG R4 ; Negate R4
; Inner loop which handles all of the subtracting
INNER_LOOP:
ADD R5, R5, R4 ; Subtract the current number from R5.
BRn CHECK_DIGIT ; and if R5 is now negative, then we've got the
; digit in R6.
ADD R6, R6, #1 ; Otherwise, add 1 the digit in the current place.
BR INNER_LOOP ; And loop again.
; We've found what the digit is, so lets check some things.
CHECK_DIGIT:
ADD R6, R6, #0 ; If R6 is greater than 0, output it.
BRp OUTPUT
ADD R3, R3, #0 ; Otherwise, if there are no other digits output
BRz INCREMENT ; then skip.
; Output the digit at the current place.
OUTPUT:
LD R0, ZERO ; Load the ascii value for 0 into R0.
ADD R0, R0, R6 ; Add the digit to get the ascii value for it.
OUT ; Display it.
ADD R3, R3, #1 ; We've output a digit, so increment the amount
; of digits we've output.
; The end of a loop, so lets increment a few things.
INCREMENT:
ADD R2, R2, #1 ; Increment the pointer to the numbers.
AND R6, R6, #0 ; Clear R6 so it can be used again.
.SUB R5, R5, R4 ; Make R5 the positive value
BR OUTER_LOOP
; We've reached the last digit, so display it and return.
END:
LD R0, ZERO ; We want to find the digits ascii value, so add
ADD R0, R0, R5 ; it to the ascii value for 0.
OUT
LD R0, SPACE ; Print a space character between each fibonacci
OUT ; number.
LD R7, SAVER7 ; Reload the return address.
RET
; These have to go here, otherwise their offset will be too great for the 9 bit
; offset that can be provided to most of the memory access/writer instructions.
SAVER7 .FILL 0
; Strings that will be used throughout the program
PROMPT .STRINGZ "\nEnter a number from 1 to 23: "
SPACE .FILL 0x20 ; A space character has the ascii value of 0x20, too large
; for an immediate offset to ADD.
NUMBER .FILL 0 ; The number that we will use as the number of fibonacci
; numbers we want.
FLAG .FILL 0 ; A way to tell the program we've received input we don't want.
; ASCII values that will be used to check input, as well as convert to ASCII.
ZERO .FILL #48
NINE .FILL #57
; Values that we will use to output the current fibonacci number to the screen.
NUMBERS .FILL #10000
.FILL #1000
.FILL #100
.FILL #10
.FILL #0 ; So we can tell when we've reached the last digit.
; Getting input | Converting to ASCII | Recursion
; R0 -- Input and output | R0 -- Output | R0 -- Result stack pointer
; R1 -- The current input | R1 -- Unused | R1 -- Unused
; R2 -- Unused | R2 -- The digit position | R2 -- Stack pointer
; R3 -- Used to compare values | R3 -- Number of digits output | R3 -- The current N
; R4 -- Used to multiply by ten | R4 -- The current place | R4 -- Temporary Value stack pointer
; R5 -- Used as the character count | R5 -- The number to convert | R5 -- The fibonacci number
; R6 -- Used to multiply by ten | R6 -- The current digit | R6 -- Temporary Values
; R7 -- Return address | R7 -- Return address | R7 -- Return address
; ---------------------------------------------------;
; Recursive function to find the Nth fibonacci number;
;----------------------------------------------------;
RECURSIVE_FIBONACCI:
STR R7, R2, #0 ; Store return address.
ADD R2, R2, #1 ; Increment stack pointer.
ADD R6, R3, #-3 ; If the current number is 0,
BRn BASE_CASE ; then we've reached one of the base cases.
ADD R3, R3, #-1 ; N - 1.
STR R3, R4, #0 ; Save R3 to temp.
ADD R4, R4, #1 ; Increment the Temporary stack pointer.
JSR RECURSIVE_FIBONACCI ; Recurse with N - 1.
ADD R4, R4, #-1 ; Decrement the Temporary stack pointer.
LDR R3, R4, #0 ; Retrieve N from the stack.
ADD R3, R3, #-1 ; N = N - 2.
JSR RECURSIVE_FIBONACCI ; Recurse with N - 2.
LDR R3, R0, #-1 ; Load result of Fib(N - 1).
LDR R5, R0, #-2 ; Load result of Fib(N - 2).
ADD R0, R0, #-2 ; Reset stack pointer.
ADD R5, R5, R3 ; Add the recursive results together
BR RETURN ; and return.
BASE_CASE:
AND R5, R5, #0 ; We hit a base case,
ADD R5, R5, #1 ; so we want to return 1.
; We've found this fibonacci number, so return to the last return address stored
; in the stack.
RETURN:
ADD R2, R2, #-1 ; Decrement the stack pointer.
LDR R7, R2, #0 ; Load return address from stack.
STR R5, R0, #0 ; Save the result to the Result stack.
ADD R0, R0, #1 ; Increment result stack.
RET ; Result is in Result stack, so return.
; Initialise some registers.
INIT_LOOP:
LD R3, COUNT ; The fibonacci sequence number we want to compute.
; Start looping upwards towards the number input by the user.
LOOP:
LEA R2, STACK ; R2 is now the stack pointer.
LEA R0, RESULT_STACK ; R0 is now the pointer to the result stack.
LEA R4, TEMP_VAL_STACK ; R4 is now the pointer to the temporary value stack.
JSR RECURSIVE_FIBONACCI ; Find the fibonacci number.
ADD R0, R0,#-1 ; Decrement the stack pointer, as the result is at
; the top.
LDR R5, R0,#0 ; Load R5 from stack.
JSR CONVERT_TO_ASCII ; Display the fibonacci number.
LD R3, COUNT ; Load the current count into R3.
LD R6, NUMBER ; Load the original input into R6.
.SUB R6, R3, R6 ; Compare input and count
BRz FINISH ; If so, then finish the program.
ADD R3, R3, #1 ; Otherwise, add 1 to the count
ST R3, COUNT ; store the new count into NUMBER
BR LOOP ; and loop again.
; We've finished finding the fibonacci numbers, so end the program.
FINISH: HALT
; The loop count (will also be used to find the fibonacci number we want).
COUNT .FILL 1
SAVER .FILL SAVER7
LOOPER .FILL INIT_LOOP
; Our stack pointers.
STACK .BLKW #100 0 ; Return address and frame stack pointer.
RESULT_STACK .BLKW #100 0 ; Result stack pointer, holds all results during
; the recursion.
TEMP_VAL_STACK .BLKW #100 0 ; To store all temporary values we use.
.END
|
Transynther/x86/_processed/US/_st_/i7-8650U_0xd2.log_2_722.asm | ljhsiun2/medusa | 9 | 3776 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %r15
push %r8
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x151f7, %rsi
lea addresses_UC_ht+0x184f7, %rdi
nop
nop
xor %r15, %r15
mov $118, %rcx
rep movsq
nop
nop
nop
nop
nop
sub %r11, %r11
lea addresses_WT_ht+0x1c4f7, %r14
nop
nop
nop
nop
and $28756, %rdi
mov $0x6162636465666768, %r15
movq %r15, %xmm4
vmovups %ymm4, (%r14)
nop
nop
xor %rsi, %rsi
lea addresses_WC_ht+0x93f7, %rsi
lea addresses_normal_ht+0x18777, %rdi
clflush (%rsi)
nop
nop
and %r13, %r13
mov $73, %rcx
rep movsq
nop
nop
and $2189, %rdi
lea addresses_normal_ht+0x1e5d7, %rsi
nop
nop
add %r15, %r15
movups (%rsi), %xmm0
vpextrq $1, %xmm0, %rcx
nop
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_UC_ht+0x31f7, %rsi
lea addresses_A_ht+0x3f7, %rdi
nop
nop
nop
nop
nop
sub %r8, %r8
mov $84, %rcx
rep movsw
nop
cmp $38515, %r8
lea addresses_UC_ht+0x169f7, %r13
nop
nop
nop
nop
nop
add $30551, %r15
mov (%r13), %esi
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_UC_ht+0x1a1fb, %rsi
lea addresses_A_ht+0x1a5f7, %rdi
nop
nop
nop
nop
cmp %r15, %r15
mov $36, %rcx
rep movsw
nop
add $33614, %r15
lea addresses_normal_ht+0xb7f7, %rsi
lea addresses_A_ht+0xdff7, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
and %r15, %r15
mov $2, %rcx
rep movsb
nop
nop
nop
nop
nop
add $37896, %rdi
lea addresses_A_ht+0xb9f7, %r15
nop
nop
cmp $37837, %r13
movups (%r15), %xmm5
vpextrq $1, %xmm5, %rcx
nop
add %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r15
push %rax
push %rbp
push %rcx
// Store
lea addresses_UC+0x181f7, %r13
nop
nop
nop
nop
nop
add $38718, %rcx
movb $0x51, (%r13)
nop
dec %r15
// Load
lea addresses_US+0x171f7, %r10
nop
nop
nop
sub %rbp, %rbp
movups (%r10), %xmm6
vpextrq $0, %xmm6, %r11
nop
nop
nop
inc %r11
// Store
lea addresses_A+0x13cf7, %r15
nop
and $12713, %r11
movw $0x5152, (%r15)
nop
cmp $0, %rax
// Load
mov $0x20f64700000001f7, %rcx
sub $1563, %r13
mov (%rcx), %rbp
nop
nop
nop
nop
nop
add %rax, %rax
// Faulty Load
lea addresses_US+0x171f7, %r15
sub %rbp, %rbp
mov (%r15), %eax
lea oracles, %r10
and $0xff, %rax
shlq $12, %rax
mov (%r10,%rax,1), %rax
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'51': 2}
51 51
*/
|
Multidimensional/NNat.agda | wrrnhttn/agda-cubical-multidimensional | 0 | 10858 | {-# OPTIONS --cubical #-}
open import Cubical.Core.Glue
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Univalence
open import Cubical.Foundations.Isomorphism
open import Cubical.Data.Nat
open import Cubical.Data.Empty
open import Cubical.Data.Unit
open import Cubical.Data.Prod
open import Cubical.Data.BinNat
open import Cubical.Data.Bool
open import Cubical.Relation.Nullary
open import Direction
module NNat where
-- much of this is based directly on the
-- BinNat module in the Cubical Agda library
data BNat : Type₀ where
b0 : BNat
b1 : BNat
x0 : BNat → BNat
x1 : BNat → BNat
sucBNat : BNat → BNat
sucBNat b0 = b1
sucBNat b1 = x0 b1
sucBNat (x0 bs) = x1 bs
sucBNat (x1 bs) = x0 (sucBNat bs)
BNat→ℕ : BNat → ℕ
BNat→ℕ b0 = 0
BNat→ℕ b1 = 1
BNat→ℕ (x0 x) = doubleℕ (BNat→ℕ x)
BNat→ℕ (x1 x) = suc (doubleℕ (BNat→ℕ x))
-- BNat→Binℕ : BNat → Binℕ
-- BNat→Binℕ pos0 = binℕ0
-- BNat→Binℕ pos1 = binℕpos pos1
-- BNat→Binℕ (x0 x) = {!binℕpos (x0 binℕpos (BNat→Binℕ x))!}
-- BNat→Binℕ (x1 x) = {!!}
BNat→ℕsucBNat : (b : BNat) → BNat→ℕ (sucBNat b) ≡ suc (BNat→ℕ b)
BNat→ℕsucBNat b0 = refl
BNat→ℕsucBNat b1 = refl
BNat→ℕsucBNat (x0 b) = refl
BNat→ℕsucBNat (x1 b) = λ i → doubleℕ (BNat→ℕsucBNat b i)
ℕ→BNat : ℕ → BNat
ℕ→BNat zero = b0
ℕ→BNat (suc zero) = b1
ℕ→BNat (suc (suc n)) = sucBNat (ℕ→BNat (suc n))
ℕ→BNatSuc : ∀ n → ℕ→BNat (suc n) ≡ sucBNat (ℕ→BNat n)
ℕ→BNatSuc zero = refl
ℕ→BNatSuc (suc n) = refl
bNatInd : {P : BNat → Type₀} → P b0 → ((b : BNat) → P b → P (sucBNat b)) → (b : BNat) → P b
-- prove later...
BNat→ℕ→BNat : (b : BNat) → ℕ→BNat (BNat→ℕ b) ≡ b
BNat→ℕ→BNat b = bNatInd refl hs b
where
hs : (b : BNat) → ℕ→BNat (BNat→ℕ b) ≡ b → ℕ→BNat (BNat→ℕ (sucBNat b)) ≡ sucBNat b
hs b hb =
ℕ→BNat (BNat→ℕ (sucBNat b))
≡⟨ cong ℕ→BNat (BNat→ℕsucBNat b) ⟩
ℕ→BNat (suc (BNat→ℕ b))
≡⟨ ℕ→BNatSuc (BNat→ℕ b) ⟩
sucBNat (ℕ→BNat (BNat→ℕ b))
≡⟨ cong sucBNat hb ⟩
sucBNat b
∎
ℕ→BNat→ℕ : (n : ℕ) → BNat→ℕ (ℕ→BNat n) ≡ n
ℕ→BNat→ℕ zero = refl
ℕ→BNat→ℕ (suc n) =
BNat→ℕ (ℕ→BNat (suc n))
≡⟨ cong BNat→ℕ (ℕ→BNatSuc n) ⟩
BNat→ℕ (sucBNat (ℕ→BNat n))
≡⟨ BNat→ℕsucBNat (ℕ→BNat n) ⟩
suc (BNat→ℕ (ℕ→BNat n))
≡⟨ cong suc (ℕ→BNat→ℕ n) ⟩
suc n
∎
BNat≃ℕ : BNat ≃ ℕ
BNat≃ℕ = isoToEquiv (iso BNat→ℕ ℕ→BNat ℕ→BNat→ℕ BNat→ℕ→BNat)
BNat≡ℕ : BNat ≡ ℕ
BNat≡ℕ = ua BNat≃ℕ
open NatImpl
NatImplBNat : NatImpl BNat
z NatImplBNat = b0
s NatImplBNat = sucBNat
--
data np (r : ℕ) : Type₀ where
bp : DirNum r → np r
zp : ∀ (d d′ : DirNum r) → bp d ≡ bp d′
xp : DirNum r → np r → np r
sucnp : ∀ {r} → np r → np r
sucnp {zero} (bp tt) = xp tt (bp tt)
sucnp {zero} (zp tt tt i) = xp tt (bp tt)
sucnp {zero} (xp tt n) = xp tt (sucnp n)
sucnp {suc r} (bp d) = xp (one-n (suc r)) (bp d)
sucnp {suc r} (zp d d′ i) = xp (one-n (suc r)) (zp d d′ i)
sucnp {suc r} (xp d n) with max? d
... | no _ = xp (next d) n
... | yes _ = xp (zero-n (suc r)) (sucnp n)
np→ℕ : (r : ℕ) (x : np r) → ℕ
np→ℕ r (bp x) = 0
np→ℕ r (zp d d′ i) = 0
np→ℕ zero (xp x x₁) = suc (np→ℕ zero x₁)
np→ℕ (suc r) (xp x x₁) = sucn (DirNum→ℕ x) (doublesℕ (suc r) (np→ℕ (suc r) x₁))
ℕ→np : (r : ℕ) → (n : ℕ) → np r
ℕ→np r zero = bp (zero-n r)
ℕ→np zero (suc n) = xp tt (ℕ→np zero n)
ℕ→np (suc r) (suc n) = sucnp (ℕ→np (suc r) n)
---- generalize bnat:
data N (r : ℕ) : Type₀ where
bn : DirNum r → N r
xr : DirNum r → N r → N r
-- should define induction principle for N r
-- we have 2ⁿ "unary" constructors, analogous to BNat with 2¹ (b0 and b1)
-- rename n to r
-- this likely introduces inefficiencies compared
-- to BinNat, with the max? check etc.
sucN : ∀ {n} → N n → N n
sucN {zero} (bn tt) = xr tt (bn tt)
sucN {zero} (xr tt x) = xr tt (sucN x)
sucN {suc n} (bn (↓ , ds)) = (bn (↑ , ds))
sucN {suc n} (bn (↑ , ds)) with max? ds
... | no _ = (bn (↓ , next ds))
... | yes _ = xr (zero-n (suc n)) (bn (one-n (suc n)))
sucN {suc n} (xr d x) with max? d
... | no _ = xr (next d) x
... | yes _ = xr (zero-n (suc n)) (sucN x)
sucnN : {r : ℕ} → (n : ℕ) → (N r → N r)
sucnN n = iter n sucN
doubleN : (r : ℕ) → N r → N r
doubleN zero (bn tt) = bn tt
doubleN zero (xr d x) = sucN (sucN (doubleN zero x))
doubleN (suc r) (bn x) with zero-n? x
... | yes _ = bn x
-- bad:
... | no _ = caseBool (bn (doubleDirNum (suc r) x)) (xr (zero-n (suc r)) (bn x)) (doubleable-n? x)
-- ... | no _ | doubleable = {!bn (doubleDirNum x)!}
-- ... | no _ | notdoubleable = xr (zero-n (suc r)) (bn x)
doubleN (suc r) (xr x x₁) = sucN (sucN (doubleN (suc r) x₁))
doublesN : (r : ℕ) → ℕ → N r → N r
doublesN r zero m = m
doublesN r (suc n) m = doublesN r n (doubleN r m)
N→ℕ : (r : ℕ) (x : N r) → ℕ
N→ℕ zero (bn tt) = zero
N→ℕ zero (xr tt x) = suc (N→ℕ zero x)
N→ℕ (suc r) (bn x) = DirNum→ℕ x
N→ℕ (suc r) (xr d x) = sucn (DirNum→ℕ d) (doublesℕ (suc r) (N→ℕ (suc r) x))
N→ℕsucN : (r : ℕ) (x : N r) → N→ℕ r (sucN x) ≡ suc (N→ℕ r x)
N→ℕsucN zero (bn tt) = refl
N→ℕsucN zero (xr tt x) =
suc (N→ℕ zero (sucN x))
≡⟨ cong suc (N→ℕsucN zero x) ⟩
suc (suc (N→ℕ zero x))
∎
N→ℕsucN (suc r) (bn (↓ , d)) = refl
N→ℕsucN (suc r) (bn (↑ , d)) with max? d
... | no d≠max =
doubleℕ (DirNum→ℕ (next d))
≡⟨ cong doubleℕ (next≡suc r d d≠max) ⟩
doubleℕ (suc (DirNum→ℕ d))
∎
... | yes d≡max = -- this can probably be shortened by not reducing down to zero
sucn (doubleℕ (DirNum→ℕ (zero-n r)))
(doublesℕ r (suc (suc (doubleℕ (doubleℕ (DirNum→ℕ (zero-n r)))))))
≡⟨ cong (λ x → sucn (doubleℕ x) (doublesℕ r (suc (suc (doubleℕ (doubleℕ x)))))) (zero-n→0 {r}) ⟩
sucn (doubleℕ zero) (doublesℕ r (suc (suc (doubleℕ (doubleℕ zero)))))
≡⟨ refl ⟩
doublesℕ (suc r) (suc zero) -- 2^(r+1)
≡⟨ sym (doubleDoubles r 1) ⟩
doubleℕ (doublesℕ r (suc zero)) --2*2^r
≡⟨ sym (sucPred (doubleℕ (doublesℕ r (suc zero))) (doubleDoublesOne≠0 r)) ⟩
suc (predℕ (doubleℕ (doublesℕ r (suc zero))))
≡⟨ cong suc (sym (sucPred (predℕ (doubleℕ (doublesℕ r (suc zero)))) (predDoubleDoublesOne≠0 r))) ⟩
suc (suc (predℕ (predℕ (doubleℕ (doublesℕ r (suc zero))))))
≡⟨ cong (λ x → suc (suc x)) (sym (doublePred (doublesℕ r (suc zero)))) ⟩
suc (suc (doubleℕ (predℕ (doublesℕ r (suc zero)))))
≡⟨ cong (λ x → suc (suc (doubleℕ x))) (sym (maxr≡pred2ʳ r d d≡max)) ⟩
suc (suc (doubleℕ (DirNum→ℕ d))) -- 2*(2^r - 1) + 2 = 2^(r+1) - 2 + 2 = 2^(r+1)
∎
N→ℕsucN (suc r) (xr (↓ , d) x) = refl
N→ℕsucN (suc r) (xr (↑ , d) x) with max? d
... | no d≠max =
sucn (doubleℕ (DirNum→ℕ (next d)))
(doublesℕ r (doubleℕ (N→ℕ (suc r) x)))
≡⟨ cong (λ y → sucn (doubleℕ y) (doublesℕ r (doubleℕ (N→ℕ (suc r) x)))) (next≡suc r d d≠max) ⟩
sucn (doubleℕ (suc (DirNum→ℕ d)))
(doublesℕ r (doubleℕ (N→ℕ (suc r) x)))
≡⟨ refl ⟩
suc
(suc
(iter (doubleℕ (DirNum→ℕ d)) suc
(doublesℕ r (doubleℕ (N→ℕ (suc r) x)))))
∎
... | yes d≡max =
sucn (doubleℕ (DirNum→ℕ (zero-n r)))
(doublesℕ r (doubleℕ (N→ℕ (suc r) (sucN x))))
≡⟨ cong (λ z → sucn (doubleℕ z) (doublesℕ r (doubleℕ (N→ℕ (suc r) (sucN x))))) (zero-n≡0 {r}) ⟩
sucn (doubleℕ zero)
(doublesℕ r (doubleℕ (N→ℕ (suc r) (sucN x))))
≡⟨ refl ⟩
doublesℕ r (doubleℕ (N→ℕ (suc r) (sucN x)))
≡⟨ cong (λ x → doublesℕ r (doubleℕ x)) (N→ℕsucN (suc r) x) ⟩
doublesℕ r (doubleℕ (suc (N→ℕ (suc r) x)))
≡⟨ refl ⟩
doublesℕ r (suc (suc (doubleℕ (N→ℕ (suc r) x)))) -- 2^r * (2x + 2) = 2^(r+1)x + 2^(r+1)
≡⟨ doublesSucSuc r (doubleℕ (N→ℕ (suc r) x)) ⟩
sucn (doublesℕ (suc r) 1) -- _ + 2^(r+1)
(doublesℕ (suc r) (N→ℕ (suc r) x)) -- 2^(r+1)x + 2^(r+1)
≡⟨ H r (doublesℕ (suc r) (N→ℕ (suc r) x)) ⟩
suc
(suc
(sucn (doubleℕ (predℕ (doublesℕ r 1))) -- _ + 2(2^r - 1) + 2
(doublesℕ (suc r) (N→ℕ (suc r) x))))
≡⟨ refl ⟩
suc
(suc
(sucn (doubleℕ (predℕ (doublesℕ r 1)))
(doublesℕ r (doubleℕ (N→ℕ (suc r) x)))))
≡⟨ cong (λ z → suc (suc (sucn (doubleℕ z) (doublesℕ r (doubleℕ (N→ℕ (suc r) x)))))) (sym (max→ℕ r)) ⟩
suc
(suc
(sucn (doubleℕ (DirNum→ℕ (max-n r)))
(doublesℕ r (doubleℕ (N→ℕ (suc r) x)))))
≡⟨ cong (λ z → suc (suc (sucn (doubleℕ (DirNum→ℕ z)) (doublesℕ r (doubleℕ (N→ℕ (suc r) x)))))) (sym (d≡max)) ⟩
suc
(suc
(sucn (doubleℕ (DirNum→ℕ d))
(doublesℕ r (doubleℕ (N→ℕ (suc r) x))))) -- (2^r*2x + (2*(2^r - 1))) + 2 = 2^(r+1)x + 2^(r+1)
∎
where
H : (n m : ℕ) → sucn (doublesℕ (suc n) 1) m ≡ suc (suc (sucn (doubleℕ (predℕ (doublesℕ n 1))) m))
H zero m = refl
H (suc n) m =
sucn (doublesℕ n 4) m
≡⟨ cong (λ z → sucn z m) (doublesSucSuc n 2) ⟩
sucn (sucn (doublesℕ (suc n) 1) (doublesℕ n 2)) m
≡⟨ refl ⟩
sucn (sucn (doublesℕ n 2) (doublesℕ n 2)) m
≡⟨ {!!} ⟩
sucn (doubleℕ (doublesℕ n 2)) m
≡⟨ {!!} ⟩ {!!}
ℕ→N : (r : ℕ) → (n : ℕ) → N r
ℕ→N r zero = bn (zero-n r)
ℕ→N zero (suc n) = xr tt (ℕ→N zero n)
ℕ→N (suc r) (suc n) = sucN (ℕ→N (suc r) n)
ℕ→Nsuc : (r : ℕ) (n : ℕ) → ℕ→N r (suc n) ≡ sucN (ℕ→N r n)
ℕ→Nsuc r n = {!!}
ℕ→Nsucn : (r : ℕ) (n m : ℕ) → ℕ→N r (sucn n m) ≡ sucnN n (ℕ→N r m)
ℕ→Nsucn r n m = {!!}
-- NℕNlemma is actually a pretty important fact;
-- this is what allows the direct isomorphism of N and ℕ to go
-- without the need for an extra datatype, e.g. Pos for BinNat,
-- since each ℕ < 2^r maps to its "numeral" in N r.
-- should rename and move elsewhere.
numeral-next : (r : ℕ) (d : DirNum r) → N (suc r)
numeral-next r d = bn (embed-next r d)
--
NℕNlemma : (r : ℕ) (d : DirNum r) → ℕ→N r (DirNum→ℕ d) ≡ bn d
NℕNlemma zero tt = refl
NℕNlemma (suc r) (↓ , ds) =
ℕ→N (suc r) (doubleℕ (DirNum→ℕ ds))
≡⟨ {!!} ⟩ {!!}
NℕNlemma (suc r) (↑ , ds) = {!!}
N→ℕ→N : (r : ℕ) → (x : N r) → ℕ→N r (N→ℕ r x) ≡ x
N→ℕ→N zero (bn tt) = refl
N→ℕ→N zero (xr tt x) = cong (xr tt) (N→ℕ→N zero x)
N→ℕ→N (suc r) (bn (↓ , ds)) =
ℕ→N (suc r) (doubleℕ (DirNum→ℕ ds))
≡⟨ cong (λ x → ℕ→N (suc r) x) (double-lemma ds) ⟩
ℕ→N (suc r) (DirNum→ℕ {suc r} (↓ , ds))
≡⟨ NℕNlemma (suc r) (↓ , ds) ⟩
bn (↓ , ds)
∎
N→ℕ→N (suc r) (bn (↑ , ds)) =
sucN (ℕ→N (suc r) (doubleℕ (DirNum→ℕ ds)))
≡⟨ cong (λ x → sucN (ℕ→N (suc r) x)) (double-lemma ds) ⟩
sucN (ℕ→N (suc r) (DirNum→ℕ {suc r} (↓ , ds)))
≡⟨ cong sucN (NℕNlemma (suc r) (↓ , ds)) ⟩
sucN (bn (↓ , ds))
≡⟨ refl ⟩
bn (↑ , ds)
∎
N→ℕ→N (suc r) (xr (↓ , ds) x) =
ℕ→N (suc r)
(sucn (doubleℕ (DirNum→ℕ ds))
(doublesℕ r (doubleℕ (N→ℕ (suc r) x))))
≡⟨ cong (λ z → ℕ→N (suc r) (sucn z (doublesℕ r (doubleℕ (N→ℕ (suc r) x))))) (double-lemma ds) ⟩
ℕ→N (suc r)
(sucn (DirNum→ℕ {suc r} (↓ , ds))
(doublesℕ r (doubleℕ (N→ℕ (suc r) x))))
≡⟨ refl ⟩
ℕ→N (suc r)
(sucn (DirNum→ℕ {suc r} (↓ , ds))
(doublesℕ (suc r) (N→ℕ (suc r) x)))
≡⟨ ℕ→Nsucn (suc r) (DirNum→ℕ {suc r} (↓ , ds)) (doublesℕ (suc r) (N→ℕ (suc r) x)) ⟩
sucnN (DirNum→ℕ {suc r} (↓ , ds))
(ℕ→N (suc r) (doublesℕ (suc r) (N→ℕ (suc r) x)))
≡⟨ cong (λ z → sucnN (DirNum→ℕ {suc r} (↓ , ds)) z) (H (suc r) (suc r) (N→ℕ (suc r) x)) ⟩
sucnN (DirNum→ℕ {suc r} (↓ , ds))
(doublesN (suc r) (suc r) (ℕ→N (suc r) (N→ℕ (suc r) x)))
≡⟨ cong (λ z → sucnN (DirNum→ℕ {suc r} (↓ , ds)) (doublesN (suc r) (suc r) z)) (N→ℕ→N (suc r) x) ⟩
sucnN (DirNum→ℕ {suc r} (↓ , ds))
(doublesN (suc r) (suc r) x)
≡⟨ G (suc r) (↓ , ds) x snotz ⟩
xr (↓ , ds) x ∎
where
H : (r m n : ℕ) → ℕ→N r (doublesℕ m n) ≡ doublesN r m (ℕ→N r n)
H r m n = {!!}
G : (r : ℕ) (d : DirNum r) (x : N r) → ¬ (r ≡ 0) → sucnN (DirNum→ℕ {r} d) (doublesN r r x) ≡ xr d x
G zero d x 0≠0 = ⊥-elim (0≠0 refl)
G (suc r) d (bn x) r≠0 = {!!}
G (suc r) d (xr x x₁) r≠0 = {!!}
N→ℕ→N (suc r) (xr (↑ , ds) x) with max? ds
... | no ds≠max =
sucN
(ℕ→N (suc r)
(sucn (doubleℕ (DirNum→ℕ ds))
(doublesℕ r (doubleℕ (N→ℕ (suc r) x)))))
≡⟨ sym (ℕ→Nsuc (suc r)
(sucn (doubleℕ (DirNum→ℕ ds)) (doublesℕ r (doubleℕ (N→ℕ (suc r) x)))))
⟩
ℕ→N (suc r)
(suc (sucn (doubleℕ (DirNum→ℕ ds)) (doublesℕ r (doubleℕ (N→ℕ (suc r) x)))))
≡⟨ refl ⟩
ℕ→N (suc r)
(suc (sucn (doubleℕ (DirNum→ℕ ds)) (doublesℕ (suc r) (N→ℕ (suc r) x))))
≡⟨ cong (λ z → ℕ→N (suc r) z)
(sym (sucnsuc (doubleℕ (DirNum→ℕ ds)) (doublesℕ (suc r) (N→ℕ (suc r) x))))
⟩
ℕ→N (suc r)
(sucn (doubleℕ (DirNum→ℕ ds)) (suc (doublesℕ (suc r) (N→ℕ (suc r) x))))
≡⟨ ℕ→Nsucn (suc r) (doubleℕ (DirNum→ℕ ds)) (suc (doublesℕ (suc r) (N→ℕ (suc r) x))) ⟩
sucnN (doubleℕ (DirNum→ℕ ds)) (ℕ→N (suc r) (suc (doublesℕ (suc r) (N→ℕ (suc r) x))))
≡⟨ cong (λ z → sucnN (doubleℕ (DirNum→ℕ ds)) z)
(ℕ→Nsuc (suc r) (doublesℕ (suc r) (N→ℕ (suc r) x)))
⟩
-- (2^(r+1)*x + 1) + 2*ds
-- = 2*(2^r*x + ds) + 1
-- = 2*(
sucnN (doubleℕ (DirNum→ℕ ds)) (sucN (ℕ→N (suc r) (doublesℕ (suc r) (N→ℕ (suc r) x))))
≡⟨ {!!} ⟩ {!!}
... | yes ds≡max = {!!}
ℕ→N→ℕ : (r : ℕ) → (n : ℕ) → N→ℕ r (ℕ→N r n) ≡ n
ℕ→N→ℕ zero zero = refl
ℕ→N→ℕ (suc r) zero =
doubleℕ (DirNum→ℕ (zero-n r))
≡⟨ cong doubleℕ (zero-n≡0 {r}) ⟩
doubleℕ zero
≡⟨ refl ⟩
zero
∎
ℕ→N→ℕ zero (suc n) = cong suc (ℕ→N→ℕ zero n)
ℕ→N→ℕ (suc r) (suc n) =
N→ℕ (suc r) (sucN (ℕ→N (suc r) n))
≡⟨ N→ℕsucN (suc r) (ℕ→N (suc r) n) ⟩
suc (N→ℕ (suc r) (ℕ→N (suc r) n))
≡⟨ cong suc (ℕ→N→ℕ (suc r) n) ⟩
suc n
∎
N≃ℕ : (r : ℕ) → N r ≃ ℕ
N≃ℕ r = isoToEquiv (iso (N→ℕ r) (ℕ→N r) (ℕ→N→ℕ r) (N→ℕ→N r))
N≡ℕ : (r : ℕ) → N r ≡ ℕ
N≡ℕ r = ua (N≃ℕ r)
---- pos approach:
data NPos (n : ℕ) : Type₀ where
npos1 : NPos n
x⇀ : DirNum n → NPos n → NPos n
sucNPos : ∀ {n} → NPos n → NPos n
sucNPos {zero} npos1 = x⇀ tt npos1
sucNPos {zero} (x⇀ tt x) = x⇀ tt (sucNPos x)
sucNPos {suc n} npos1 = x⇀ (next (one-n (suc n))) npos1
sucNPos {suc n} (x⇀ d x) with (max? d)
... | (no _) = x⇀ (next d) x
... | (yes _) = x⇀ (zero-n (suc n)) (sucNPos x)
-- some examples for sanity check
2₂ : NPos 1
2₂ = x⇀ (↓ , tt) npos1
3₂ : NPos 1
3₂ = x⇀ (↑ , tt) npos1
4₂ : NPos 1
4₂ = x⇀ (↓ , tt) (x⇀ (↓ , tt) npos1)
2₄ : NPos 2
2₄ = x⇀ (↓ , (↑ , tt)) npos1 -- how does this make sense?
3₄ : NPos 2
3₄ = x⇀ (↑ , (↑ , tt)) npos1 -- how does this make sense?
-- sucnpos1≡x⇀one-n : ∀ {r} → sucNPos npos1 ≡ x⇀ (one-n r) npos1
-- sucnpos1≡x⇀one-n {zero} = refl
-- sucnpos1≡x⇀one-n {suc r} = {!!}
-- sucnposx⇀zero-n≡x⇀one-n : ∀ {r} {p} → sucNPos (x⇀ (zero-n r) p) ≡ x⇀ (one-n r) p
-- sucnposx⇀zero-n≡x⇀one-n {zero} {npos1} = {!!}
-- sucnposx⇀zero-n≡x⇀one-n {zero} {x⇀ x p} = {!!}
-- sucnposx⇀zero-n≡x⇀one-n {suc r} {p} = refl
nPosInd : ∀ {r} {P : NPos r → Type₀} →
P npos1 →
((p : NPos r) → P p → P (sucNPos p)) →
(p : NPos r) →
P p
nPosInd {r} {P} h1 hs ps = f ps
where
H : (p : NPos r) → P (x⇀ (zero-n r) p) → P (x⇀ (zero-n r) (sucNPos p))
--H p hx0p = hs (x⇀ (one-n r) p) (hs (x⇀ (zero-n r) p) hx0p)
f : (ps : NPos r) → P ps
f npos1 = h1
f (x⇀ d ps) with (max? d)
... | (no _) = {!nPosInd (hs npos1 h1) H ps!}
... | (yes _) = {!hs (x⇀ (zero-n r) ps) (nPosInd (hs npos1 h1) H ps)!}
-- nPosInd {zero} {P} h1 hs ps = f ps
-- where
-- H : (p : NPos zero) → P (x⇀ (zero-n zero) p) → P (x⇀ (zero-n zero) (sucNPos p))
-- H p hx0p = hs (x⇀ tt (x⇀ (zero-n zero) p)) (hs (x⇀ (zero-n zero) p) hx0p)
-- f : (ps : NPos zero) → P ps
-- f npos1 = h1
-- f (x⇀ tt ps) = nPosInd (hs npos1 h1) H ps
-- nPosInd {suc r} {P} h1 hs ps = f ps
-- where
-- H : (p : NPos (suc r)) → P (x⇀ (zero-n (suc r)) p) → P (x⇀ (zero-n (suc r)) (sucNPos p))
-- --H p hx0p = hs (x⇀ (one-n r) p) (hs (x⇀ (zero-n r) p) hx0p)
-- f : (ps : NPos (suc r)) → P ps
-- f npos1 = h1
-- f (x⇀ d ps) = {!!}
NPos→ℕ : ∀ r → NPos r → ℕ
NPos→ℕ zero npos1 = suc zero
NPos→ℕ zero (x⇀ tt x) = suc (NPos→ℕ zero x)
NPos→ℕ (suc r) npos1 = suc zero
NPos→ℕ (suc r) (x⇀ d x) with max? d
... | no _ = sucn (DirNum→ℕ (next d)) (doublesℕ (suc r) (NPos→ℕ (suc r) x))
... | yes _ = sucn (DirNum→ℕ (next d)) (doublesℕ (suc r) (suc (NPos→ℕ (suc r) x)))
-- NPos→ℕ (suc r) (x⇀ d x) =
-- sucn (DirNum→ℕ d) (doublesℕ (suc r) (NPos→ℕ (suc r) x))
NPos→ℕsucNPos : ∀ r → (p : NPos r) → NPos→ℕ r (sucNPos p) ≡ suc (NPos→ℕ r p)
NPos→ℕsucNPos zero npos1 = refl
NPos→ℕsucNPos zero (x⇀ d p) = cong suc (NPos→ℕsucNPos zero p)
NPos→ℕsucNPos (suc r) npos1 = {!!}
sucn (doubleℕ (DirNum→ℕ (zero-n r))) (doublesℕ r 2)
≡⟨ cong (λ y → sucn y (doublesℕ r 2)) (zero-n→0) ⟩
sucn (doubleℕ zero) (doublesℕ r 2)
≡⟨ refl ⟩
doublesℕ r 2
≡⟨ {!!} ⟩ {!!}
NPos→ℕsucNPos (suc r) (x⇀ d p) with max? d
... | no _ = {!!}
... | yes _ = {!!}
-- zero≠NPos→ℕ : ∀ {r} → (p : NPos r) → ¬ (zero ≡ NPos→ℕ r p)
-- zero≠NPos→ℕ {r} p = {!!}
ℕ→NPos : ∀ r → ℕ → NPos r
ℕ→NPos zero zero = npos1
ℕ→NPos zero (suc zero) = npos1
ℕ→NPos zero (suc (suc n)) = sucNPos (ℕ→NPos zero (suc n))
ℕ→NPos (suc r) zero = npos1
ℕ→NPos (suc r) (suc zero) = npos1
ℕ→NPos (suc r) (suc (suc n)) = sucNPos (ℕ→NPos (suc r) (suc n))
lemma : ∀ {r} → (ℕ→NPos r (NPos→ℕ r npos1)) ≡ npos1
lemma {zero} = refl
lemma {suc r} = refl
NPos→ℕ→NPos : ∀ r → (p : NPos r) → ℕ→NPos r (NPos→ℕ r p) ≡ p
NPos→ℕ→NPos r p = nPosInd lemma hs p
where
hs : (p : NPos r) → ℕ→NPos r (NPos→ℕ r p) ≡ p → ℕ→NPos r (NPos→ℕ r (sucNPos p)) ≡ (sucNPos p)
hs p hp =
ℕ→NPos r (NPos→ℕ r (sucNPos p))
≡⟨ {!!} ⟩
ℕ→NPos r (suc (NPos→ℕ r p))
≡⟨ {!!} ⟩
sucNPos (ℕ→NPos r (NPos→ℕ r p))
≡⟨ cong sucNPos hp ⟩
sucNPos p
∎
-- note: the cases for zero and suc r are almost identical
-- (why) does this need to split?
ℕ→NPos→ℕ : ∀ r → (n : ℕ) → NPos→ℕ r (ℕ→NPos r (suc n)) ≡ (suc n)
ℕ→NPos→ℕ zero zero = refl
ℕ→NPos→ℕ zero (suc n) =
NPos→ℕ zero (sucNPos (ℕ→NPos zero (suc n)))
≡⟨ {!!} ⟩
suc (NPos→ℕ zero (ℕ→NPos zero (suc n)))
≡⟨ cong suc (ℕ→NPos→ℕ zero n) ⟩
suc (suc n)
∎
ℕ→NPos→ℕ (suc r) zero = refl
ℕ→NPos→ℕ (suc r) (suc n) =
NPos→ℕ (suc r) (sucNPos (ℕ→NPos (suc r) (suc n)))
≡⟨ {!!} ⟩
suc (NPos→ℕ (suc r) (ℕ→NPos (suc r) (suc n)))
≡⟨ cong suc (ℕ→NPos→ℕ (suc r) n) ⟩
suc (suc n)
∎
|
oeis/077/A077995.asm | neoneye/loda-programs | 11 | 162709 | ; A077995: Expansion of (1-x)/(1-2*x-2*x^2-x^3).
; Submitted by <NAME>
; 1,1,4,11,31,88,249,705,1996,5651,15999,45296,128241,363073,1027924,2910235,8239391,23327176,66043369,186980481,529374876,1498754083,4243238399,12013359840,34011950561,96293859201,272624979364,771849627691,2185243073311,6186810381368,17515956537049,49590776910145,140400277275756,397498064908851,1125387461279359,3186171329652176,9020615646771921,25538961414127553,72305325451451124,204709189377929275,579567991072888351,1640859686353086376,4645564544229878729,13152416452238818561
mov $1,1
mov $2,1
lpb $0
sub $0,1
mov $4,$2
mov $2,$3
add $2,$1
mov $3,$1
add $4,$2
add $1,$4
lpe
mov $0,$2
|
math/cmp.asm | FolkertVanVerseveld/c64 | 1 | 241593 | // Assembler: KickAssembler 4.4
// source: http://www.6502.org/tutorials/compare_beyond.html
.var num1 = $60
.var num1l = $60
.var num1m = $61
.var num1h = $62
.var num2 = $63
.var num2l = $63
.var num2m = $64
.var num2h = $65
// branch if num1 <= num2
lda num1
cmp num2
bcc !label+
beq !label+
brk // num1 > num2
!label:
brk // num1 <= num2
// branch if num2 >= num1
// this is equivalent to num1 <= num2 but faster and shorter
lda num2
cmp num1
bcs !label+
brk // num1 < num2
!label:
brk // num2 >= num1
// 4.1 COMPARING ONE BYTE AT A TIME
// Example 4.1.1: a 16-bit unsigned comparison which branches to LABEL2 if NUM1 < NUM2
lda num1h
cmp num2h
bcc !label2+ // if num1h < num2h then num1 < num2
bne !label1+ // if num1h <> num2h then num1 > num2
lda num1l
cmp num2l
bcc !label2+ // if num1l < num2l then num1 < num2
!label1:
brk // num1 >= num2
!label2:
brk // num1 < num2
// Example 4.1.2: a 16-bit unsigned comparison which branches to LABEL2 if NUM1 >= NUM2
lda num1h // compare high bytes
cmp num2h
bcc !label1+ // if num1h < num2h then num1 < num2
bne !label2+ // if num1h <> num2h then num1 > num2 (so num1 >= num2)
lda num1l // compare low bytes
cmp num2l
bcs !label2+ // if num1l >= num2l then num1 >= num2
!label1:
brk // num1 < num2
!label2:
brk // num1 >= num2
// Example 4.1.3: a 24-bit unsigned comparison which branches to LABEL2 if NUM1 < NUM2
lda num1h // compare high bytes
cmp num2h
bcc !label2+ // if num1h < num2h then num1 < num2
bne !label1+ // if num1h <> num2h then num1 > num2 (so num1 >= num2)
lda num1m // compare middle bytes
cmp num2m
bcc !label2+ // if num1m < num2m then num1 < num2
bne !label1+ // if num1m <> num2m then num1 > num2 (so num1 >= num2)
lda num1l // compare low bytes
cmp num2l
bcc !label2+ // if num1l < num2l then num1 < num2
!label1:
brk // num1 >= num2
!label2:
brk // num1 < num2
// Example 4.1.4: a 24-bit unsigned comparison which branches to LABEL2 if NUM1 >= NUM2
lda num1h // compare high bytes
cmp num2h
bcc !label1+ // if num1h < num2h then num1 < num2
bne !label2+ // if num1h <> num2h then num1 > num2 (so num1 >= num2)
lda num1m // compare middle bytes
cmp num2m
bcc !label1+ // if num1m < num2m then num1 < num2
bne !label2+ // if num1m <> num2m then num1 > num2 (so num1 >= num2)
lda num1l // compare low bytes
cmp num2l
bcs !label2+ // if num1l >= num2l then num1 >= num2
!label1:
brk
!label2:
brk
|
agda/Number/Coercions.agda | mchristianl/synthetic-reals | 3 | 6372 | <reponame>mchristianl/synthetic-reals<gh_stars>1-10
{-# OPTIONS --cubical --no-import-sorts --allow-unsolved-metas #-}
module Number.Coercions where
open import Cubical.Foundations.Everything renaming (_⁻¹ to _⁻¹ᵖ; assoc to ∙-assoc)
open import Cubical.Relation.Nullary.Base -- ¬_
open import Cubical.Data.Unit.Base -- Unit
open import Cubical.Data.Empty -- ⊥
open import Cubical.Data.Empty renaming (elim to ⊥-elim) -- `⊥` and `elim`
open import Number.Postulates
open import Number.Inclusions
open import Number.Base
open import MoreNatProperties
open ℕⁿ
open ℤᶻ
open ℚᶠ
open ℝʳ
open ℂᶜ
open PatternsProp
module Coerce-ℕ↪ℤ where
open ℤ
open IsROrderedCommSemiringInclusion -- ℕ↪ℤinc
private f = ℕ↪ℤ
abstract
coerce-ℕ↪ℤ : ∀{p} → (x : Number (isNat , p)) → PositivityKindInterpretation isInt (coerce-PositivityKind isNat isInt p) (ℕ↪ℤ (num x))
coerce-ℕ↪ℤ {⁇x⁇} (x ,, q) = lift tt
coerce-ℕ↪ℤ {x#0} (x ,, q) = preserves-#0 ℕ↪ℤinc _ q -- transport (λ i → f x # preserves-0 i) (preserves-# _ _ q)
coerce-ℕ↪ℤ {0≤x} (x ,, q) = preserves-0≤ ℕ↪ℤinc _ q -- transport (λ i → preserves-0 i ≤ f x) (preserves-≤ _ _ q)
coerce-ℕ↪ℤ {0<x} (x ,, q) = preserves-0< ℕ↪ℤinc _ q -- transport (λ i → preserves-0 i < f x) (preserves-< _ _ q)
coerce-ℕ↪ℤ {x≤0} (x ,, q) = preserves-≤0 ℕ↪ℤinc _ q -- transport (λ i → f x ≤ preserves-0 i) (preserves-≤ _ _ q)
module Coerce-ℕ↪ℚ where
open ℚ
open IsROrderedCommSemiringInclusion -- ℕ↪ℚinc
private f = ℕ↪ℚ
abstract
coerce-ℕ↪ℚ : ∀{p} → (x : Number (isNat , p)) → PositivityKindInterpretation isRat (coerce-PositivityKind isNat isRat p) (ℕ↪ℚ (num x))
coerce-ℕ↪ℚ {⁇x⁇} (x ,, q) = lift tt
coerce-ℕ↪ℚ {x#0} (x ,, q) = preserves-#0 ℕ↪ℚinc _ q -- transport (λ i → f x # preserves-0 i) (preserves-# _ _ q)
coerce-ℕ↪ℚ {0≤x} (x ,, q) = preserves-0≤ ℕ↪ℚinc _ q -- transport (λ i → preserves-0 i ≤ f x) (preserves-≤ _ _ q)
coerce-ℕ↪ℚ {0<x} (x ,, q) = preserves-0< ℕ↪ℚinc _ q -- transport (λ i → preserves-0 i < f x) (preserves-< _ _ q)
coerce-ℕ↪ℚ {x≤0} (x ,, q) = preserves-≤0 ℕ↪ℚinc _ q -- transport (λ i → f x ≤ preserves-0 i) (preserves-≤ _ _ q)
module Coerce-ℕ↪ℝ where
open ℝ
open IsROrderedCommSemiringInclusion -- ℕ↪ℝinc
private f = ℕ↪ℝ
abstract
coerce-ℕ↪ℝ : ∀{p} → (x : Number (isNat , p)) → PositivityKindInterpretation isReal (coerce-PositivityKind isNat isReal p) (ℕ↪ℝ (num x))
coerce-ℕ↪ℝ {⁇x⁇} (x ,, q) = lift tt
coerce-ℕ↪ℝ {x#0} (x ,, q) = preserves-#0 ℕ↪ℝinc _ q -- transport (λ i → f x # preserves-0 i) (preserves-# _ _ q)
coerce-ℕ↪ℝ {0≤x} (x ,, q) = preserves-0≤ ℕ↪ℝinc _ q -- transport (λ i → preserves-0 i ≤ f x) (preserves-≤ _ _ q)
coerce-ℕ↪ℝ {0<x} (x ,, q) = preserves-0< ℕ↪ℝinc _ q -- transport (λ i → preserves-0 i < f x) (preserves-< _ _ q)
coerce-ℕ↪ℝ {x≤0} (x ,, q) = preserves-≤0 ℕ↪ℝinc _ q -- transport (λ i → f x ≤ preserves-0 i) (preserves-≤ _ _ q)
module Coerce-ℕ↪ℂ where
open ℂ
open Isℕ↪ℂ -- ℕ↪ℂinc
private f = ℕ↪ℂ
abstract
coerce-ℕ↪ℂ : ∀{p} → (x : Number (isNat , p)) → PositivityKindInterpretation isComplex (coerce-PositivityKind isNat isComplex p) (ℕ↪ℂ (num x))
coerce-ℕ↪ℂ {⁇x⁇} (x ,, q) = lift tt
coerce-ℕ↪ℂ {x#0} (x ,, q) = transport (λ i → f x # preserves-0 ℕ↪ℂinc i) (preserves-# ℕ↪ℂinc _ _ q)
coerce-ℕ↪ℂ {0≤x} (x ,, q) = lift tt
coerce-ℕ↪ℂ {0<x} (x ,, q) = transport (λ i → f x # preserves-0 ℕ↪ℂinc i) (preserves-# ℕ↪ℂinc _ _ (ℕ.#-sym _ _ (ℕ.<-implies-# _ _ q)))
coerce-ℕ↪ℂ {x≤0} (x ,, q) = lift tt
module Coerce-ℤ↪ℚ where
open ℚ
open IsROrderedCommRingInclusion -- ℤ↪ℚinc
private f = ℤ↪ℚ
abstract
coerce-ℤ↪ℚ : ∀{p} → (x : Number (isInt , p)) → PositivityKindInterpretation isRat (coerce-PositivityKind isInt isRat p) (ℤ↪ℚ (num x))
coerce-ℤ↪ℚ {⁇x⁇} (x ,, q) = lift tt
coerce-ℤ↪ℚ {x#0} (x ,, q) = preserves-#0 ℤ↪ℚinc _ q -- transport (λ i → f x # preserves-0 i) (preserves-# _ _ q)
coerce-ℤ↪ℚ {0≤x} (x ,, q) = preserves-0≤ ℤ↪ℚinc _ q -- transport (λ i → preserves-0 i ≤ f x) (preserves-≤ _ _ q)
coerce-ℤ↪ℚ {0<x} (x ,, q) = preserves-0< ℤ↪ℚinc _ q -- transport (λ i → preserves-0 i < f x) (preserves-< _ _ q)
coerce-ℤ↪ℚ {x<0} (x ,, q) = preserves-<0 ℤ↪ℚinc _ q -- transport (λ i → f x < preserves-0 i) (preserves-< _ _ q)
coerce-ℤ↪ℚ {x≤0} (x ,, q) = preserves-≤0 ℤ↪ℚinc _ q -- transport (λ i → f x ≤ preserves-0 i) (preserves-≤ _ _ q)
module Coerce-ℤ↪ℝ where
open ℝ
open IsROrderedCommRingInclusion -- ℤ↪ℝinc
private f = ℤ↪ℝ
abstract
coerce-ℤ↪ℝ : ∀{p} → (x : Number (isInt , p)) → PositivityKindInterpretation isReal (coerce-PositivityKind isInt isReal p) (ℤ↪ℝ (num x))
coerce-ℤ↪ℝ {⁇x⁇} (x ,, q) = lift tt
coerce-ℤ↪ℝ {x#0} (x ,, q) = preserves-#0 ℤ↪ℝinc _ q -- transport (λ i → f x # preserves-0 i) (preserves-# _ _ q)
coerce-ℤ↪ℝ {0≤x} (x ,, q) = preserves-0≤ ℤ↪ℝinc _ q -- transport (λ i → preserves-0 i ≤ f x) (preserves-≤ _ _ q)
coerce-ℤ↪ℝ {0<x} (x ,, q) = preserves-0< ℤ↪ℝinc _ q -- transport (λ i → preserves-0 i < f x) (preserves-< _ _ q)
coerce-ℤ↪ℝ {x<0} (x ,, q) = preserves-<0 ℤ↪ℝinc _ q -- transport (λ i → f x < preserves-0 i) (preserves-< _ _ q)
coerce-ℤ↪ℝ {x≤0} (x ,, q) = preserves-≤0 ℤ↪ℝinc _ q -- transport (λ i → f x ≤ preserves-0 i) (preserves-≤ _ _ q)
module Coerce-ℤ↪ℂ where
open ℂ
open Isℤ↪ℂ -- ℤ↪ℂinc
private f = ℤ↪ℂ
abstract
coerce-ℤ↪ℂ : ∀{p} → (x : Number (isInt , p)) → PositivityKindInterpretation isComplex (coerce-PositivityKind isInt isComplex p) (ℤ↪ℂ (num x))
coerce-ℤ↪ℂ {⁇x⁇} (x ,, q) = lift tt
coerce-ℤ↪ℂ {x#0} (x ,, q) = transport (λ i → f x # preserves-0 ℤ↪ℂinc i) (preserves-# ℤ↪ℂinc _ _ q)
coerce-ℤ↪ℂ {0≤x} (x ,, q) = lift tt
coerce-ℤ↪ℂ {0<x} (x ,, q) = transport (λ i → f x # preserves-0 ℤ↪ℂinc i) (preserves-# ℤ↪ℂinc _ _ (ℤ.#-sym _ _ (ℤ.<-implies-# _ _ q)))
coerce-ℤ↪ℂ {x<0} (x ,, q) = transport (λ i → f x # preserves-0 ℤ↪ℂinc i) (preserves-# ℤ↪ℂinc _ _ (ℤ.<-implies-# _ _ q) )
coerce-ℤ↪ℂ {x≤0} (x ,, q) = lift tt
module Coerce-ℚ↪ℝ where
open ℝ
open IsROrderedFieldInclusion -- ℚ↪ℝinc
private f = ℚ↪ℝ
abstract
coerce-ℚ↪ℝ : ∀{p} → (x : Number (isRat , p)) → PositivityKindInterpretation isReal (coerce-PositivityKind isRat isReal p) (ℚ↪ℝ (num x))
coerce-ℚ↪ℝ {⁇x⁇} (x ,, q) = lift tt
coerce-ℚ↪ℝ {x#0} (x ,, q) = preserves-#0 ℚ↪ℝinc _ q -- transport (λ i → f x # preserves-0 i) (preserves-# _ _ q)
coerce-ℚ↪ℝ {0≤x} (x ,, q) = preserves-0≤ ℚ↪ℝinc _ q -- transport (λ i → preserves-0 i ≤ f x) (preserves-≤ _ _ q)
coerce-ℚ↪ℝ {0<x} (x ,, q) = preserves-0< ℚ↪ℝinc _ q -- transport (λ i → preserves-0 i < f x) (preserves-< _ _ q)
coerce-ℚ↪ℝ {x<0} (x ,, q) = preserves-<0 ℚ↪ℝinc _ q -- transport (λ i → f x < preserves-0 i) (preserves-< _ _ q)
coerce-ℚ↪ℝ {x≤0} (x ,, q) = preserves-≤0 ℚ↪ℝinc _ q -- transport (λ i → f x ≤ preserves-0 i) (preserves-≤ _ _ q)
module Coerce-ℚ↪ℂ where
open ℂ
open IsRFieldInclusion -- ℚ↪ℂinc
private f = ℚ↪ℂ
abstract
coerce-ℚ↪ℂ : ∀{p} → (x : Number (isRat , p)) → PositivityKindInterpretation isComplex (coerce-PositivityKind isRat isComplex p) (ℚ↪ℂ (num x))
coerce-ℚ↪ℂ {⁇x⁇} (x ,, q) = lift tt
coerce-ℚ↪ℂ {x#0} (x ,, q) = preserves-#0 ℚ↪ℂinc _ q -- transport (λ i → f x # preserves-0 ℚ↪ℂinc i) (preserves-# ℚ↪ℂinc _ _ q)
coerce-ℚ↪ℂ {0≤x} (x ,, q) = lift tt
coerce-ℚ↪ℂ {0<x} (x ,, q) = transport (λ i → f x # preserves-0 ℚ↪ℂinc i) (preserves-# ℚ↪ℂinc _ _ (ℚ.#-sym _ _ (ℚ.<-implies-# _ _ q)))
coerce-ℚ↪ℂ {x<0} (x ,, q) = transport (λ i → f x # preserves-0 ℚ↪ℂinc i) (preserves-# ℚ↪ℂinc _ _ (ℚ.<-implies-# _ _ q) )
coerce-ℚ↪ℂ {x≤0} (x ,, q) = lift tt
module Coerce-ℝ↪ℂ where
-- open ℂ
open IsRFieldInclusion -- ℝ↪ℂinc
private f = ℝ↪ℂ
abstract
coerce-ℝ↪ℂ : ∀{p} → (x : Number (isReal , p)) → PositivityKindInterpretation isComplex (coerce-PositivityKind isReal isComplex p) (ℝ↪ℂ (num x))
coerce-ℝ↪ℂ {⁇x⁇} (x ,, q) = lift tt
coerce-ℝ↪ℂ {x#0} (x ,, q) = preserves-#0 ℝ↪ℂinc _ q -- transport (λ i → f x # preserves-0 ℝ↪ℂinc i) (preserves-# ℝ↪ℂinc _ _ q)
coerce-ℝ↪ℂ {0≤x} (x ,, q) = lift tt
coerce-ℝ↪ℂ {0<x} (x ,, q) = transport (λ i → f x ℂ.# preserves-0 ℝ↪ℂinc i) (preserves-# ℝ↪ℂinc _ _ (ℝ.#-sym _ _ (ℝ.<-implies-# _ _ q)))
coerce-ℝ↪ℂ {x<0} (x ,, q) = transport (λ i → f x ℂ.# preserves-0 ℝ↪ℂinc i) (preserves-# ℝ↪ℂinc _ _ (ℝ.<-implies-# _ _ q) )
coerce-ℝ↪ℂ {x≤0} (x ,, q) = lift tt
-- NOTE: typechecking of this module is very slow
-- the cause might be opening of the ten `IsXInclusion` instances
-- it could be related to https://github.com/agda/agda/issues/1646 (Exponential module chain leads to infeasible scope checking)
-- YES: this is the case. After shifting the module arguments from `open` into the code, checking became instant again
-- does this make anything faster?
open Coerce-ℕ↪ℤ public
open Coerce-ℕ↪ℚ public
open Coerce-ℕ↪ℝ public
open Coerce-ℕ↪ℂ public
open Coerce-ℤ↪ℚ public
open Coerce-ℤ↪ℝ public
open Coerce-ℤ↪ℂ public
open Coerce-ℚ↪ℝ public
open Coerce-ℚ↪ℂ public
open Coerce-ℝ↪ℂ public
coerce : (from : NumberKind)
→ (to : NumberKind)
→ from ≤ₙₗ to
→ ∀{p}
→ Number (from , p)
→ Number (to , coerce-PositivityKind from to p)
coerce isNat isNat q {p} x = x
coerce isInt isInt q {p} x = x
coerce isRat isRat q {p} x = x
coerce isReal isReal q {p} x = x
coerce isComplex isComplex q {p} x = x
coerce isNat isInt q {p} x = (ℕ↪ℤ (num x) ,, coerce-ℕ↪ℤ x)
coerce isNat isRat q {p} x = (ℕ↪ℚ (num x) ,, coerce-ℕ↪ℚ x)
coerce isNat isReal q {p} x = (ℕ↪ℝ (num x) ,, coerce-ℕ↪ℝ x)
coerce isNat isComplex q {p} x = (ℕ↪ℂ (num x) ,, coerce-ℕ↪ℂ x)
coerce isInt isRat q {p} x = (ℤ↪ℚ (num x) ,, coerce-ℤ↪ℚ x)
coerce isInt isReal q {p} x = (ℤ↪ℝ (num x) ,, coerce-ℤ↪ℝ x)
coerce isInt isComplex q {p} x = (ℤ↪ℂ (num x) ,, coerce-ℤ↪ℂ x)
coerce isRat isReal q {p} x = (ℚ↪ℝ (num x) ,, coerce-ℚ↪ℝ x)
coerce isRat isComplex q {p} x = (ℚ↪ℂ (num x) ,, coerce-ℚ↪ℂ x)
coerce isReal isComplex q {p} x = (ℝ↪ℂ (num x) ,, coerce-ℝ↪ℂ x)
--coerce x y = nothing
coerce isInt isNat r@(k , q) {p} x = ⊥-elim {A = λ _ → Number (isNat , p)} (k+x+sy≢x _ _ _ q)
coerce isRat isNat r@(k , q) {p} x = ⊥-elim {A = λ _ → Number (isNat , p)} (k+x+sy≢x _ _ _ q)
coerce isRat isInt r@(k , q) {p} x = ⊥-elim {A = λ _ → Number (isInt , p)} (k+x+sy≢x _ _ _ q)
coerce isReal isNat r@(k , q) {p} x = ⊥-elim {A = λ _ → Number (isNat , p)} (k+x+sy≢x _ _ _ q)
coerce isReal isInt r@(k , q) {p} x = ⊥-elim {A = λ _ → Number (isInt , p)} (k+x+sy≢x _ _ _ q)
coerce isReal isRat r@(k , q) {p} x = ⊥-elim {A = λ _ → Number (isRat , p)} (k+x+sy≢x _ _ _ q)
coerce isComplex isNat r@(k , q) {p} x = ⊥-elim {A = λ _ → Number (isNat , coerce-PositivityKind isComplex isNat p)} (k+x+sy≢x _ _ _ q)
coerce isComplex isInt r@(k , q) {p} x = ⊥-elim {A = λ _ → Number (isInt , coerce-PositivityKind isComplex isInt p)} (k+x+sy≢x _ _ _ q)
coerce isComplex isRat r@(k , q) {p} x = ⊥-elim {A = λ _ → Number (isRat , coerce-PositivityKind isComplex isRat p)} (k+x+sy≢x _ _ _ q)
coerce isComplex isReal r@(k , q) {p} x = ⊥-elim {A = λ _ → Number (isReal , coerce-PositivityKind isComplex isReal p)} (k+x+sy≢x _ _ _ q)
|
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco/Cisco_crypto.g4 | jeffkala/batfish | 0 | 4691 | parser grammar Cisco_crypto;
import Cisco_common;
options {
tokenVocab = CiscoLexer;
}
cc_certificate_chain
:
CERTIFICATE CHAIN name = variable NEWLINE cccc_certificate*
;
cc_lookup
:
LOOKUP null_rest_of_line
;
cc_server
:
SERVER NEWLINE
(
ccs_null
)*
;
cc_trustpoint
:
TRUSTPOINT name = variable NEWLINE
(
cctpoint_null
)*
;
cc_trustpool
:
TRUSTPOOL name = variable NEWLINE
(
cctpool_null
)*
;
cccc_certificate
:
CERTIFICATE
(
CA
| SELF_SIGNED
)? certificate QUIT NEWLINE
;
ccs_null
:
NO?
(
CDP_URL
| ISSUER_NAME
| SHUTDOWN
| SMTP
) null_rest_of_line
;
cctpoint_null
:
NO?
(
CRL
| ENROLLMENT
| FQDN
| KEYPAIR
| SUBJECT_NAME
| VALIDATION_USAGE
) null_rest_of_line
;
cctpool_null
:
NO?
(
AUTO_IMPORT
) null_rest_of_line
;
cd_match_address
:
MATCH ADDRESS name = variable NEWLINE
;
cd_null
:
NO?
(
VERSION
) null_rest_of_line
;
cd_set
:
SET
(
cd_set_isakmp_profile
| cd_set_null
| cd_set_peer
| cd_set_pfs
| cd_set_transform_set
)
;
cd_set_isakmp_profile
:
ISAKMP_PROFILE name = variable NEWLINE
;
cd_set_null
:
(
SECURITY_ASSOCIATION
) null_rest_of_line
;
cd_set_peer
:
PEER address = IP_ADDRESS NEWLINE
;
cd_set_pfs
:
PFS dh_group NEWLINE
;
cd_set_transform_set
:
TRANSFORM_SET
(
transforms += variable
)+ NEWLINE
;
certificate
:
~QUIT+
;
cg_null
:
(
IDENTITY
| SERVER
) null_rest_of_line
;
ci1_null
:
(
AM_DISABLE
| ENABLE
| IPSEC_OVER_TCP
) null_rest_of_line
;
ci1_policy
:
POLICY name = variable NEWLINE
(
ci1p_null
)*
;
ci1p_null
:
NO?
(
AUTHENTICATION
| ENCRYPTION
| GROUP
| HASH
| LIFETIME
) null_rest_of_line
;
ci2_keyring
:
KEYRING name = variable NEWLINE
(
ci2k_peer
)*
;
ci2_null
:
(
ENABLE
| REMOTE_ACCESS
) null_rest_of_line
;
ci2_policy
:
POLICY name = variable NEWLINE
(
ci2pol_null
)*
;
ci2_profile
:
PROFILE name = variable NEWLINE
(
ci2prf_null
)*
;
ci2_proposal
:
PROPOSAL name = variable NEWLINE
(
ci2prp_null
)*
;
ci2k_peer
:
PEER name = variable NEWLINE
(
ci2kp_null
)*
;
ci2kp_null
:
NO?
(
ADDRESS
| PRE_SHARED_KEY
) null_rest_of_line
;
ci2pol_null
:
NO?
(
ENCRYPTION
| GROUP
| INTEGRITY
| LIFETIME
| PRF
| PROPOSAL
) null_rest_of_line
;
ci2prf_null
:
NO?
(
AUTHENTICATION
| KEYRING
| MATCH
) null_rest_of_line
;
ci2prp_null
:
NO?
(
ENCRYPTION
| GROUP
| INTEGRITY
) null_rest_of_line
;
cip_ikev2
:
IKEV2 cipi2_ipsec_proposal
;
cip_null
:
(
DF_BIT
| FRAGMENTATION
| IKEV1
| NAT_TRANSPARENCY
| SECURITY_ASSOCIATION
) null_rest_of_line
;
cip_profile
:
PROFILE name = variable_permissive NEWLINE
(
cipprf_set
)*
;
cip_transform_set
:
TRANSFORM_SET name = variable
ipsec_encryption
ipsec_authentication? NEWLINE
(
cipt_mode
)*
;
cipi2_ipsec_proposal
:
IPSEC_PROPOSAL name = variable_permissive NEWLINE
(
cipi2ip_null
)*
;
cipi2ip_null
:
NO?
(
PROTOCOL
) null_rest_of_line
;
cipprf_set
:
SET
(
cipprf_set_isakmp_profile
| cipprf_set_null
| cipprf_set_pfs
| cipprf_set_transform_set
)
;
cipprf_set_isakmp_profile
:
ISAKMP_PROFILE name = variable NEWLINE
;
cipprf_set_null
:
(
IKEV2_PROFILE
| SECURITY_ASSOCIATION
) null_rest_of_line
;
cipprf_set_pfs
:
PFS dh_group NEWLINE
;
cipprf_set_transform_set
:
TRANSFORM_SET
(
transforms += variable
)+ NEWLINE
;
cipt_mode
:
MODE
(
TRANSPORT
| TUNNEL
) NEWLINE
;
cis_key
:
KEY dec? key = VARIABLE ADDRESS ip = IP_ADDRESS (wildcard_mask = IP_ADDRESS)? NEWLINE
;
cis_null
:
(
EAP_PASSTHROUGH
| ENABLE
| IDENTITY
| INVALID_SPI_RECOVERY
| KEEPALIVE
| NAT
| NAT_TRAVERSAL
) null_rest_of_line
;
cis_policy
:
POLICY priority = dec NEWLINE
(
cispol_authentication
| cispol_encryption
| cispol_group
| cispol_hash
| cispol_lifetime
| cispol_null
)*
;
cis_profile
:
PROFILE name = variable NEWLINE
(
cisprf_keyring
| cisprf_local_address
| cisprf_match
| cisprf_null
| cisprf_self_identity
| cisprf_vrf
)*
;
cispol_authentication
:
AUTHENTICATION
(
PRE_SHARE
| RSA_ENCR
| RSA_SIG
) NEWLINE
;
cispol_encryption
:
(
ENCR
| ENCRYPTION
) ike_encryption NEWLINE
;
cispol_group
:
GROUP dec NEWLINE
;
cispol_hash
:
HASH
(
MD5
| SHA
| SHA2_256_128
) NEWLINE
;
cispol_lifetime
:
LIFETIME dec NEWLINE
;
cispol_null
:
NO?
(
PRF
| VERSION
) null_rest_of_line
;
cisprf_keyring
:
KEYRING name = variable_permissive NEWLINE
;
cisprf_local_address
:
LOCAL_ADDRESS
(
IP_ADDRESS
| iname = interface_name_unstructured
) NEWLINE
;
cisprf_match
:
MATCH IDENTITY ADDRESS address = IP_ADDRESS mask = IP_ADDRESS? vrf = variable? NEWLINE
;
cisprf_null
:
NO?
(
KEEPALIVE
| REVERSE_ROUTE
) null_rest_of_line
;
cisprf_self_identity
:
SELF_IDENTITY IP_ADDRESS NEWLINE
;
cisprf_vrf: VRF name = variable NEWLINE;
ck_null
:
(
GENERATE
| PARAM
) null_rest_of_line
;
ck_pubkey_chain
:
PUBKEY_CHAIN null_rest_of_line ckp_named_key*
;
ckp_named_key
:
NAMED_KEY name = variable_permissive NEWLINE
(
ckpn_address
| ckpn_key_string
)*
;
ckpn_address
:
NO? ADDRESS ip = IP_ADDRESS NEWLINE
;
ckpn_key_string
:
NO? KEY_STRING certificate QUIT NEWLINE
;
ckr_local_address
:
LOCAL_ADDRESS
(
IP_ADDRESS
| iname = interface_name_unstructured
) NEWLINE
;
ckr_psk
:
PRE_SHARED_KEY ADDRESS ip = IP_ADDRESS (wildcard_mask = IP_ADDRESS)? KEY variable_permissive NEWLINE
;
cpki_certificate_chain
:
CERTIFICATE CHAIN name = variable_permissive NEWLINE
(
cpkicc_certificate
)*
;
cpki_null
:
(
TOKEN
) null_rest_of_line
;
cpki_server
:
SERVER name = variable_permissive NEWLINE
(
cpkis_null
)*
;
cpki_trustpoint
:
TRUSTPOINT name = variable_permissive NEWLINE
(
cpkit_null
)*
;
cpkicc_certificate
:
CERTIFICATE
(
SELF_SIGNED
)? certificate QUIT NEWLINE
;
cpkis_null
:
NO?
(
CDP_URL
| DATABASE
| GRANT
| ISSUER_NAME
) null_rest_of_line
;
cpkit_null
:
NO?
(
ENROLLMENT
| REVOCATION_CHECK
| RSAKEYPAIR
| SERIAL_NUMBER
| SUBJECT_NAME
| VALIDATION_USAGE
) null_rest_of_line
;
crypto_ca
:
CA
(
cc_certificate_chain
| cc_lookup
| cc_server
| cc_trustpoint
| cc_trustpool
)
;
crypto_csr_params
:
CSR_PARAMS name = variable_permissive NEWLINE
(
(
COMMON_NAME
| COUNTRY
| EMAIL
| LOCALITY
| ORGANIZATION_NAME
| ORGANIZATION_UNIT
| SERIAL_NUMBER
| STATE
) null_rest_of_line
)*
;
crypto_dynamic_map
:
DYNAMIC_MAP name = variable seq_num = dec crypto_dynamic_map_null?
(
NEWLINE
(
cd_match_address
| cd_null
| cd_set
)*
)
;
crypto_dynamic_map_null
:
(
MATCH
| SET
) ~NEWLINE*
;
crypto_engine
:
ENGINE null_rest_of_line
;
crypto_gdoi
:
GDOI null_rest_of_line
(
cg_null
)*
;
crypto_ikev1
:
IKEV1
(
ci1_null
| ci1_policy
)
;
crypto_ikev2
:
IKEV2
(
ci2_keyring
| ci2_null
| ci2_policy
| ci2_profile
| ci2_proposal
)
;
crypto_ipsec
:
IPSEC
(
cip_ikev2
| cip_null
| cip_profile
| cip_transform_set
)
;
crypto_isakmp
:
ISAKMP
(
cis_key
| cis_null
| cis_policy
| cis_profile
)
;
crypto_key
:
KEY
(
ck_null
| ck_pubkey_chain
)
;
crypto_keyring
:
KEYRING name = variable (VRF vrf = variable)? NEWLINE
(
ckr_local_address
| ckr_psk
)*
;
crypto_map
:
MAP name = variable
(
crypto_map_null
| seq_num = dec crypto_map_tail
)
;
crypto_map_null
:
(
INTERFACE
| LOCAL_ADDRESS
| REDUNDANCY
) null_rest_of_line
;
crypto_map_tail
:
(
crypto_map_t_gdoi
| crypto_map_t_ipsec_isakmp
| crypto_map_t_match
| crypto_map_t_null
)
;
crypto_map_t_g_null
:
(
SET
) null_rest_of_line
;
crypto_map_t_gdoi
:
GDOI NEWLINE
(
crypto_map_t_g_null
)*
;
crypto_map_t_ii_match_address
:
MATCH ADDRESS name = variable NEWLINE
;
crypto_map_t_ii_null
:
NO?
(
DESCRIPTION
| REVERSE_ROUTE
) null_rest_of_line
;
crypto_map_t_ii_set
:
SET
(
crypto_map_t_ii_set_isakmp_profile
| crypto_map_t_ii_set_null
| crypto_map_t_ii_set_peer
| crypto_map_t_ii_set_pfs
| crypto_map_t_ii_set_transform_set
)
;
crypto_map_t_ii_set_isakmp_profile
:
ISAKMP_PROFILE name = variable NEWLINE
;
crypto_map_t_ii_set_null
:
(
SECURITY_ASSOCIATION
) null_rest_of_line
;
crypto_map_t_ii_set_peer
:
PEER address = IP_ADDRESS NEWLINE
;
crypto_map_t_ii_set_pfs
:
PFS dh_group NEWLINE
;
crypto_map_t_ii_set_transform_set
:
TRANSFORM_SET
(
transforms += variable
)+ NEWLINE
;
crypto_map_t_ipsec_isakmp
:
IPSEC_ISAKMP
(
DYNAMIC crypto_dynamic_map_name = variable
)?
NEWLINE
(
crypto_map_t_ii_match_address
| crypto_map_t_ii_null
| crypto_map_t_ii_set
)*
;
crypto_map_t_match
:
MATCH crypto_map_t_match_address
;
crypto_map_t_match_address
:
ADDRESS name = variable NEWLINE
;
crypto_map_t_null
:
(
IPSEC_MANUAL
| SET
) null_rest_of_line
;
crypto_pki
:
PKI
(
cpki_certificate_chain
| cpki_null
| cpki_server
| cpki_trustpoint
)
;
dh_group
:
GROUP1
| GROUP14
| GROUP15
| GROUP16
| GROUP19
| GROUP2
| GROUP20
| GROUP21
| GROUP24
| GROUP5
;
key_key
:
KEY name = variable NEWLINE
(
kk_null
)*
;
kk_null
:
NO?
(
ACCEPT_LIFETIME
| CRYPTOGRAPHIC_ALGORITHM
| KEY_STRING
| SEND_LIFETIME
) null_rest_of_line
;
ike_encryption
:
(
AES strength = dec?
)
| DES
| THREE_DES
;
ipsec_authentication
:
AH_MD5_HMAC
| AH_SHA_HMAC
| ESP_MD5_HMAC
| ESP_SHA_HMAC
| ESP_SHA256_HMAC
| ESP_SHA512_HMAC
;
ipsec_encryption
:
(
ESP_AES strength = dec?
)
| ESP_DES
| ESP_3DES
|
(
ESP_GCM strength = dec?
)
|
(
ESP_GMAC strength = dec?
)
| ESP_NULL
| ESP_SEAL
;
s_crypto
:
NO? CRYPTO
(
crypto_ca
| crypto_csr_params
| crypto_dynamic_map
| crypto_engine
| crypto_gdoi
| crypto_ikev1
| crypto_ikev2
| crypto_ipsec
| crypto_isakmp
| crypto_key
| crypto_keyring
| crypto_map
| crypto_pki
)
;
s_key
:
KEY CHAIN name = variable_permissive NEWLINE
(
key_key
)*
;
|
tools-src/gnu/gcc/gcc/ada/output.adb | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 23327 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- O U T P U T --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with GNAT.OS_Lib; use GNAT.OS_Lib;
package body Output is
Current_FD : File_Descriptor := Standout;
-- File descriptor for current output
-----------------------
-- Local_Subprograms --
-----------------------
procedure Flush_Buffer;
-- Flush buffer if non-empty and reset column counter
------------------
-- Flush_Buffer --
------------------
procedure Flush_Buffer is
Len : constant Natural := Natural (Column - 1);
begin
if Len /= 0 then
if Len /= Write (Current_FD, Buffer'Address, Len) then
Set_Standard_Error;
Write_Line ("fatal error: disk full");
OS_Exit (2);
end if;
Column := 1;
end if;
end Flush_Buffer;
------------------------
-- Set_Standard_Error --
------------------------
procedure Set_Standard_Error is
begin
Flush_Buffer;
Current_FD := Standerr;
Column := 1;
end Set_Standard_Error;
-------------------------
-- Set_Standard_Output --
-------------------------
procedure Set_Standard_Output is
begin
Flush_Buffer;
Current_FD := Standout;
Column := 1;
end Set_Standard_Output;
-------
-- w --
-------
procedure w (C : Character) is
begin
Write_Char (''');
Write_Char (C);
Write_Char (''');
Write_Eol;
end w;
procedure w (S : String) is
begin
Write_Str (S);
Write_Eol;
end w;
procedure w (V : Int) is
begin
Write_Int (V);
Write_Eol;
end w;
procedure w (B : Boolean) is
begin
if B then
w ("True");
else
w ("False");
end if;
end w;
procedure w (L : String; C : Character) is
begin
Write_Str (L);
Write_Char (' ');
w (C);
end w;
procedure w (L : String; S : String) is
begin
Write_Str (L);
Write_Char (' ');
w (S);
end w;
procedure w (L : String; V : Int) is
begin
Write_Str (L);
Write_Char (' ');
w (V);
end w;
procedure w (L : String; B : Boolean) is
begin
Write_Str (L);
Write_Char (' ');
w (B);
end w;
----------------
-- Write_Char --
----------------
procedure Write_Char (C : Character) is
begin
if Column < Buffer'Length then
Buffer (Natural (Column)) := C;
Column := Column + 1;
end if;
end Write_Char;
---------------
-- Write_Eol --
---------------
procedure Write_Eol is
begin
Buffer (Natural (Column)) := ASCII.LF;
Column := Column + 1;
Flush_Buffer;
end Write_Eol;
---------------
-- Write_Int --
---------------
procedure Write_Int (Val : Int) is
begin
if Val < 0 then
Write_Char ('-');
Write_Int (-Val);
else
if Val > 9 then
Write_Int (Val / 10);
end if;
Write_Char (Character'Val ((Val mod 10) + Character'Pos ('0')));
end if;
end Write_Int;
----------------
-- Write_Line --
----------------
procedure Write_Line (S : String) is
begin
Write_Str (S);
Write_Eol;
end Write_Line;
---------------
-- Write_Str --
---------------
procedure Write_Str (S : String) is
begin
for J in S'Range loop
Write_Char (S (J));
end loop;
end Write_Str;
end Output;
|
alloy4fun_models/trainstlt/models/7/Bij5wWJCHt7997Zqk.als | Kaixi26/org.alloytools.alloy | 0 | 1938 | open main
pred idBij5wWJCHt7997Zqk_prop8 {
always ( all t:Train | some t.pos.signal and t.pos.signal in Green implies t.pos' = t.pos )
}
pred __repair { idBij5wWJCHt7997Zqk_prop8 }
check __repair { idBij5wWJCHt7997Zqk_prop8 <=> prop8o } |
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0_notsx.log_21829_369.asm | ljhsiun2/medusa | 9 | 2527 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r8
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0xf663, %r11
nop
nop
nop
sub %rcx, %rcx
movw $0x6162, (%r11)
nop
nop
dec %r8
lea addresses_UC_ht+0x11ae3, %rax
clflush (%rax)
nop
nop
nop
nop
nop
and %rcx, %rcx
mov $0x6162636465666768, %r8
movq %r8, %xmm0
vmovups %ymm0, (%rax)
nop
xor $13510, %r10
lea addresses_A_ht+0x5963, %rdx
nop
sub %r13, %r13
mov $0x6162636465666768, %r8
movq %r8, %xmm3
vmovups %ymm3, (%rdx)
nop
nop
dec %r11
lea addresses_D_ht+0x1a3eb, %rsi
lea addresses_normal_ht+0x14f73, %rdi
nop
nop
xor %r11, %r11
mov $70, %rcx
rep movsl
inc %r10
lea addresses_D_ht+0x1d363, %r13
nop
nop
nop
nop
nop
xor $51241, %r10
movl $0x61626364, (%r13)
nop
nop
nop
xor %r10, %r10
lea addresses_UC_ht+0x3ac3, %rsi
nop
nop
nop
nop
nop
inc %r8
movb (%rsi), %al
nop
nop
add %rcx, %rcx
lea addresses_A_ht+0x1494c, %r11
nop
nop
sub %rdi, %rdi
movb (%r11), %al
nop
nop
nop
add %rax, %rax
lea addresses_normal_ht+0x61ab, %rax
nop
nop
nop
nop
cmp $15830, %r11
movb (%rax), %dl
nop
nop
nop
nop
nop
add $19633, %rdx
lea addresses_normal_ht+0x6663, %rsi
nop
sub $26852, %r10
mov (%rsi), %r13d
nop
sub %rsi, %rsi
lea addresses_normal_ht+0xda63, %rdx
nop
nop
nop
cmp $2359, %rax
mov $0x6162636465666768, %r11
movq %r11, %xmm1
and $0xffffffffffffffc0, %rdx
vmovntdq %ymm1, (%rdx)
nop
nop
dec %r10
lea addresses_D_ht+0x8283, %rsi
nop
cmp $55191, %rdi
mov $0x6162636465666768, %r10
movq %r10, %xmm4
and $0xffffffffffffffc0, %rsi
vmovaps %ymm4, (%rsi)
nop
and %r11, %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r15
push %rax
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_US+0x1a4da, %rsi
lea addresses_D+0x63, %rdi
nop
sub %r15, %r15
mov $18, %rcx
rep movsl
nop
nop
xor $46508, %rdi
// Store
lea addresses_WC+0xbe63, %r15
add %r11, %r11
movl $0x51525354, (%r15)
add %rcx, %rcx
// Store
mov $0xce3, %r13
nop
nop
nop
and $21032, %r15
mov $0x5152535455565758, %rsi
movq %rsi, (%r13)
inc %rsi
// Store
lea addresses_D+0x14f23, %r11
sub $610, %r13
mov $0x5152535455565758, %rsi
movq %rsi, %xmm4
movaps %xmm4, (%r11)
nop
nop
nop
nop
nop
dec %r13
// Store
lea addresses_normal+0x18943, %r13
nop
sub $35233, %r15
mov $0x5152535455565758, %r11
movq %r11, %xmm2
movups %xmm2, (%r13)
nop
nop
nop
nop
sub %rsi, %rsi
// Store
lea addresses_PSE+0x19ffb, %rsi
nop
xor %r11, %r11
mov $0x5152535455565758, %rcx
movq %rcx, (%rsi)
nop
nop
add $64135, %rdi
// Faulty Load
mov $0x7ede210000000663, %rdi
nop
add %rcx, %rcx
mov (%rdi), %r11w
lea oracles, %rcx
and $0xff, %r11
shlq $12, %r11
mov (%rcx,%r11,1), %r11
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_US', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': True, 'size': 16, 'NT': False, 'same': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 2}}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 2, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 8}}
{'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 6}}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': True, 'size': 32, 'NT': False, 'same': False, 'congruent': 5}}
{'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
*/
|
app/hack/opcode.asm | USN484259/COFUOS | 1 | 25190 | <reponame>USN484259/COFUOS
[bits 64]
exit_process equ 0x0210
section .text
main:
cli
hlt
jmp main |
src/aco-utils-byte_order.ads | jonashaggstrom/ada-canopen | 6 | 22166 | with Interfaces;
package ACO.Utils.Byte_Order is
pragma Preelaborate;
use Interfaces;
type Octets is array (Natural range <>) of Unsigned_8;
type Octets_2 is array (0 .. 1) of Unsigned_8;
type Octets_4 is array (0 .. 3) of Unsigned_8;
type Octets_8 is array (0 .. 7) of Unsigned_8;
function Swap_Bus (X : Unsigned_16) return Unsigned_16;
pragma Inline (Swap_Bus);
function Swap_Bus (X : Unsigned_32) return Unsigned_32;
pragma Inline (Swap_Bus);
function Swap_Bus (X : Octets_2) return Unsigned_16;
pragma Inline (Swap_Bus);
function Swap_Bus (X : Octets_4) return Unsigned_32;
pragma Inline (Swap_Bus);
function Swap_Bus (X : Unsigned_16) return Octets_2;
pragma Inline (Swap_Bus);
function Swap_Bus (X : Unsigned_32) return Octets_4;
pragma Inline (Swap_Bus);
procedure Swap (X : in out Octets);
pragma Inline (Swap);
function Swap_Bus (X : in Octets) return Octets;
pragma Inline (Swap_Bus);
end ACO.Utils.Byte_Order;
|
example/psg_direct/psgdrv.asm | suzukiplan/fcs80 | 2 | 7306 | <gh_stars>1-10
; AY-3-8910 Sound Driver for Z80
; Copyright 2021, <NAME> (MIT License)
defc PSGDRV_RAM_HEAD = $C000 ; 使用するRAMの先頭アドレス(そのアドレスから 17バイト のワーク領域を使用する)
defc PSGDRV_SEQUENCE_POSITION = PSGDRV_RAM_HEAD + 0
defc PSGDRV_WAIT_COUNTER = PSGDRV_RAM_HEAD + 2
defc PSGDRV_VOL_DOWN_INTERVAL_CH0 = PSGDRV_RAM_HEAD + 3
defc PSGDRV_VOL_DOWN_INTERVAL_CH1 = PSGDRV_RAM_HEAD + 4
defc PSGDRV_VOL_DOWN_INTERVAL_CH2 = PSGDRV_RAM_HEAD + 5
defc PSGDRV_VOL_DOWN_COUNTER_CH0 = PSGDRV_RAM_HEAD + 6
defc PSGDRV_VOL_DOWN_COUNTER_CH1 = PSGDRV_RAM_HEAD + 7
defc PSGDRV_VOL_DOWN_COUNTER_CH2 = PSGDRV_RAM_HEAD + 8
defc PSGDRV_LOOP_MARK = PSGDRV_RAM_HEAD + 9
defc PSGDRV_PITCH_DOWN_CH0 = PSGDRV_RAM_HEAD + 11
defc PSGDRV_PITCH_DOWN_CH1 = PSGDRV_RAM_HEAD + 12
defc PSGDRV_PITCH_DOWN_CH2 = PSGDRV_RAM_HEAD + 13
defc PSGDRV_PITCH_UP_CH0 = PSGDRV_RAM_HEAD + 14
defc PSGDRV_PITCH_UP_CH1 = PSGDRV_RAM_HEAD + 15
defc PSGDRV_PITCH_UP_CH2 = PSGDRV_RAM_HEAD + 16
; Z80 + AY-3-8910 用のシンプルなサウンドドライバ
; - psgdrv_execute を 1秒間に60回 呼び出せば OK
; - HL にシーケンスデータの先頭アドレスを指定する
; - レジスタの状態は保持されない(必要に応じて呼び出し元でpush/popする想定)
; - 裏レジスタは使用しない
; - シーケンスデータの仕様は README.md を参照
; - シーケンスデータはROM/RAMのどちらに配置してもOK (RAM展開せずにROMのデータを直接再生可能)
.psgdrv_execute
; Ch0 のソフトウェアエンベロープ処理を実行
ld a, (PSGDRV_VOL_DOWN_INTERVAL_CH0)
ld b, a
and $FF
jp z, psgdrv_execute_env1
in a, ($D8)
and $0F
jp z, psgdrv_execute_env1
ld c, a
ld a, (PSGDRV_VOL_DOWN_COUNTER_CH0)
jp z, psgdrv_execute_env0_pd
inc a
ld (PSGDRV_VOL_DOWN_COUNTER_CH0), a
cp a, b
jp nz, psgdrv_execute_env0_pd
ld a, 0
ld (PSGDRV_VOL_DOWN_COUNTER_CH0), a
ld a, c
dec a
out ($D8), a
psgdrv_execute_env0_pd:
ld a, (PSGDRV_PITCH_DOWN_CH0)
and $FF
jp z, psgdrv_execute_env0_pu
ld b, a
in a, ($D0)
add b
out ($D0), a
in a, ($D1)
adc 0
and $0F
out ($D1), a
psgdrv_execute_env0_pu:
ld a, (PSGDRV_PITCH_UP_CH0)
and $FF
jp z, psgdrv_execute_env1
ld b, a
in a, ($D0)
sub b
out ($D0), a
in a, ($D1)
sbc 0
and $0F
out ($D1), a
psgdrv_execute_env1:
; Ch1 のソフトウェアエンベロープ処理を実行
ld a, (PSGDRV_VOL_DOWN_INTERVAL_CH1)
ld b, a
and $FF
jp z, psgdrv_execute_env2
in a, ($D9)
and $0F
jp z, psgdrv_execute_env2
ld c, a
ld a, (PSGDRV_VOL_DOWN_COUNTER_CH1)
jp z, psgdrv_execute_env1_pd
inc a
ld (PSGDRV_VOL_DOWN_COUNTER_CH1), a
cp a, b
jp nz, psgdrv_execute_env1_pd
ld a, 0
ld (PSGDRV_VOL_DOWN_COUNTER_CH1), a
ld a, c
dec a
out ($D9), a
psgdrv_execute_env1_pd:
ld a, (PSGDRV_PITCH_DOWN_CH1)
and $FF
jp z, psgdrv_execute_env1_pu
ld b, a
in a, ($D2)
add b
out ($D2), a
in a, ($D3)
adc 0
and $0F
out ($D3), a
psgdrv_execute_env1_pu:
ld a, (PSGDRV_PITCH_UP_CH1)
and $FF
jp z, psgdrv_execute_env2
ld b, a
in a, ($D2)
sub b
out ($D2), a
in a, ($D3)
sbc 0
and $0F
out ($D3), a
psgdrv_execute_env2:
; Ch2 のソフトウェアエンベロープ処理を実行
ld a, (PSGDRV_VOL_DOWN_INTERVAL_CH2)
ld b, a
and $FF
jp z, psgdrv_execute_env3
in a, ($DA)
and $0F
jp z, psgdrv_execute_env3
ld c, a
ld a, (PSGDRV_VOL_DOWN_COUNTER_CH2)
jp z, psgdrv_execute_env3
inc a
ld (PSGDRV_VOL_DOWN_COUNTER_CH2), a
cp a, b
jp nz, psgdrv_execute_env3
ld a, 0
ld (PSGDRV_VOL_DOWN_COUNTER_CH2), a
ld a, c
dec a
out ($DA), a
psgdrv_execute_env2_pd:
ld a, (PSGDRV_PITCH_DOWN_CH2)
and $FF
jp z, psgdrv_execute_env2_pu
ld b, a
in a, ($D4)
add b
out ($D4), a
in a, ($D5)
adc 0
and $0F
out ($D5), a
psgdrv_execute_env2_pu:
ld a, (PSGDRV_PITCH_UP_CH2)
and $FF
jp z, psgdrv_execute_env3
ld b, a
in a, ($D4)
sub b
out ($D4), a
in a, ($D5)
sbc 0
and $0F
out ($D5), a
psgdrv_execute_env3:
; ウェイトカウンタの減算
ld a, (PSGDRV_WAIT_COUNTER)
and $FF
jp z, psgdrv_execute_1
dec a
ld (PSGDRV_WAIT_COUNTER), a
ret
psgdrv_execute_1:
; シーケンス位置へのシーク
ld bc, (PSGDRV_SEQUENCE_POSITION)
ld a, c
add l
ld l, a
ld a, h
adc b
ld h, a
; シーケンス処理ループ
psgdrv_execute_2:
ld a, (hl)
call psgdrv_increment_sequence_position
call psgdrv_parse
and $FF
jp nz, psgdrv_execute_2
ret
; シーケンス位置をインクリメント
.psgdrv_increment_sequence_position
inc hl
push hl
ld hl, (PSGDRV_SEQUENCE_POSITION)
inc hl
ld (PSGDRV_SEQUENCE_POSITION), hl
pop hl
ret
; シーケンスデータのパース処理
.psgdrv_parse
psgdrv_parse_tone0:
ld b, a
and $F0
jp nz, psgdrv_parse_tone1
call psgdrv_setup_tone_generator_Ch0
ld a, $FF ; keep sequence
ret
psgdrv_parse_tone1:
ld a, b
and $F0
cp $10
jp nz, psgdrv_parse_tone2
call psgdrv_setup_tone_generator_Ch1
ld a, $FF ; keep sequence
ret
psgdrv_parse_tone2:
ld a, b
and $F0
cp $20
jp nz, psgdrv_parse_keyon0
call psgdrv_setup_tone_generator_Ch2
ld a, $FF ; keep sequence
ret
psgdrv_parse_keyon0:
ld a, b
and $F0
cp $30
jp nz, psgdrv_parse_keyon1
call psgdrv_key_on_Ch0
ld a, $FF ; keep sequence
ret
psgdrv_parse_keyon1:
ld a, b
and $F0
cp $40
jp nz, psgdrv_parse_keyon2
call psgdrv_key_on_Ch1
ld a, $FF ; keep sequence
ret
psgdrv_parse_keyon2:
ld a, b
and $F0
cp $50
jp nz, psgdrv_parse_senv0
call psgdrv_key_on_Ch2
ld a, $FF ; keep sequence
ret
psgdrv_parse_senv0:
ld a, b
cp $60
jp nz, psgdrv_parse_senv1
ld a, (hl)
call psgdrv_increment_sequence_position
ld (PSGDRV_VOL_DOWN_INTERVAL_CH0), a
ld a, $FF ; keep sequence
ret
psgdrv_parse_senv1:
ld a, b
cp $61
jp nz, psgdrv_parse_senv2
ld a, (hl)
call psgdrv_increment_sequence_position
ld (PSGDRV_VOL_DOWN_INTERVAL_CH1), a
ld a, $FF ; keep sequence
ret
psgdrv_parse_senv2:
ld a, b
cp $62
jp nz, psgdrv_parse_wait
ld a, (hl)
call psgdrv_increment_sequence_position
ld (PSGDRV_VOL_DOWN_INTERVAL_CH2), a
ld a, $FF ; keep sequence
ret
psgdrv_parse_wait:
ld a, b
cp $63
jp nz, psgdrv_parse_noise
ld a, (hl)
call psgdrv_increment_sequence_position
ld (PSGDRV_WAIT_COUNTER), a
ld a, $00 ; end sequence
ret
psgdrv_parse_noise:
ld a, b
cp $64
jp nz, psgdrv_parse_mixing
call psgdrv_set_noise
ld a, $FF ; keep sequence
ret
psgdrv_parse_mixing:
ld a, b
cp $65
jp nz, psgdrv_parse_loop_mark
call psgdrv_set_mixing
ld a, $FF ; keep sequence
ret
psgdrv_parse_loop_mark:
ld a, b
cp $66
jp nz, psgdrv_parse_loop_jump
ld bc, (PSGDRV_SEQUENCE_POSITION)
ld a, c
ld (PSGDRV_LOOP_MARK), a
ld a, b
ld (PSGDRV_LOOP_MARK + 1), a
ld a, $FF ; keep sequence
ret
psgdrv_parse_loop_jump:
ld a, b
cp $67
jp nz, psgdrv_parse_pitch_down0
ld hl, (PSGDRV_LOOP_MARK)
ld a, l
ld (PSGDRV_SEQUENCE_POSITION), a
ld a, h
ld (PSGDRV_SEQUENCE_POSITION + 1), a
ld a, $FF ; keep sequence
ret
psgdrv_parse_pitch_down0:
ld a, b
cp $70
jp nz, psgdrv_parse_pitch_down1
ld a, (hl)
call psgdrv_increment_sequence_position
ld (PSGDRV_PITCH_DOWN_CH0), a
ld a, $FF ; keep sequence
ret
psgdrv_parse_pitch_down1:
ld a, b
cp $71
jp nz, psgdrv_parse_pitch_down2
ld a, (hl)
call psgdrv_increment_sequence_position
ld (PSGDRV_PITCH_DOWN_CH1), a
ld a, $FF ; keep sequence
ret
psgdrv_parse_pitch_down2:
ld a, b
cp $72
jp nz, psgdrv_parse_pitch_up0
ld a, (hl)
call psgdrv_increment_sequence_position
ld (PSGDRV_PITCH_DOWN_CH2), a
ld a, $FF ; keep sequence
ret
psgdrv_parse_pitch_up0:
ld a, b
cp $73
jp nz, psgdrv_parse_pitch_up1
ld a, (hl)
call psgdrv_increment_sequence_position
ld (PSGDRV_PITCH_UP_CH0), a
ld a, $FF ; keep sequence
ret
psgdrv_parse_pitch_up1:
ld a, b
cp $74
jp nz, psgdrv_parse_pitch_up2
ld a, (hl)
call psgdrv_increment_sequence_position
ld (PSGDRV_PITCH_UP_CH1), a
ld a, $FF ; keep sequence
ret
psgdrv_parse_pitch_up2:
ld a, b
cp $75
jp nz, psgdrv_parse_end
ld a, (hl)
call psgdrv_increment_sequence_position
ld (PSGDRV_PITCH_UP_CH2), a
ld a, $FF ; keep sequence
ret
psgdrv_parse_end:
; シーケンス終了(シーケンス位置をデクリメントしてそこから先を参照しないようにする)
ld hl, (PSGDRV_SEQUENCE_POSITION)
dec hl
ld (PSGDRV_SEQUENCE_POSITION), hl
ld a, $00 ; end sequence
ret
.psgdrv_setup_tone_generator_Ch0
ld a, b
and $0F
out ($D1), a
ld a, (hl)
call psgdrv_increment_sequence_position
out ($D0), a
ret
.psgdrv_setup_tone_generator_Ch1
ld a, b
and $0F
out ($D3), a
ld a, (hl)
call psgdrv_increment_sequence_position
out ($D2), a
ret
.psgdrv_setup_tone_generator_Ch2
ld a, b
and $0F
out ($D5), a
ld a, (hl)
call psgdrv_increment_sequence_position
out ($D4), a
ret
.psgdrv_key_on_Ch0
ld a, b
and $0F
out ($D8), a
ld a, 0
ld (PSGDRV_VOL_DOWN_COUNTER_CH0), a
ret
.psgdrv_key_on_Ch1
ld a, b
and $0F
out ($D9), a
ld a, 0
ld (PSGDRV_VOL_DOWN_COUNTER_CH1), a
ret
.psgdrv_key_on_Ch2
ld a, b
and $0F
out ($DA), a
ld a, 0
ld (PSGDRV_VOL_DOWN_COUNTER_CH2), a
ret
.psgdrv_set_noise
ld a, (hl)
call psgdrv_increment_sequence_position
out ($D6), a
ret
.psgdrv_set_mixing
ld a, (hl)
call psgdrv_increment_sequence_position
out ($D7), a
ret
|
oeis/000/A000253.asm | neoneye/loda-programs | 11 | 162747 | ; A000253: a(n) = 2*a(n-1) - a(n-2) + a(n-3) + 2^(n-1).
; Submitted by <NAME>
; 0,1,4,11,27,63,142,312,673,1432,3015,6295,13055,26926,55284,113081,230572,468883,951347,1926527,3894878,7863152,15855105,31936240,64269135,129234351,259690239,521524126,1046810092,2100221753,4212028452,8444387067,16924451083,33911510847,67932892270,136058593960,272455544865,545504864776,1092051732119,2185932051271,4375073049087,8755777406798,17521437071332,35060216296057,70150865949788,140355138719267,280803999873635,561772471155455,1123833569511870,2248173644452576,4497236143970049
lpb $0
sub $0,1
add $1,$3
add $2,1
sub $4,$1
add $4,$2
add $1,$4
mul $2,2
sub $3,$1
lpe
mov $0,$1
|
PIC16/assy/eeprom.asm | Classrooms/Microcontrollers | 1 | 87326 | <reponame>Classrooms/Microcontrollers<filename>PIC16/assy/eeprom.asm
; *******************************************************************
; Lesson 13 - EEPROM
;
; This lesson will provide code for writing and reading a single byte onto
; the on-board EEPROM. EEPROM is non-volatile memory, meaning that it does
; not lose its value when power is shut off. This is unlike RAM, which will
; lose its value when no power is applied. The EEPROM is useful for storing
; variables that must still be present during no power.
; It is also convenient to use if the entire RAM space is used up.
; Writes and reads to the EEPROM are practically instant and are much faster
; than program memory operations.
; Press the switch to save the LED state and then disconnect the power. When
; power is then applied again, the program will start with that same LED lit.
; When the lesson is first programmed, no LEDs will light up even with movement
; of the POT. When the switch is pressed, the corresponding LED will be lit and
; then the PIC will go to sleep until the switch is pressed again. Each press of
; the switch saves the ADC value into EEPROM. The PIC uses interrupts to wake up
; from sleep, take an ADC reading, save to EEPROM, and then goes back to sleep.
;
; PIC: 16F1829
; Assembler: MPASM V5.43
; IDE: MPLABX v1.0
;
; Hardware: PICkit3 Low Pin Count Demo Board
; Date: 12.2011
;
; *******************************************************************
; * See Low Pin Count Demo Board User's Guide for Lesson Information*
; *******************************************************************
#include <p16F1829.inc>
__CONFIG _CONFIG1, (_FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF);
__CONFIG _CONFIG2, (_WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _LVP_OFF);
errorlevel -302 ;surpress the 'not in bank0' warning
#define DOWN 0x00 ;when SW1 is pressed, the voltage is pulled down through R3 to ground (GND)
#define UP 0xFF ;when SW1 is not pressed, the voltage is pulled up through R1 to Power (Vdd)
#define EEPROM_ADDR 0x00 ;read from the start of EEPROM where the ADC value will be saved
#define SWITCH PORTA, 2 ;pin where SW1 is connected..NOTE: always READ from the PORT and WRITE to the LATCH
cblock 0x70 ;shared memory location that is accessible from all banks
Delay1
endc
; -------------------LATC-----------------
; Bit#: -7---6---5---4---3---2---1---0---
; LED: ---------------|DS4|DS3|DS2|DS1|-
; -----------------------------------------
Org 0x0000 ;Reset Vector starts at 0x0000
bra Start ;main code execution
Org 0x0004 ;ISR Vector starts at 0x04
bra ISR
Start:
;Setup main init
banksel OSCCON ;bank1
movlw b'00111000' ;set cpu clock speed of 500KHz
movwf OSCCON ;move contents of the working register into OSCCON
;Configure the LEDs
clrf TRISC ;make all of PORTC an output
banksel LATC ;bank2
movlw b'00001000' ;start with DS4 lit
;Configure the ADC/Potentimator
banksel TRISA ;bank1
bsf TRISA, 4 ;Potentimator is connected to RA4....set as input
movlw b'00001101' ;select RA4 as source of ADC and enable the module (carefull, this is actually AN3)
movwf ADCON0
movlw b'00010000' ;left justified - Fosc/8 speed - vref is Vdd
movwf ADCON1
banksel ANSELA ;bank3
bsf ANSELA, 4 ;analog for ADC
;Setup SW1 as digital input
banksel TRISA ;bank1
bsf TRISA, RA2 ;switch as input
banksel ANSELA ;bank3
bcf ANSELA, RA2 ;digital
;can reference pins by their position in the PORT (2) or name (RA2)
;Setup interrupt-on-change for the switch
bsf INTCON, IOCIE ;must set this global enable flag to allow any interrupt-on-change flags to cuase an interrupt
banksel IOCAN ;bank7
bsf IOCAN, IOCAN2 ;when SW1 is pressed, enter the ISR (Note, this is set when a FALLING EDGE is detected)
bsf INTCON, GIE ;must set this global to allow any interrupt to bring the program into the ISR
;if this is not set, the interrupt flags will still get set, but the ISR will never be entered
movlw EEPROM_ADDR ;read from the first byte where the previous ADC value was saved
call EERead ;read the first byte of EEPROM
banksel LATC ;bank2
movwf LATC ;move ADC result into the LEDs
MainLoop:
SLEEP ;sleep until SW1 is pressed/released
;The PIC will wake up and immediately enter the ISR when RABIF
;is set. This will happen with either a rising or falling edge is
;detected on RA3, or rather SW1
bra MainLoop
EERead:
banksel EEADRL ;bank3
movwf EEADRL ;address is in wreg
bcf EECON1, EEPGD ;point to DATA memory
bcf EECON1, CFGS ;access EEPROM
bsf EECON1, RD ;EEPROM read
movf EEDATL, w ;save in wreg
return ;return to MainLoop with answer in wreg
A2d:
;Start the ADC
nop ;requried ADC delay of 8uS => (1/(Fosc/4)) = (1/(500KHz/4)) = 8uS
banksel ADCON0 ;bank1
bsf ADCON0, GO ;start the ADC
btfsc ADCON0, GO ;this bit will be cleared when the conversion is complete
goto $-1 ;keep checking the above line until GO bit is clear
swapf ADRESH, w ;only save the high nibble
return
Debounce:
;delay for approximatly 5ms
movlw d'209' ;(1/(500KHz/4))*209*3 = 5.016mS
movwf Delay1
DebounceLoop:
decfsz Delay1, f ;1 instruction to decrement,unless if branching (ie Delay1 = 0)
bra DebounceLoop ;2 instructions to branch
banksel PORTA ;bank0
btfsc SWITCH ;check if switch is still down.
retfie ;exit without doing anything
call A2d ;Get here if switch is still held down - get the current ADC value
banksel LATC ;bank2
movwf LATC ;display result on the LEDs
;Writes one byte to EEPROM at EEPROM_ADDR
EEWrite:
banksel EEADRL ;bank3
movwf EEDATL ;move the ADC result into EEDATA (previously saved in wreg)
movlw EEPROM_ADDR ;move the address into wreg
movwf EEADRL ;indicates where to write
bcf EECON1, EEPGD ;point to DATA memory
bcf EECON1, CFGS ;access EEPROM
bsf EECON1, WREN ;enable writes
bcf INTCON, GIE ;ALWAYS disable interrupts before writting to EEPROM!!
;NOTE: While inside the ISR, GIE will be cleared in hardware automatically, so the above line is not
;necessary, although it is good practice to always do this anyways. GIE will be set in hardware (if
;enabled previously) after the ISR is exited
;REQUIRED SEQUENCE
movlw 0x55
movwf EECON2
movlw 0xAA
movwf EECON2
bsf EECON1, WR ;begin write
;END REQUIRED SEQUENCE
bcf EECON1, WREN ;disable writes
btfsc EECON1, WR ;wait for write to be complete
bra $-1
bsf INTCON, GIE ;re-enable interrupts
return ;return to 'Service_SW1' label
ISR:
banksel IOCAF ;bank7
btfsc IOCAF, 2 ;check for IOC flag for switch
bra Service_SW1
retfie ;nope, exit ISR
Service_SW1:
bcf INTCON, IOCIF
clrf IOCAF ;MUST ALWAYS clear this in software or else stuck in the ISR forever
call Debounce ;delay for 5ms and then check the switch again
retfie
end ;end code |
oeis/010/A010802.asm | neoneye/loda-programs | 11 | 22286 | ; A010802: 14th powers: a(n) = n^14.
; 0,1,16384,4782969,268435456,6103515625,78364164096,678223072849,4398046511104,22876792454961,100000000000000,379749833583241,1283918464548864,3937376385699289,11112006825558016,29192926025390625,72057594037927936,168377826559400929,374813367582081024,799006685782884121,1638400000000000000,3243919932521508681,6221821273427820544,11592836324538749809,21035720123168587776,37252902984619140625,64509974703297150976,109418989131512359209,182059119829942534144,297558232675799463481
pow $0,14
|
src/view/lse-view-callbacks.ads | mgrojo/lsystem-editor | 2 | 12581 | <filename>src/view/lse-view-callbacks.ads
-------------------------------------------------------------------------------
-- LSE -- L-System Editor
-- Author: Heziode
--
-- License:
-- MIT License
--
-- Copyright (c) 2018 <NAME> (Heziode) <<EMAIL>>
--
-- 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 Cairo;
with Gtk.Color_Button;
with Gtk.Widget;
with LSE.View.View;
use Cairo;
use Gtk.Color_Button;
use Gtk.Widget;
use LSE.View.View;
package LSE.View.Callbacks is
-- Reference of the view. (VERY Very very ugly)
View : Instance;
-- Call to stop the program
procedure Stop_Program (Emitter : access Gtk_Widget_Record'Class);
-- Callback to change L-System level to develop
procedure LS_Level_Cb (Emitter : access Gtk_Widget_Record'Class);
-- Callback to start new file
procedure New_File_Cb (Emitter : access Gtk_Widget_Record'Class);
-- Callback to open a L-System from a file
procedure Open_File_Cb (Emitter : access Gtk_Widget_Record'Class);
-- Callback to save the L-System
procedure Save_File_Cb (Emitter : access Gtk_Widget_Record'Class);
-- Callback to save the L-System in new file
procedure Save_As_File_Cb (Emitter : access Gtk_Widget_Record'Class);
-- Callback to validate the L-System
procedure Validate_Cb (Emitter : access Gtk_Widget_Record'Class);
-- Callback to change the background color
procedure Bg_Color_Cb (Emitter : access Gtk_Widget_Record'Class);
-- Callback to change the foreground color
procedure Fg_Color_Cb (Emitter : access Gtk_Widget_Record'Class);
-- Callback to export the L-System
procedure Export_Cb (Emitter : access Gtk_Widget_Record'Class;
Format : String);
-- Callback to show About dialog
procedure About_Cb (Emitter : access Gtk_Widget_Record'Class);
-- Callback when user want to add / remove background color in export
procedure Export_Bg_Color_Cb (Emitter : access Gtk_Widget_Record'Class;
Item : Gtk_Color_Button);
-- Callback when draw
function Draw_Cb (Emitter : access Gtk_Widget_Record'Class;
Cr : Cairo.Cairo_Context) return Boolean;
-- Callback when window is resized
procedure Size_Allocate_Cb (Emitter : access Gtk_Widget_Record'Class;
Allocation : Gtk_Allocation);
end LSE.View.Callbacks;
|
oeis/006/A006579.asm | neoneye/loda-programs | 11 | 97768 | <reponame>neoneye/loda-programs
; A006579: Sum of gcd(n,k) for k = 1 to n-1.
; Submitted by <NAME>
; 0,1,2,4,4,9,6,12,12,17,10,28,12,25,30,32,16,45,18,52,44,41,22,76,40,49,54,76,28,105,30,80,72,65,82,132,36,73,86,140,40,153,42,124,144,89,46,192,84,145,114,148,52,189,134,204,128,113,58,300,60,121,210,192,160,249,66,196,156,281,70,348,72,145,250,220,196,297,78,352,216,161,82,436,212,169,198,332,88,477,234,268,212,185,238,464,96,301,342,420
mov $1,$0
seq $0,18804 ; Pillai's arithmetical function: Sum_{k=1..n} gcd(k, n).
sub $0,$1
sub $0,1
|
src/usb-device-midi.adb | JeremyGrosser/usb_embedded | 14 | 4179 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2018-2021, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. 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. --
-- 3. 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 --
-- 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. --
-- --
------------------------------------------------------------------------------
with System; use System;
with USB.Utils;
with USB.Logging.Device;
with BBqueue; use BBqueue;
with BBqueue.Buffers; use BBqueue.Buffers;
package body USB.Device.MIDI is
EP_Buffer_Size : constant := 64;
-------------
-- Receive --
-------------
function Receive (This : in out Default_MIDI_Class;
Evt : out MIDI_Event)
return Boolean
is
RG : BBqueue.Buffers.Read_Grant;
begin
-- if Logs_Enabled then
-- USB.Logging.Device.Log_MIDI_Receive;
-- end if;
Read (This.RX_Queue, RG, 4);
if State (RG) = Valid then
declare
Src : MIDI_Event with Address => Slice (RG).Addr;
begin
Evt := Src;
end;
Release (This.RX_Queue, RG);
return True;
else
return False;
end if;
end Receive;
----------
-- Send --
----------
procedure Send (This : in out Default_MIDI_Class;
UDC : in out USB_Device_Controller'Class;
Evt : MIDI_Event)
is
WG : BBqueue.Buffers.Write_Grant;
begin
if Logs_Enabled then
USB.Logging.Device.Log_MIDI_Send;
end if;
Grant (This.TX_Queue, WG, 4);
if State (WG) = Valid then
declare
Dst : MIDI_Event with Address => Slice (WG).Addr;
begin
Dst := Evt;
end;
Commit (This.TX_Queue, WG);
else
This.TX_Discarded := This.TX_Discarded + 1;
end if;
This.Setup_TX (UDC);
end Send;
--------------
-- Setup_RX --
--------------
procedure Setup_RX (This : in out Default_MIDI_Class;
UDC : in out USB_Device_Controller'Class)
is
begin
if Logs_Enabled then
USB.Logging.Device.Log_MIDI_Setup_RX;
end if;
UDC.EP_Ready_For_Data (EP => This.EP,
Addr => This.EP_Out_Buf,
Max_Len => EP_Buffer_Size,
Ready => True);
end Setup_RX;
--------------
-- Setup_TX --
--------------
procedure Setup_TX (This : in out Default_MIDI_Class;
UDC : in out USB_Device_Controller'Class)
is
RG : BBqueue.Buffers.Read_Grant;
In_Progress : Boolean;
begin
if Logs_Enabled then
USB.Logging.Device.Log_MIDI_Setup_TX;
end if;
Atomic.Test_And_Set (This.TX_In_Progress, In_Progress);
if In_Progress then
return;
end if;
Read (This.TX_Queue, RG, EP_Buffer_Size);
if State (RG) = Valid then
-- Copy into IN buffer
USB.Utils.Copy (Src => Slice (RG).Addr,
Dst => This.EP_In_Buf,
Count => Natural (Slice (RG).Length));
if Logs_Enabled then
USB.Logging.Device.Log_MIDI_Write_Packet;
end if;
-- Send IN buffer
UDC.EP_Write_Packet (Ep => This.EP,
Addr => This.EP_In_Buf,
Len => UInt32 (Slice (RG).Length));
Release (This.TX_Queue, RG);
else
Atomic.Clear (This.TX_In_Progress);
end if;
end Setup_TX;
----------------
-- Initialize --
----------------
overriding
function Initialize (This : in out Default_MIDI_Class;
Dev : in out USB_Device_Stack'Class;
Base_Interface_Index : Interface_Id)
return Init_Result
is
begin
if Logs_Enabled then
USB.Logging.Device.Log_MIDI_Init;
end if;
if not Dev.Request_Endpoint (Interrupt, This.EP) then
return Not_Enough_EPs;
end if;
This.EP_Out_Buf := Dev.Request_Buffer ((This.EP, EP_Out),
EP_Buffer_Size);
if This.EP_Out_Buf = System.Null_Address then
return Not_Enough_EP_Buffer;
end if;
This.EP_In_Buf := Dev.Request_Buffer ((This.EP, EP_In),
EP_Buffer_Size);
if This.EP_In_Buf = System.Null_Address then
return Not_Enough_EP_Buffer;
end if;
This.Interface_Index := Base_Interface_Index;
return Ok;
end Initialize;
--------------------
-- Get_Class_Info --
--------------------
overriding
procedure Get_Class_Info
(This : in out Default_MIDI_Class;
Number_Of_Interfaces : out Interface_Id;
Config_Descriptor_Length : out Natural)
is
pragma Unreferenced (This);
begin
Number_Of_Interfaces := 2;
Config_Descriptor_Length := 92;
end Get_Class_Info;
----------------------------
-- Fill_Config_Descriptor --
----------------------------
overriding
procedure Fill_Config_Descriptor (This : in out Default_MIDI_Class;
Data : out UInt8_Array)
is
F : constant Natural := Data'First;
USB_DESC_TYPE_INTERFACE : constant := 4;
USB_DESC_TYPE_ENDPOINT : constant := 5;
begin
pragma Style_Checks (Off);
-- B.3.1 Standard AC Interface Descriptor
-- The AudioControl interface has no dedicated endpoints associated with it. It uses the
-- default pipe (endpoint 0) for all communication purposes. Class-specific AudioControl
-- Requests are sent using the default pipe. There is no Status Interrupt endpoint provided.
-- descriptor follows inline: */
Data (F + 0 .. F + 91) :=
(9, -- sizeof(usbDescrInterface): length of descriptor in bytes
USB_DESC_TYPE_INTERFACE, -- descriptor type
UInt8 (This.Interface_Index), -- index of this interface
0, -- alternate setting for this interface
0, -- endpoints excl 0: number of endpoint descriptors to follow
1, -- Class audio
1, -- Subclass control
0, --
0, -- string index for interface */
-- B.3.2 Class-specific AC Interface Descriptor
-- The Class-specific AC interface descriptor is always headed by a Header descriptor
-- that contains general information about the AudioControl interface. It contains all
-- the pointers needed to describe the Audio Interface Collection, associated with the
-- described audio function. Only the Header descriptor is present in this device
-- because it does not contain any audio functionality as such.
-- descriptor follows inline: */
9, -- sizeof(usbDescrCDC_HeaderFn): length of descriptor in bytes */
36, -- descriptor type */
1, -- header functional descriptor */
0, 0, -- bcdADC */
9, 0, -- wTotalLength */
1, -- */
1, -- */
-- B.4 MIDIStreaming Interface Descriptors
-- B.4.1 Standard MS Interface Descriptor
-- descriptor follows inline: */
9, -- length of descriptor in bytes */
USB_DESC_TYPE_INTERFACE, -- descriptor type */
UInt8 (This.Interface_Index + 1), -- index of this interface */
0, -- alternate setting for this interface */
2, -- endpoints excl 0: number of endpoint descriptors to follow */
1, -- AUDIO */
3, -- MIDI Streaming */
0, -- unused */
0, -- string index for interface */
-- B.4.2 Class-specific MS Interface Descriptor
-- descriptor follows inline: */
7, -- length of descriptor in bytes */
36, -- descriptor type */
1, -- header functional descriptor */
0, 1, -- bcdADC */
65, 0, -- wTotalLength */
-- B.4.3 MIDI IN Jack Descriptor
-- descriptor follows inline: */
6, -- bLength */
36, -- descriptor type */
2, -- MIDI_IN_JACK desc subtype */
1, -- EMBEDDED bJackType */
1, -- bJackID */
0, -- iJack */
-- descriptor follows inline: */
6, -- bLength */
36, -- descriptor type */
2, -- MIDI_IN_JACK desc subtype */
2, -- EXTERNAL bJackType */
2, -- bJackID */
0, -- iJack */
-- B.4.4 MIDI OUT Jack Descriptor
-- descriptor follows inline: */
9, -- length of descriptor in bytes */
36, -- descriptor type */
3, -- MIDI_OUT_JACK descriptor */
1, -- EMBEDDED bJackType */
3, -- bJackID */
1, -- No of input pins */
2, -- BaSourceID */
1, -- BaSourcePin */
0, -- iJack */
-- descriptor follows inline: */
9, -- bLength of descriptor in bytes */
36, -- bDescriptorType */
3, -- MIDI_OUT_JACK bDescriptorSubtype */
2, -- EXTERNAL bJackType */
4, -- bJackID */
1, -- bNrInputPins */
1, -- baSourceID (0) */
1, -- baSourcePin (0) */
0, -- iJack */
-- B.5 Bulk OUT Endpoint Descriptors
-- here 27 ---
-- B.5.1 Standard Bulk OUT Endpoint Descriptor
-- descriptor follows inline: */
9, -- bLenght */
USB_DESC_TYPE_ENDPOINT, -- bDescriptorType = endpoint */
UInt8 (This.EP), -- bEndpointAddress OUT endpoint number 1 */
2, -- bmAttributes: 2:Bulk, 3:Interrupt endpoint */
EP_Buffer_Size, 0, -- wMaxPacketSize */
10, -- bInterval in ms */
0, -- bRefresh */
0, -- bSyncAddress */
-- B.5.2 Class-specific MS Bulk OUT Endpoint Descriptor
-- descriptor follows inline: */
5, -- bLength of descriptor in bytes */
37, -- bDescriptorType */
1, -- bDescriptorSubtype */
1, -- bNumEmbMIDIJack */
1, -- baAssocJackID (0) */
-- B.6 Bulk IN Endpoint Descriptors
-- B.6.1 Standard Bulk IN Endpoint Descriptor
-- descriptor follows inline: */
9, -- bLenght */
USB_DESC_TYPE_ENDPOINT, -- bDescriptorType = endpoint */
16#80# or UInt8 (This.EP), -- bEndpointAddress IN endpoint number 1 */
2, -- bmAttributes: 2: Bulk, 3: Interrupt endpoint */
EP_Buffer_Size, 0, -- wMaxPacketSize */
10, -- bInterval in ms */
0, -- bRefresh */
0, -- bSyncAddress */
-- B.6.2 Class-specific MS Bulk IN Endpoint Descriptor
-- descriptor follows inline: */
5, -- bLength of descriptor in bytes */
37, -- bDescriptorType */
1, -- bDescriptorSubtype */
1, -- bNumEmbMIDIJack (0) */
3 -- baAssocJackID (0) */
);
end Fill_Config_Descriptor;
---------------
-- Configure --
---------------
overriding function Configure
(This : in out Default_MIDI_Class;
UDC : in out USB_Device_Controller'Class;
Index : UInt16)
return Setup_Request_Answer
is
begin
if Logs_Enabled then
USB.Logging.Device.Log_MIDI_Config;
end if;
if Index = 1 then
UDC.EP_Setup (EP => (This.EP, EP_In),
Typ => Bulk,
Max_Size => EP_Buffer_Size);
UDC.EP_Setup (EP => (This.EP, EP_Out),
Typ => Bulk,
Max_Size => EP_Buffer_Size);
This.Setup_RX (UDC);
This.State := Idle;
return Handled;
else
return Not_Supported;
end if;
end Configure;
-------------------
-- Setup_Request --
-------------------
overriding
function Setup_Read_Request (This : in out Default_MIDI_Class;
Req : Setup_Data;
Buf : out System.Address;
Len : out Buffer_Len)
return Setup_Request_Answer
is
begin
Buf := System.Null_Address;
Len := 0;
if Req.RType.Typ = Class and then Req.RType.Recipient = Iface then
case Req.Request is
when 1 => -- GET_REPORT
return Not_Supported;
when 2 => -- GET_IDLE
return Not_Supported;
when 3 => -- GET_PROTOCOL
return Not_Supported;
when 9 => -- SET_REPORT
return Not_Supported;
when 10 => -- SET_IDLE
This.Idle_State := UInt8 (Shift_Right (Req.Value, 8) and 16#FF#);
return Handled;
when 11 => -- SET_PROTOCOL
return Not_Supported;
when others =>
return Next_Callback;
end case;
end if;
if Req.RType.Typ = Stand
and then
Req.Request = 6 -- GET_DESCRIPTOR
then
declare
-- Index : constant UInt8 := UInt8 (Req.Value and 16#FF#);
Desc_Type : constant UInt8 :=
UInt8 (Shift_Right (Req.Value, 8) and 16#FF#);
begin
case Desc_Type is
when others =>
raise Program_Error with "Unknown desc in MIDI class";
end case;
end;
end if;
return Next_Callback;
end Setup_Read_Request;
-------------------------
-- Setup_Write_Request --
-------------------------
overriding
function Setup_Write_Request (This : in out Default_MIDI_Class;
Req : Setup_Data;
Data : UInt8_Array)
return Setup_Request_Answer
is (Not_Supported);
-----------------------
-- Transfer_Complete --
-----------------------
overriding
procedure Transfer_Complete (This : in out Default_MIDI_Class;
UDC : in out USB_Device_Controller'Class;
EP : EP_Addr;
CNT : UInt11)
is
begin
if EP = (This.EP, EP_Out) then
if Logs_Enabled then
USB.Logging.Device.Log_MIDI_Out_TC;
end if;
-- Move OUT data to the RX queue
declare
WG : BBqueue.Buffers.Write_Grant;
begin
Grant (This.RX_Queue, WG, BBqueue.Count (CNT));
if State (WG) = Valid then
USB.Utils.Copy (Src => This.EP_Out_Buf,
Dst => Slice (WG).Addr,
Count => CNT);
Commit (This.RX_Queue, WG, BBqueue.Count (CNT));
else
if Logs_Enabled then
USB.Logging.Device.Log_MIDI_RX_Discarded;
end if;
This.RX_Discarded := This.RX_Discarded + 1;
end if;
end;
This.Setup_RX (UDC);
elsif EP = (This.EP, EP_In) then
if Logs_Enabled then
USB.Logging.Device.Log_MIDI_In_TC;
end if;
Atomic.Clear (This.TX_In_Progress);
This.Setup_TX (UDC);
else
raise Program_Error with "Not expecting transfer on EP";
end if;
end Transfer_Complete;
end USB.Device.MIDI;
|
testsuite/xml/TN-26/xml-sax-input_sources-streams-test_sockets.adb | svn2github/matreshka | 24 | 4617 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Testsuite Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010, <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.Unchecked_Conversion;
package body XML.SAX.Input_Sources.Streams.Test_Sockets is
function To_Stream_Element_Array
(Value : String) return Ada.Streams.Stream_Element_Array;
-----------------------------
-- To_Stream_Element_Array --
-----------------------------
function To_Stream_Element_Array
(Value : String) return Ada.Streams.Stream_Element_Array
is
subtype Source is String (Value'Range);
subtype Result is Ada.Streams.Stream_Element_Array
(Ada.Streams.Stream_Element_Offset (Value'First)
.. Ada.Streams.Stream_Element_Offset (Value'Last));
function To_Array is new Ada.Unchecked_Conversion (Source, Result);
begin
return To_Array (Value);
end To_Stream_Element_Array;
S1 : aliased constant Ada.Streams.Stream_Element_Array
:= To_Stream_Element_Array
("<?xml version='1.0'?>"
& "<stream:stream"
& " xmlns='jabber:client'"
& " xmlns:stream='http://etherx.jabber.org/streams'"
& " id='2626941369'"
& " from='jabber.ru'"
& " version='1.0'"
& " xml:lang='ru'>");
S2 : aliased constant Ada.Streams.Stream_Element_Array
:= To_Stream_Element_Array ("");
S3 : aliased constant Ada.Streams.Stream_Element_Array
:= To_Stream_Element_Array
("<stream:features>"
& "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"
& "<compression xmlns='http://jabber.org/features/compress'>"
& "<method>zlib</method>"
& "</compression>"
& "<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>"
& "<mechanism>PLAIN</mechanism>"
& "<mechanism>DIGEST-MD5</mechanism>"
& "</mechanisms>"
& "<register xmlns='http://jabber.org/features/iq-register'/>"
& "</stream:features>");
type Stream_Element_Array_Access is
access constant Ada.Streams.Stream_Element_Array;
Test_Data : constant
array (Positive range <>) of Stream_Element_Array_Access
:= (S1'Access, S2'Access, S3'Access);
----------
-- Read --
----------
overriding procedure Read
(Self : in out Test_Socket_Input_Source;
Buffer : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
End_Of_Data : out Boolean) is
begin
Self.Pass := Self.Pass + 1;
End_Of_Data := False;
if Self.Pass in Test_Data'Range then
Last := Buffer'First + Test_Data (Self.Pass)'Length - 1;
Buffer (Buffer'First .. Last) := Test_Data (Self.Pass).all;
else
Last := Buffer'First - 1;
end if;
end Read;
end XML.SAX.Input_Sources.Streams.Test_Sockets;
|
src/init_project.adb | GLADORG/glad-cli | 0 | 3457 | with Ada.Text_IO;
with Ada.Directories;
with Ada.Command_Line;
with Templates_Parser;
with CLIC.TTY;
with Filesystem;
with Commands;
with Blueprint; use Blueprint;
package body Init_Project is
package IO renames Ada.Text_IO;
package TT renames CLIC.TTY;
use Ada.Directories;
Errors : Boolean := false;
Filter : constant Filter_Type :=
(Ordinary_File => True, Special_File => False, Directory => True);
procedure Init (Path : String; ToDo: Action) is
Blueprint_Folder : String := Get_Blueprint_Folder;
App_Blueprint_Folder : String := Compose (Blueprint_Folder, "app");
Blueprint : String := "standard";
Blueprint_Path : String := Compose (App_Blueprint_Folder, Blueprint);
Name : String := Simple_Name (Path);
begin
Templates_Parser.Insert
(Commands.Translations, Templates_Parser.Assoc ("APPNAME", Name));
if Exists (Blueprint_Path) then
IO.Put_Line
(TT.Italic ("Creating a new project") & " " & TT.Bold (Path) & ":");
Iterate (Blueprint_Path, Path, ToDo);
IO.New_Line;
if Errors then
IO.Put_Line
(TT.Warn ("Created project") & " " & TT.Bold (Name) & " " & "with errors.");
else
IO.Put_Line (TT.Success( "Successfully created project") & " " & TT.Warn (TT.Bold (Name)));
end if;
IO.New_Line;
IO.Put_Line
(TT.Info
(TT.Description ("Build your project using") & " " &
TT.Terminal ("/scripts/build.sh")));
IO.Put_Line
(TT.Info
(TT.Description ("Add components and other items using") & " " &
TT.Terminal ("glad generate")));
else
IO.Put_Line (TT.Error("Blueprint not found: " & Blueprint_Path));
end if;
-- TODO: Move text out into xml file
end Init;
end Init_Project; |
agda-stdlib/src/Relation/Binary/Indexed/Homogeneous.agda | DreamLinuxer/popl21-artifact | 5 | 12751 | <gh_stars>1-10
------------------------------------------------------------------------
-- The Agda standard library
--
-- Homogeneously-indexed binary relations
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Relation.Binary.Indexed.Homogeneous where
------------------------------------------------------------------------
-- Publicly export core definitions
open import Relation.Binary.Indexed.Homogeneous.Core public
open import Relation.Binary.Indexed.Homogeneous.Definitions public
open import Relation.Binary.Indexed.Homogeneous.Structures public
open import Relation.Binary.Indexed.Homogeneous.Bundles public
------------------------------------------------------------------------
-- DEPRECATED NAMES
------------------------------------------------------------------------
-- Please use the new names as continuing support for the old names is
-- not guaranteed.
-- Version 0.17
REL = IREL
{-# WARNING_ON_USAGE REL
"Warning: REL was deprecated in v0.17.
Please use IREL instead."
#-}
Rel = IRel
{-# WARNING_ON_USAGE Rel
"Warning: Rel was deprecated in v0.17.
Please use IRel instead."
#-}
|
arch/z80/src/ez80/ez80f92_loader.asm | eenurkka/incubator-nuttx | 1,006 | 247344 | ;**************************************************************************
; arch/z80/src/ez80/ez80f92_loader.asm
;
; Licensed to the Apache Software Foundation (ASF) under one or more
; contributor license agreements. See the NOTICE file distributed with
; this work for additional information regarding copyright ownership. The
; ASF licenses this file to you 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.
;
;**************************************************************************
;**************************************************************************
; Global Symbols Imported
;**************************************************************************
xref __vecstart
xref __vecend
xref _ez80_irq_common
;**************************************************************************
; Global Symbols Exported
;**************************************************************************
xdef _ez80_initvectors
;**************************************************************************
; Constants
;**************************************************************************
NVECTORS EQU 64 ; Max possible interrupt vectors
EZ80_UNUSED EQU 64 ; Denotes an unused vector
; RAM Memory map
;
; __vecstart Beginning of Interrupt Redirection information. This is
; used to hand off to RAM-based handlers for interrupts
; caught by FLASH interrupt vectors.
; __vecend End of the Interrupt Redirection information.
; __loaderstart Start of RAM used exclusively by the bootloader. This
; memory region an be recovered by the RAM-based program.
; __loaderend End of the bootloader RAM.
; __progstart Start of CODE for the RAM-based program. The program can
; freely use the memory region from _progstart-_progend and
; can recover the memory for _loaderstart-_loaderend for heap
; usage.
; __progend End of RAM/End of the RAM-based program
VECSTART EQU __vecstart ; Start of interrupt redirection area
VECSIZE EQU __vecend - __vecstart ; Size of interrupt redirection area
;**************************************************************************
; Macros
;**************************************************************************
; Define one interrupt handler
irqhandler: macro vectno
; Save AF on the stack, set the interrupt number and jump to the
; common reset handling logic.
; Offset 8: Return PC is already on the stack
push af ; Offset 7: AF (retaining flags)
ld a, #vectno ; A = vector number
jp _ez80_irq_common ; Remaining RST handling is common
endmac irqhandler
;**************************************************************************
; Vector Table
;**************************************************************************
; This segment must be aligned on a 256 byte boundary anywhere in RAM
; Each entry will be a 2-byte address in a 2-byte space. The vector table
; will always reside in FLASH memory; Only the loader in FLASH provides
; the vector table.
define .IVECTS, space = ROM, align = 100h
segment .IVECTS
; Vector table is a 2-bit address. The MSB is the I register; the LSB is
; the vector number. The vector table lies in FLASH. The addresses
; contained in the refers to an entry in the handler table that re-
; directs the interrupt to common interrupt handling logic.
_ez80_vectable:
dw _ez80_redirect + 0*_redirsize
dw _ez80_redirect + 1*_redirsize
dw _ez80_redirect + 2*_redirsize
dw _ez80_redirect + 3*_redirsize
dw _ez80_redirect + 4*_redirsize
dw _ez80_redirect + 5*_redirsize
dw _ez80_redirect + 6*_redirsize
dw _ez80_redirect + 7*_redirsize
dw _ez80_redirect + 8*_redirsize
dw _ez80_redirect + 9*_redirsize
dw _ez80_redirect + 10*_redirsize
dw _ez80_redirect + 11*_redirsize
dw _ez80_redirect + 12*_redirsize
dw _ez80_redirect + 13*_redirsize
dw _ez80_redirect + 14*_redirsize
dw _ez80_redirect + 15*_redirsize
dw _ez80_redirect + 16*_redirsize
dw _ez80_redirect + 17*_redirsize
dw _ez80_redirect + 18*_redirsize
dw _ez80_redirect + 19*_redirsize
dw _ez80_redirect + 20*_redirsize
dw _ez80_redirect + 21*_redirsize
dw _ez80_redirect + 22*_redirsize
dw _ez80_redirect + 23*_redirsize
dw _ez80_redirect + 24*_redirsize
dw _ez80_redirect + 25*_redirsize
dw _ez80_redirect + 26*_redirsize
dw _ez80_redirect + 27*_redirsize
dw _ez80_redirect + 28*_redirsize
dw _ez80_redirect + 29*_redirsize
dw _ez80_redirect + 30*_redirsize
dw _ez80_redirect + 31*_redirsize
dw _ez80_redirect + 32*_redirsize
dw _ez80_redirect + 33*_redirsize
dw _ez80_redirect + 34*_redirsize
dw _ez80_redirect + 35*_redirsize
dw _ez80_redirect + 36*_redirsize
dw _ez80_redirect + 37*_redirsize
dw _ez80_redirect + 38*_redirsize
dw _ez80_redirect + 39*_redirsize
dw _ez80_redirect + 40*_redirsize
dw _ez80_redirect + 41*_redirsize
dw _ez80_redirect + 42*_redirsize
dw _ez80_redirect + 43*_redirsize
dw _ez80_redirect + 44*_redirsize
dw _ez80_redirect + 45*_redirsize
dw _ez80_redirect + 46*_redirsize
dw _ez80_redirect + 47*_redirsize
dw _ez80_redirect + 48*_redirsize
dw _ez80_redirect + 49*_redirsize
dw _ez80_redirect + 50*_redirsize
dw _ez80_redirect + 51*_redirsize
dw _ez80_redirect + 52*_redirsize
dw _ez80_redirect + 53*_redirsize
dw _ez80_redirect + 54*_redirsize
dw _ez80_redirect + 55*_redirsize
dw _ez80_redirect + 56*_redirsize
dw _ez80_redirect + 57*_redirsize
dw _ez80_redirect + 58*_redirsize
dw _ez80_redirect + 59*_redirsize
dw _ez80_redirect + 60*_redirsize
dw _ez80_redirect + 61*_redirsize
dw _ez80_redirect + 62*_redirsize
dw _ez80_redirect + 63*_redirsize
;**************************************************************************
; Interrupt Redirection Table
;**************************************************************************
; Still in .IVECTS section
.assume ADL=1
; The redirection table is an intermediate step in interrupt processing.
; When the interrupt occurs, the address in the corresponding entry in the
; vector table (_ez80_vectable) will execute. That will be an entry in
; this table. That entry will simply to the handler entry which has been
; related in RAM at VECSTART. The reason for this redirection is so that
; RAM-based programs and receive the interrupts vectored through the ROM-
; based loader code.
_ez80_redirect:
jp VECSTART + 0*_handlersize
_redirsize EQU $-_ez80_redirect
jp VECSTART + 1*_handlersize
jp VECSTART + 2*_handlersize
jp VECSTART + 3*_handlersize
jp VECSTART + 4*_handlersize
jp VECSTART + 5*_handlersize
jp VECSTART + 6*_handlersize
jp VECSTART + 7*_handlersize
jp VECSTART + 8*_handlersize
jp VECSTART + 9*_handlersize
jp VECSTART + 10*_handlersize
jp VECSTART + 11*_handlersize
jp VECSTART + 12*_handlersize
jp VECSTART + 13*_handlersize
jp VECSTART + 14*_handlersize
jp VECSTART + 15*_handlersize
jp VECSTART + 16*_handlersize
jp VECSTART + 17*_handlersize
jp VECSTART + 18*_handlersize
jp VECSTART + 19*_handlersize
jp VECSTART + 20*_handlersize
jp VECSTART + 21*_handlersize
jp VECSTART + 22*_handlersize
jp VECSTART + 23*_handlersize
jp VECSTART + 24*_handlersize
jp VECSTART + 25*_handlersize
jp VECSTART + 26*_handlersize
jp VECSTART + 27*_handlersize
jp VECSTART + 28*_handlersize
jp VECSTART + 29*_handlersize
jp VECSTART + 30*_handlersize
jp VECSTART + 31*_handlersize
jp VECSTART + 32*_handlersize
jp VECSTART + 33*_handlersize
jp VECSTART + 34*_handlersize
jp VECSTART + 35*_handlersize
jp VECSTART + 36*_handlersize
jp VECSTART + 37*_handlersize
jp VECSTART + 38*_handlersize
jp VECSTART + 39*_handlersize
jp VECSTART + 40*_handlersize
jp VECSTART + 41*_handlersize
jp VECSTART + 42*_handlersize
jp VECSTART + 43*_handlersize
jp VECSTART + 44*_handlersize
jp VECSTART + 45*_handlersize
jp VECSTART + 46*_handlersize
jp VECSTART + 47*_handlersize
jp VECSTART + 48*_handlersize
jp VECSTART + 49*_handlersize
jp VECSTART + 50*_handlersize
jp VECSTART + 51*_handlersize
jp VECSTART + 52*_handlersize
jp VECSTART + 53*_handlersize
jp VECSTART + 54*_handlersize
jp VECSTART + 55*_handlersize
jp VECSTART + 56*_handlersize
jp VECSTART + 57*_handlersize
jp VECSTART + 58*_handlersize
jp VECSTART + 59*_handlersize
jp VECSTART + 60*_handlersize
jp VECSTART + 61*_handlersize
jp VECSTART + 62*_handlersize
jp VECSTART + 63*_handlersize
;**************************************************************************
; Interrupt Vector Handlers
;**************************************************************************
define .STARTUP, space = ROM
segment .STARTUP
.assume ADL=1
; This is a copy of the handler table that will be copied into RAM at the
; address given by VECSTART by _ez80_initvectors. FLASH based interrupt
; handling will vector here to support interrupts in the RAM-based program.
; Symbol Val VecNo VecOffset
;----------------- --- ----- ---------
_ez80_handlers:
irqhandler EZ80_UNUSED ; 0 0x000
_handlersize EQU $-_ez80_handlers
irqhandler EZ80_UNUSED+1 ; 1 0x002
irqhandler EZ80_UNUSED+2 ; 2 0x004
irqhandler EZ80_UNUSED+3 ; 3 0x006
irqhandler 0 ; EZ80_FLASH_IRQ 0 4 0x008
irqhandler 1 ; EZ80_TIMER0_IRQ 1 5 0x00a
irqhandler 2 ; EZ80_TIMER1_IRQ 2 6 0x00c
irqhandler 3 ; EZ80_TIMER2_IRQ 3 7 0x00e
irqhandler 4 ; EZ80_TIMER3_IRQ 4 8 0x010
irqhandler 5 ; EZ80_TIMER4_IRQ 5 9 0x012
irqhandler 6 ; EZ80_TIMER5_IRQ 6 10 0x014
irqhandler 7 ; EZ80_RTC_IRQ 7 11 0x016
irqhandler 8 ; EZ80_UART0_IRQ 8 12 0x018
irqhandler 9 ; EZ80_UART1_IRQ 9 13 0x01a
irqhandler 10 ; EZ80_I2C_IRQ 10 14 0x01c
irqhandler 11 ; EZ80_SPI_IRQ 11 15 0x01e
irqhandler EZ80_UNUSED+4 ; 16 0x020
irqhandler EZ80_UNUSED+5 ; 17 0x022
irqhandler EZ80_UNUSED+6 ; 18 0x024
irqhandler EZ80_UNUSED+7 ; 19 0x026
irqhandler EZ80_UNUSED+8 ; 16 0x028
irqhandler EZ80_UNUSED+9 ; 17 0x02a
irqhandler EZ80_UNUSED+10 ; 18 0x02c
irqhandler EZ80_UNUSED+11 ; 19 0x02e
irqhandler 12 ; EZ80_PORTB0_IRQ 12 24 0x030
irqhandler 13 ; EZ80_PORTB1_IRQ 13 25 0x032
irqhandler 14 ; EZ80_PORTB2_IRQ 14 26 0x034
irqhandler 15 ; EZ80_PORTB3_IRQ 15 27 0x036
irqhandler 16 ; EZ80_PORTB4_IRQ 16 28 0x038
irqhandler 17 ; EZ80_PORTB5_IRQ 17 29 0x03a
irqhandler 18 ; EZ80_PORTB6_IRQ 18 20 0x03c
irqhandler 19 ; EZ80_PORTB7_IRQ 19 21 0x03e
irqhandler 20 ; EZ80_PORTC0_IRQ 20 22 0x040
irqhandler 21 ; EZ80_PORTC1_IRQ 21 23 0x042
irqhandler 22 ; EZ80_PORTC2_IRQ 22 24 0x044
irqhandler 23 ; EZ80_PORTC3_IRQ 23 25 0x046
irqhandler 24 ; EZ80_PORTC4_IRQ 24 26 0x048
irqhandler 25 ; EZ80_PORTC5_IRQ 25 27 0x04a
irqhandler 26 ; EZ80_PORTC6_IRQ 26 28 0x04c
irqhandler 27 ; EZ80_PORTC7_IRQ 27 29 0x04e
irqhandler 28 ; EZ80_PORTD0_IRQ 28 40 0x050
irqhandler 29 ; EZ80_PORTD1_IRQ 29 41 0x052
irqhandler 30 ; EZ80_PORTD2_IRQ 30 42 0x054
irqhandler 31 ; EZ80_PORTD3_IRQ 31 43 0x056
irqhandler 32 ; EZ80_PORTD4_IRQ 32 44 0x058
irqhandler 33 ; EZ80_PORTD5_IRQ 33 45 0x05a
irqhandler 34 ; EZ80_PORTD6_IRQ 34 46 0x05c
irqhandler 35 ; EZ80_PORTD7_IRQ 35 47 0x05e
irqhandler EZ80_UNUSED+12 ; 48 0x060
irqhandler EZ80_UNUSED+13 ; 49 0x062
irqhandler EZ80_UNUSED+14 ; 50 0x064
irqhandler EZ80_UNUSED+15 ; 51 0x066
irqhandler EZ80_UNUSED+16 ; 52 0x068
irqhandler EZ80_UNUSED+17 ; 53 0x06a
irqhandler EZ80_UNUSED+18 ; 54 0x06c
irqhandler EZ80_UNUSED+19 ; 55 0x06e
irqhandler EZ80_UNUSED+20 ; 56 0x070
irqhandler EZ80_UNUSED+21 ; 57 0x072
irqhandler EZ80_UNUSED+22 ; 58 0x074
irqhandler EZ80_UNUSED+23 ; 59 0x076
irqhandler EZ80_UNUSED+24 ; 60 0x078
irqhandler EZ80_UNUSED+25 ; 61 0x07a
irqhandler EZ80_UNUSED+26 ; 62 0x07c
irqhandler EZ80_UNUSED+27 ; 63 0x07e
_copysize EQU $-_ez80_handlers
;**************************************************************************
; Vector Setup Logic
;**************************************************************************
; Still in the .STARTUP segment.
_ez80_initvectors:
; The interrupt vector and redirection tables reside in FLASH, but the
; handlers must be copied to into the VECSTART region in RAM. This
; is necessary to support interrupt hand-off from FLASH-based interrupt
; vectors to RAM-based programs.
; Copy the initialized data section
ld bc, _copysize ; [bc] = data length
ld hl, _ez80_handlers ; [hl] = data source
ld de, VECSTART ; [de] = data destination
ldir ; Copy the interrupt handlers
; Select interrupt mode 2
im 2 ; Interrupt mode 2
; Write the address of the vector table into the interrupt vector base
ld a, _ez80_vectable >> 8 & 0ffh
ld i, a
ret
end
|
src/hott/equivalence/biinvertible.agda | pcapriotti/agda-base | 20 | 1030 | <filename>src/hott/equivalence/biinvertible.agda
{-# OPTIONS --without-K #-}
module hott.equivalence.biinvertible where
open import sum
open import equality
open import function.core
open import function.isomorphism.core
open import function.isomorphism.utils
open import function.overloading
open import function.extensionality
open import hott.level.core
open import hott.level.closure
open import hott.equivalence.core
open import hott.equivalence.alternative
open import sets.unit
module _ {i j}{X : Set i}{Y : Set j} where
InvL : (X → Y) → Set _
InvL f = Σ (Y → X) λ g → (x : X) → g (f x) ≡ x
InvR : (X → Y) → Set _
InvR f = Σ (Y → X) λ g → (y : Y) → f (g y) ≡ y
BiInv : (X → Y) → Set _
BiInv f = InvL f × InvR f
_≈₂_ : ∀ {i j} → Set i → Set j → Set _
X ≈₂ Y = Σ (X → Y) BiInv
module _ {i j}{X : Set i}{Y : Set j} where
≅⇒b : X ≅ Y → X ≈₂ Y
≅⇒b f = apply f , (invert f , _≅_.iso₁ f) , (invert f , _≅_.iso₂ f)
b⇒≅ : X ≈₂ Y → X ≅ Y
b⇒≅ (f , (g , α) , (h , β)) = record
{ to = f
; from = g
; iso₁ = α
; iso₂ = λ y → sym (ap (f ∘' g) (β y)) · ap f (α (h y)) · β y }
module _ (isom : X ≅ Y) where
private
f : X → Y
f = apply isom
φ : ∀ {k} (Z : Set k) → (X → Z) ≅ (Y → Z)
φ Z = record
{ to = λ u → u ∘ invert isom
; from = λ v → v ∘ f
; iso₁ = λ u → funext λ x → ap u (_≅_.iso₁ isom x)
; iso₂ = λ v → funext λ y → ap v (_≅_.iso₂ isom y) }
invl-level : contr (InvL f)
invl-level = iso-level (Σ-ap-iso refl≅ λ g → sym≅ strong-funext-iso)
(proj₂ (≅⇒≈ (sym≅ (φ X))) id)
private
ψ : ∀ {k} (Z : Set k) → (Z → X) ≅ (Z → Y)
ψ Z = record
{ to = λ u → f ∘ u
; from = λ v → invert isom ∘ v
; iso₁ = λ u → funext λ x → _≅_.iso₁ isom (u x)
; iso₂ = λ v → funext λ y → _≅_.iso₂ isom (v y) }
invr-level : contr (InvR f)
invr-level = iso-level (Σ-ap-iso refl≅ λ h → sym≅ strong-funext-iso)
(proj₂ (≅⇒≈ (ψ Y)) id)
BiInv-level : (f : X → Y) → h 1 (BiInv f)
BiInv-level f b₁ b₂ = h↑ (×-contr (invl-level isom) (invr-level isom)) b₁ b₂
where
isom : X ≅ Y
isom = b⇒≅ (f , b₁)
b⇔≈ : (X ≈₂ Y) ≅ (X ≈ Y)
b⇔≈ = record
{ to = λ b → ≅⇒≈ (b⇒≅ b)
; from = λ φ → (≅⇒b (≈⇒≅ φ))
; iso₁ = λ { (f , b) → ap (λ b → f , b) (h1⇒prop (BiInv-level f) _ _) }
; iso₂ = λ { (f , e) → ap (λ e → f , e) (h1⇒prop (weak-equiv-h1 f) _ _) } }
|
oeis/229/A229144.asm | neoneye/loda-programs | 11 | 170706 | ; A229144: Partial sums of (Fibonacci numbers mod 3).
; 0,1,2,4,4,6,8,9,9,10,11,13,13,15,17,18,18,19,20,22,22,24,26,27,27,28,29,31,31,33,35,36,36,37,38,40,40,42,44,45,45,46,47,49,49,51,53,54,54,55,56,58,58,60,62,63,63,64,65,67,67,69,71,72,72,73,74,76,76,78,80,81,81,82,83,85,85,87,89
mov $3,$0
mov $4,$0
lpb $3
mov $0,$4
mov $1,0
mov $2,0
sub $3,1
sub $0,$3
add $1,$0
add $1,2
add $2,$0
mov $0,8
lpb $0
div $0,4
add $2,$1
div $2,2
gcd $2,4
lpe
div $2,2
add $5,$2
lpe
mov $0,$5
|
embedded_programming/002.Blink.asm/hello.ftdi.44.blink.asm | aescariom/fabacademy2015 | 0 | 242909 | <gh_stars>0
;
; hello.ftdi.blink.44.asm
;
; Led + button -
; <NAME> - FabAcademy 2015
.include "tn44def.inc"
.equ led_pin = PA7; led pin is PA7
.equ button_pin = PA3;
.equ led_port = PORTA; comm port
.equ led_dir = DDRA; comm direction
; program is in lower part of memory
.cseg ; code segment init
.org 0 ; sets the location counter to an absolute value
rjmp reset
;
; main program
;
reset:
; set pin to output
sbi led_dir, led_pin
;
; start main loop
;
loop:
sbic PINA, button_pin
cbi led_port, led_pin ; set led pin
SBIS PINA, button_pin
sbi led_port, led_pin
rjmp loop |
Task/Same-Fringe/Ada/same-fringe-2.ada | LaudateCorpus1/RosettaCodeData | 1 | 13615 | with Ada.Unchecked_Deallocation;
package body Bin_Trees is
function Empty(Tree: Tree_Type) return Boolean is
begin
return Tree = null;
end Empty;
function Empty return Tree_Type is
begin
return null;
end Empty;
function Left (Tree: Tree_Type) return Tree_Type is
begin
return Tree.Left;
end Left;
function Right(Tree: Tree_Type) return Tree_Type is
begin
return Tree.Right;
end Right;
function Item (Tree: Tree_Type) return Data is
begin
return Tree.Item;
end Item;
procedure Destroy_Tree(N: in out Tree_Type) is
procedure free is new Ada.Unchecked_Deallocation(Node, Tree_Type);
begin
if not Empty(N) then
Destroy_Tree(N.Left);
Destroy_Tree(N.Right);
Free(N);
end if;
end Destroy_Tree;
function Tree(Value: Data; Left, Right : Tree_Type) return Tree_Type is
Temp : Tree_Type := new Node;
begin
Temp.all := (Left, Right, Value);
return Temp;
end Tree;
function Tree(Value: Data) return Tree_Type is
begin
return Tree(Value, null, null);
end Tree;
end Bin_Trees;
|
tests/lua_examples/lua_macro_arg2.asm | fengjixuchui/sjasmplus | 220 | 103473 | ; test the new way of lua `_c`/`sj.calc` function to do the define/macro_arg
; substitution before the expression is evaluated, so using macro arguments
; inside lua script should be now trivial, no more workaround through DEFINE.
; this still shows extra options of `sj.insert_label`, which are not shown in
; official documentation. I'm not sure if these will stay for v2.x, so I'm
; not adding them to docs, but you can learn about any hidden optional arguments
; in sjasm/lua_sjasm.cpp file, tracking down the particular lua stub, and checking
; how many arguments and types are parsed, and how they are used in the call
; of internal sjasm function.
; These are to stay in v1.x forever like this, unless there will be really serious
; reason to modify them. For v2.x the main goal is to mostly keep them and make
; them official, but som pruning/reorganization may happen, plus newer Lua version..
MACRO testM arg1?
LUA ALLPASS
x = _c("arg1?") -- get value of evaluated macro argument
-- if you want the macro argument without evaluation
-- check "lua_macro_arg.asm" test for DEFINE workaround
sj.insert_label("x", x, false, true) -- isUndefined=false, isDefl=true
_pc("dw arg1?, x, "..x) -- check all three sources of input value
-- _pc does it's own substitution, the label "x" should be set and lua "x"
-- test _c a bit more for handling weird things...
e1 = _c("/* ehm")
e2 = _c("define arg1? xx") -- will emit error "Label not found: define" = OK
e3 = _c("$FF&".._c("arg1?"))
_pc("db /* e1, e2, e3 */ "..e1..","..e2..","..e3)
ENDLUA
.localMacroLabel: ; check which root the macro local label gets (should be per emit)
ENDM
x = 88
BigLabel1:
testM 0x1234
.local1:
DW x ; check that symbol "x" was set by sj.insert_label
jr BigLabel1.local1 ; check "big" label was not modified by sj.insert_label
x = 77
BigLabel2:
testM 0x3456
.local2:
DW x
jr BigLabel2.local2 ; same checks as above, but second value
|
src/int_handlers/serial.asm | pwk4m1/TinyBIOS | 23 | 240235 | ; BSD 3-Clause License
;
; Copyright (c) 2020, k4m1 <<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 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 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.
;
; ======================================================================== ;
; Set ivt entry for serial interface
;
set_serial_ivt_entry:
pusha
mov eax, serial_service_int_handler
and eax, 0x0000ffff
mov bx, cs
mov di, (0x14 * 4)
call set_ivt_entry
popa
ret
; ======================================================================== ;
; Handler for serial port related services
;
serial_service_int_handler:
cli
cmp ah, 1
jl serial_service_init_device
je serial_service_putchar
cmp ah, 3
jl serial_service_getchar
je serial_service_get_status
.done:
; We get here by software interrupt by CPU, not by
; PIC generated int, so don't send EOI !
iret
; ======================================================================== ;
; Helper function to get port to use based on DX value 0 - 3 (device
; number)
;
__get_serial_by_id:
cmp dx, 1
jl .port1
je .port2
cmp dx, 3
je .port3
mov dx, 0x02e8
ret
.port1:
mov dx, 0x03f8
ret
.port2:
mov dx, 0x02f8
ret
.port3:
mov dx, 0x03e8
ret
; ======================================================================== ;
; Serial port init service (AH = 00)
; This function should only be called by serial_service_handler
;
; AH = 00
; AL = parms for initialization (see tables below)
; DX = zero based serial port number (0-1) (0-3 for AT)
;
; |7|6|5|4|3|2|1|0| AL Parity (bits 4 & 3)
; | | | | | | `------ word length bits 00 = none
; | | | | | `------- stop bits flag 01 = odd
; | | | `---------- parity bits 10 = none
; `--------------- baud rate bits 11 = even
;
; Word length (bits 1 & 0) Stop bit count (bit 2)
;
; 10 = 7 bits 0 = 1 stop bit
; 11 = 8 bits 1 = 2 stop bits
;
; Baud rate (bits 7, 6 & 5)
;
; 000 = 110 baud 100 = 1200 baud
; 001 = 150 baud 101 = 2400 baud
; 010 = 300 baud 110 = 4800 baud
; 011 = 600 baud 111 = 9600 baud (4800 on PCjr)
;
;
; on return:
; AH = port status
; AL = modem status
;
serial_service_init_device:
push cx
push bx
; first, let's get the port we want to use
call __get_serial_by_id
; next, get byte count per "packet", and setup line control
; bits according to user desires and wishes
; we set AX as our line control register, and BX as baud rate
; divisor
mov cl, al
and cl, 11100000b
and al, 00011111b ; clear baudrate bits out of al
test cl, cl
jz .baudrate_110
mov bx, 1536
.loop:
shr bx, 1 ; we want baudrate *divisor*, not baudrate.
loop .loop
.done:
; now dx = port, bx = baudrate divisor, al = line reg
call serial_init
pop bx
pop cx
jmp serial_service_int_handler.done
.baudrate_110:
mov bx, 1047
jmp .done
; ======================================================================== ;
; Serial write character (AH = 01) is used to put single character out
; of serial port.
;
; Parameters:
; AL = byte to write
; DX = Port to write to (0 - 3)
;
; Returns:
; AH bit 7 clear on success, set on error,
; bits 0 - 6 port status
;
serial_service_putchar:
; get port again
call __get_serial_by_id
; check that serial tx is empty
call serial_wait_tx_empty
jc .error
; write char to put to serial line
out dx, al
; get port status to ah
call serial_get_line_status
; return back to handler
jmp serial_service_int_handler.done
.error:
call serial_get_line_status
or ah, 10000000b
jmp serial_service_int_handler.done
; ======================================================================== ;
; Serial read character (AH = 02) is.. as the name suggests, a function
; that reads 1 byte from serial line.
;
; Parameters:
; DX = port to read from (0 - 3)
;
; Returns:
; AL = Byte read
; AH = Line status
;
serial_service_getchar:
; get port
call __get_serial_by_id
in al, dx
; exchanges so we don't overwrite what was read from serial line
xchg ah, al
call serial_get_line_status
xchg ah, al
jmp serial_service_int_handler.done
; ======================================================================== ;
; Serial get status (AH = 03)
;
; Parameters:
; DX = port to read from (0 - 3)
;
; Returns:
; AL = modem status
; AH = Line status
;
serial_service_get_status:
call __get_serial_by_id ; get port by id
call serial_get_line_status ; get line status
xchg ah, al ; ah = line status
call serial_get_modem_status ; get modem status to al
jmp serial_service_int_handler.done
|
work/ff3_calcDamage.asm | ypyp-pprn-mnmn/ff3_hack | 4 | 16538 | <gh_stars>1-10
; ff3_calcDamage.asm
;
;description:
; replaces damage calculation function
;
;version:
; 0.01 (2007-08-22)
;======================================================================================================
ff3_calcDamage_begin:
INIT_PATCH $31,$bb44,$bbe2
calcDamage:
; $1c,1d = ((($25*(1.0~1.5)*($27/2)+$28*$29)-$26)*$7c)/$2a
; [in] u16 $25,2b : attack power?
; [in] u8 $26 : defence power?
; [in] u8 $27 : attr multiplier
; [in] u8 $28 : additional damage (critical modifier)
; [in] u8 $29 : critical count(0/1)
; [in] u8 $2a : damage divider (target count)
; [in] u8 $007c : damage multiplier (hit count)
; [out] u16 $1c : final damage (0-9999)
.atkLow = $25
.atkHigh = $2b
.def = $26
.attrMultiplier = $27
.criticalBonus = $28
.criticalMultiplier = $29
.damageDivider = $2a
.damageMultiplier = $7c
.pActor = $6e
.pTarget = $70
lda <.atkHigh
lsr a
lda <.atkLow
ror a
jsr b31_getBattleRandom
clc
adc <.atkLow
sta <$18
lda <.atkHigh
adc #0
sta <$19
lda <.attrMultiplier
lsr a
bne .multiply_atk
;
lda <$19
lsr a
pha ;sta <$1d
lda <$18
ror a
pha ;sta <$1c
jmp .apply_critical
.multiply_atk:
sta <$1a
lda #0
sta <$1b
jsr mul_16x16
lda <$1d
pha
lda <$1c
pha
.apply_critical: ;$bb75:
lda <.criticalMultiplier
ldx <.criticalBonus
jsr mul_8x8 ;fcd6
clc
pla
adc <$1a
sta <$18
pla
adc <$1b
sta <$19
jsr b31_getActor2C ;a2b5
ldx #0
ora [.pTarget],y
bpl .player_to_player
sec
lda <$18
sbc <$26
sta <$18
bcs .atk_positive
dec <$19
bpl .atk_positive
stx <$19
stx <$18
.atk_positive:
.player_to_player:
;here a = 0
stx <$1b
lda <.damageMultiplier
sta <$1a
jsr mul_16x16
lda <$1c
sta <$18
lda <$1d
sta <$19
lda <.damageDivider
sta <$1a
lda #0
sta <$1b
jsr div_16
.ifdef CHARGE_BREAK_DAMAGE_LIMIT
ldy #BP_OFFSET_ATTACK_MULTIPLIER
lda [.pActor],y
bne .finish
.endif
sec
lda <$1c
sbc #LOW(9999)
lda <$1d
sbc #HIGH(9999)
bcc .finish
INIT16 <$1c,#9999
.finish:
rts
VERIFY_PC $bbe2
;=====================================================================================================
RESTORE_PC ff3_calcDamage_begin |
xorg/server/module/x86/cpuid_x86.asm | MUzzell/xrdp | 1 | 22307 |
SECTION .text
%macro PROC 1
align 16
global %1
%1:
%endmacro
;int
;cpuid_x86(int eax_in, int ecx_in, int *eax, int *ebx, int *ecx, int *edx)
PROC cpuid_x86
; save registers
push ebx
push ecx
push edx
push edi
; cpuid
mov eax, [esp + 20]
mov ecx, [esp + 24]
cpuid
mov edi, [esp + 28]
mov [edi], eax
mov edi, [esp + 32]
mov [edi], ebx
mov edi, [esp + 36]
mov [edi], ecx
mov edi, [esp + 40]
mov [edi], edx
mov eax, 0
; restore registers
pop edi
pop edx
pop ecx
pop ebx
ret;
align 16
|
coverage/IN_CTS/0553-COVERAGE-ssa-updater-impl-h-439/work/variant/2_spirv_opt_asm/shader.frag.asm | asuonpaa/ShaderTests | 0 | 160232 | <gh_stars>0
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 10
; Bound: 247
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %4 "main" %35 %71
OpExecutionMode %4 OriginUpperLeft
OpSource ESSL 320
OpName %4 "main"
OpName %10 "func(f1;"
OpName %9 "x"
OpName %14 "_GLF_global_loop_count"
OpName %16 "f"
OpName %20 "buf1"
OpMemberName %20 0 "_GLF_uniform_float_values"
OpName %22 ""
OpName %35 "gl_FragCoord"
OpName %71 "_GLF_color"
OpName %97 "buf0"
OpMemberName %97 0 "_GLF_uniform_int_values"
OpName %99 ""
OpName %114 "v0"
OpName %133 "v1"
OpName %137 "param"
OpDecorate %19 ArrayStride 16
OpMemberDecorate %20 0 Offset 0
OpDecorate %20 Block
OpDecorate %22 DescriptorSet 0
OpDecorate %22 Binding 1
OpDecorate %35 BuiltIn FragCoord
OpDecorate %71 Location 0
OpDecorate %96 ArrayStride 16
OpMemberDecorate %97 0 Offset 0
OpDecorate %97 Block
OpDecorate %99 DescriptorSet 0
OpDecorate %99 Binding 0
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeFloat 32
%7 = OpTypePointer Function %6
%8 = OpTypeFunction %6 %7
%12 = OpTypeInt 32 1
%13 = OpTypePointer Private %12
%14 = OpVariable %13 Private
%15 = OpConstant %12 0
%17 = OpTypeInt 32 0
%18 = OpConstant %17 3
%19 = OpTypeArray %6 %18
%20 = OpTypeStruct %19
%21 = OpTypePointer Uniform %20
%22 = OpVariable %21 Uniform
%23 = OpTypePointer Uniform %6
%28 = OpConstant %6 1
%29 = OpTypeBool
%33 = OpTypeVector %6 4
%34 = OpTypePointer Input %33
%35 = OpVariable %34 Input
%36 = OpConstant %17 0
%37 = OpTypePointer Input %6
%40 = OpConstant %12 2
%55 = OpConstant %12 10
%58 = OpConstant %12 1
%66 = OpConstant %6 0
%70 = OpTypePointer Output %33
%71 = OpVariable %70 Output
%95 = OpConstant %17 1
%96 = OpTypeArray %12 %95
%97 = OpTypeStruct %96
%98 = OpTypePointer Uniform %97
%99 = OpVariable %98 Uniform
%100 = OpTypePointer Uniform %12
%113 = OpTypePointer Function %33
%166 = OpConstantFalse %29
%167 = OpTypePointer Function %29
%169 = OpConstantTrue %29
%192 = OpUndef %6
%4 = OpFunction %2 None %3
%5 = OpLabel
%194 = OpVariable %167 Function %166
%195 = OpVariable %7 Function
%196 = OpVariable %7 Function
%197 = OpVariable %7 Function
%114 = OpVariable %113 Function
%133 = OpVariable %113 Function
%137 = OpVariable %7 Function
OpSelectionMerge %164 None
OpSwitch %36 %165
%165 = OpLabel
OpStore %14 %15
%101 = OpAccessChain %100 %99 %15 %15
%102 = OpLoad %12 %101
%103 = OpConvertSToF %6 %102
%104 = OpCompositeConstruct %33 %103 %103 %103 %103
OpStore %71 %104
%105 = OpAccessChain %37 %35 %36
%106 = OpLoad %6 %105
%107 = OpAccessChain %23 %22 %15 %58
%108 = OpLoad %6 %107
%109 = OpFOrdLessThan %29 %106 %108
OpSelectionMerge %111 None
OpBranchConditional %109 %110 %111
%110 = OpLabel
OpBranch %164
%111 = OpLabel
%115 = OpLoad %33 %71
OpStore %114 %115
%118 = OpFOrdGreaterThanEqual %29 %106 %66
OpSelectionMerge %120 None
OpBranchConditional %118 %119 %120
%119 = OpLabel
%121 = OpAccessChain %23 %22 %15 %15
%122 = OpLoad %6 %121
%123 = OpCompositeConstruct %33 %122 %122 %122 %122
OpStore %71 %123
OpBranch %120
%120 = OpLabel
OpStore %71 %115
%125 = OpAccessChain %37 %35 %95
%126 = OpLoad %6 %125
%129 = OpFOrdLessThan %29 %126 %108
OpSelectionMerge %131 None
OpBranchConditional %129 %130 %131
%130 = OpLabel
OpBranch %164
%131 = OpLabel
%134 = OpAccessChain %23 %22 %15 %40
%135 = OpLoad %6 %134
%136 = OpCompositeConstruct %33 %135 %135 %135 %135
OpStore %133 %136
OpStore %137 %126
OpStore %194 %166
OpSelectionMerge %245 None
OpSwitch %36 %199
%199 = OpLabel
%200 = OpAccessChain %23 %22 %15 %15
%201 = OpLoad %6 %200
OpStore %196 %201
%202 = OpFOrdLessThan %29 %201 %28
OpSelectionMerge %211 None
OpBranchConditional %202 %203 %211
%203 = OpLabel
%204 = OpAccessChain %37 %35 %36
%205 = OpLoad %6 %204
%206 = OpAccessChain %23 %22 %15 %40
%207 = OpLoad %6 %206
%208 = OpFOrdLessThan %29 %205 %207
OpSelectionMerge %210 None
OpBranchConditional %208 %209 %210
%209 = OpLabel
OpStore %194 %169
OpStore %195 %201
OpBranch %245
%210 = OpLabel
OpBranch %211
%211 = OpLabel
OpBranch %212
%212 = OpLabel
%213 = OpPhi %6 %201 %211 %219 %232
%214 = OpLoad %12 %14
%215 = OpSLessThan %29 %214 %55
OpLoopMerge %233 %232 None
OpBranchConditional %215 %216 %233
%216 = OpLabel
%217 = OpLoad %12 %14
%218 = OpIAdd %12 %217 %58
OpStore %14 %218
%219 = OpFAdd %6 %213 %201
OpStore %196 %219
%220 = OpAccessChain %37 %35 %36
%221 = OpLoad %6 %220
%222 = OpFOrdGreaterThanEqual %29 %221 %66
OpSelectionMerge %225 None
OpBranchConditional %222 %223 %225
%223 = OpLabel
%224 = OpCompositeConstruct %33 %201 %201 %201 %201
OpStore %71 %224
OpBranch %225
%225 = OpLabel
%227 = OpAccessChain %23 %22 %15 %40
%228 = OpLoad %6 %227
%229 = OpFOrdLessThan %29 %126 %228
OpSelectionMerge %231 None
OpBranchConditional %229 %230 %231
%230 = OpLabel
OpStore %194 %169
OpStore %195 %219
OpBranch %233
%231 = OpLabel
OpBranch %232
%232 = OpLabel
OpBranch %212
%233 = OpLabel
%234 = OpPhi %6 %192 %212 %219 %230
%235 = OpPhi %6 %213 %212 %219 %230
%236 = OpPhi %29 %166 %212 %169 %230
OpSelectionMerge %237 None
OpBranchConditional %236 %245 %237
%237 = OpLabel
OpBranch %238
%238 = OpLabel
%239 = OpLoad %12 %14
%240 = OpSLessThan %29 %239 %55
OpLoopMerge %244 %241 None
OpBranchConditional %240 %241 %244
%241 = OpLabel
%242 = OpLoad %12 %14
%243 = OpIAdd %12 %242 %58
OpStore %14 %243
OpBranch %238
%244 = OpLabel
OpStore %194 %169
OpStore %195 %235
OpBranch %245
%245 = OpLabel
%246 = OpPhi %6 %201 %209 %234 %233 %235 %244
OpStore %197 %246
%161 = OpCompositeInsert %33 %246 %136 3
%163 = OpCompositeInsert %33 %246 %161 0
OpStore %133 %163
OpSelectionMerge %147 None
OpBranchConditional %118 %146 %147
%146 = OpLabel
%148 = OpAccessChain %23 %22 %15 %15
%149 = OpLoad %6 %148
%150 = OpCompositeConstruct %33 %149 %149 %149 %149
OpStore %71 %150
OpBranch %147
%147 = OpLabel
%155 = OpFOrdLessThan %29 %106 %135
OpSelectionMerge %157 None
OpBranchConditional %155 %156 %157
%156 = OpLabel
OpBranch %164
%157 = OpLabel
OpStore %71 %163
OpBranch %164
%164 = OpLabel
OpReturn
OpFunctionEnd
%10 = OpFunction %6 None %8
%9 = OpFunctionParameter %7
%11 = OpLabel
%174 = OpVariable %167 Function %166
%171 = OpVariable %7 Function
%16 = OpVariable %7 Function
OpSelectionMerge %170 None
OpSwitch %36 %173
%173 = OpLabel
%24 = OpAccessChain %23 %22 %15 %15
%25 = OpLoad %6 %24
OpStore %16 %25
%30 = OpFOrdLessThan %29 %25 %28
OpSelectionMerge %32 None
OpBranchConditional %30 %31 %32
%31 = OpLabel
%38 = OpAccessChain %37 %35 %36
%39 = OpLoad %6 %38
%41 = OpAccessChain %23 %22 %15 %40
%42 = OpLoad %6 %41
%43 = OpFOrdLessThan %29 %39 %42
OpSelectionMerge %45 None
OpBranchConditional %43 %44 %45
%44 = OpLabel
OpStore %174 %169
OpStore %171 %25
OpBranch %170
%45 = OpLabel
OpBranch %32
%32 = OpLabel
OpBranch %49
%49 = OpLabel
%179 = OpPhi %6 %25 %32 %63 %52
%54 = OpLoad %12 %14
%56 = OpSLessThan %29 %54 %55
OpLoopMerge %51 %52 None
OpBranchConditional %56 %50 %51
%50 = OpLabel
%57 = OpLoad %12 %14
%59 = OpIAdd %12 %57 %58
OpStore %14 %59
%63 = OpFAdd %6 %179 %25
OpStore %16 %63
%64 = OpAccessChain %37 %35 %36
%65 = OpLoad %6 %64
%67 = OpFOrdGreaterThanEqual %29 %65 %66
OpSelectionMerge %69 None
OpBranchConditional %67 %68 %69
%68 = OpLabel
%74 = OpCompositeConstruct %33 %25 %25 %25 %25
OpStore %71 %74
OpBranch %69
%69 = OpLabel
%75 = OpLoad %6 %9
%76 = OpAccessChain %23 %22 %15 %40
%77 = OpLoad %6 %76
%78 = OpFOrdLessThan %29 %75 %77
OpSelectionMerge %80 None
OpBranchConditional %78 %79 %80
%79 = OpLabel
OpStore %174 %169
OpStore %171 %63
OpBranch %51
%80 = OpLabel
OpBranch %52
%52 = OpLabel
OpBranch %49
%51 = OpLabel
%189 = OpPhi %6 %192 %49 %63 %79
%187 = OpPhi %6 %179 %49 %63 %79
%182 = OpPhi %29 %166 %49 %169 %79
OpSelectionMerge %175 None
OpBranchConditional %182 %170 %175
%175 = OpLabel
OpBranch %83
%83 = OpLabel
%88 = OpLoad %12 %14
%89 = OpSLessThan %29 %88 %55
OpLoopMerge %85 %84 None
OpBranchConditional %89 %84 %85
%84 = OpLabel
%90 = OpLoad %12 %14
%91 = OpIAdd %12 %90 %58
OpStore %14 %91
OpBranch %83
%85 = OpLabel
OpStore %174 %169
OpStore %171 %187
OpBranch %170
%170 = OpLabel
%188 = OpPhi %6 %25 %44 %189 %51 %187 %85
OpReturnValue %188
OpFunctionEnd
|
wof/lcs/enemy/1F.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 100801 | copyright zengfr site:http://github.com/zengfr/romhack
003BDA rts [enemy+1F]
003BE6 beq $3c4e [enemy+1F]
003C4E move.w #$4, ($28,A0) [enemy+1F]
005404 bra $48ea [enemy+1F]
005470 bne $5486 [enemy+1F]
005574 move.b #$14, ($1f,A0) [enemy+24]
00557A rts [enemy+1F]
005598 move.b #$28, ($1f,A0) [enemy+2B]
00559E eori.w #$10, ($24,A0) [enemy+1F]
0055AA bne $55c0 [enemy+1F]
011A86 move.b (A2)+, D1 [123p+ 1F, enemy+1F]
011AAE subq.b #1, ($1f,A0) [123p+ 4, enemy+ 4]
011AB2 bne $11afa [123p+ 1F, enemy+1F]
012012 move.b D0, ($1f,A0)
012016 moveq #$6, D1
01204A addi.b #$20, ($1f,A0) [123p+ 4, enemy+ 4]
012050 bne $11afa [123p+ 1F, enemy+1F]
0252B8 tst.b (-$1c43,A5) [enemy+1F]
0252E0 jmp $15bc.w [enemy+1F]
0252E8 beq $252f0 [enemy+1F]
0252EE bra $252e0 [enemy+1F]
036A62 move.b #$78, ($1f,A0) [enemy+44]
036A68 clr.w ($68,A0) [enemy+1F]
036ABE beq $36b08 [enemy+1F]
036B5C move.b #$10, ($1f,A0) [enemy+46]
036B62 bra $36b72 [enemy+1F]
036B8E bmi $36b92 [enemy+1F]
036E7A move.b #$27, ($1f,A0) [enemy+D2]
036E80 jsr $f98.w [enemy+1F]
036E9C move.b #$2, ($1f,A0) [enemy+D4]
036EA2 addq.b #2, ($c2,A0) [enemy+1F]
036EFE bpl $36f0a [enemy+1F]
036F04 move.b #$27, ($1f,A0) [enemy+D4]
036F0A jsr $4258.w [enemy+1F]
036F4A move.b #$a, ($1f,A0) [enemy+40]
036F50 clr.w ($42,A0) [enemy+1F]
036F7E bpl $36f94 [enemy+1F]
copyright zengfr site:http://github.com/zengfr/romhack
|
tests/020_LABELS_-_ALL_different_kind_of_jumps__including__near__parameter.asm | tpisto/pasm | 103 | 166695 | <filename>tests/020_LABELS_-_ALL_different_kind_of_jumps__including__near__parameter.asm<gh_stars>100-1000
; name: LABELS - ALL different kind of jumps, including "near" parameter!
; code: "70FE71FC72FA72F872F673F473F273F074EE74EC75EA75E876E676E477E277E078DE79DC7ADA7AD87BD67BD47CD27CD07DCE7DCC7ECA7EC87FC67FC4E3C2E9BFFF67E3BC70FE71FC72FA72F872F673F473F273F074EE74EC75EA75E876E676E477E277E078DE79DC7ADA7AD87BD67BD47CD27CD07DCE7DCC7ECA7EC87FC67FC467E3C1E9BCFFFFFFE3BA70FE71FC72FA72F872F673F473F273F074EE74EC75EA75E876E676E477E277E078DE79DC7ADA7AD87BD67BD47CD27CD07DCE7DCC7ECA7EC87FC67FC4E9BFFFFFFF67E3BCE3BA0F802CFF0F8128FF0F8224FF0F8220FF0F821CFF0F8318FF0F8314FF0F8310FF0F840CFF0F8408FF0F8504FF0F8500FF0F86FCFE0F86F8FE0F87F4FE0F87F0FE0F88ECFE0F89E8FE0F8AE4FE0F8AE0FE0F8BDCFE0F8BD8FE0F8CD4FE0F8CD0FE0F8DCCFE0F8DC8FE0F8EC4FE0F8EC0FE0F8FBCFE0F8FB8FEE9B5FE0F80F3FEFFFF0F81EDFEFFFF0F82E7FEFFFF0F82E1FEFFFF0F82DBFEFFFF0F83D5FEFFFF0F83CFFEFFFF0F83C9FEFFFF0F84C3FEFFFF0F84BDFEFFFF0F85B7FEFFFF0F85B1FEFFFF0F86ABFEFFFF0F86A5FEFFFF0F879FFEFFFF0F8799FEFFFF0F8893FEFFFF0F898DFEFFFF0F8A87FEFFFF0F8A81FEFFFF0F8B7BFEFFFF0F8B75FEFFFF0F8C6FFEFFFF0F8C69FEFFFF0F8D63FEFFFF0F8D5DFEFFFF0F8E57FEFFFF0F8E51FEFFFF0F8F4BFEFFFF0F8F45FEFFFFE940FEFFFF0F8080FEFFFF0F817AFEFFFF0F8274FEFFFF0F826EFEFFFF0F8268FEFFFF0F8362FEFFFF0F835CFEFFFF0F8356FEFFFF0F8450FEFFFF0F844AFEFFFF0F8544FEFFFF0F853EFEFFFF0F8638FEFFFF0F8632FEFFFF0F872CFEFFFF0F8726FEFFFF0F8820FEFFFF0F891AFEFFFF0F8A14FEFFFF0F8A0EFEFFFF0F8B08FEFFFF0F8B02FEFFFF0F8CFCFDFFFF0F8CF6FDFFFF0F8DF0FDFFFF0F8DEAFDFFFF0F8EE4FDFFFF0F8EDEFDFFFF0F8FD8FDFFFF0F8FD2FDFFFFE9CDFDFFFF70427140723E723C723A73387336733474327430752E752C762A762877267724782279207A1E7A1C7B1A7B187C167C147D127D107E0E7E0C7F0A7F08E306E9030067E300704471427240723E723C733A73387336743474327530752E762C762A77287726782479227A207A1E7B1C7B1A7C187C167D147D127E107E0E7F0C7F0A67E307E902000000E300704471427240723E723C733A73387336743474327530752E762C762A77287726782479227A207A1E7B1C7B1A7C187C167D147D127E107E0E7F0C7F0AE90500000067E302E3000F80E9010F81E5010F82E1010F82DD010F82D9010F83D5010F83D1010F83CD010F84C9010F84C5010F85C1010F85BD010F86B9010F86B5010F87B1010F87AD010F88A9010F89A5010F8AA1010F8A9D010F8B99010F8B95010F8C91010F8C8D010F8D89010F8D85010F8E81010F8E7D010F8F79010F8F7501E972010F806C0100000F81660100000F82600100000F825A0100000F82540100000F834E0100000F83480100000F83420100000F843C0100000F84360100000F85300100000F852A0100000F86240100000F861E0100000F87180100000F87120100000F880C0100000F89060100000F8A000100000F8AFA0000000F8BF40000000F8BEE0000000F8CE80000000F8CE20000000F8DDC0000000F8DD60000000F8ED00000000F8ECA0000000F8FC40000000F8FBE000000E9B90000000F80B30000000F81AD0000000F82A70000000F82A10000000F829B0000000F83950000000F838F0000000F83890000000F84830000000F847D0000000F85770000000F85710000000F866B0000000F86650000000F875F0000000F87590000000F88530000000F894D0000000F8A470000000F8A410000000F8B3B0000000F8B350000000F8C2F0000000F8C290000000F8D230000000F8D1D0000000F8E170000000F8E110000000F8F0B0000000F8F05000000E90000000090"
; JUMP BACK
[bits 16]
tommi1:
jo tommi1
jno tommi1
jb tommi1
jnae tommi1
jc tommi1
jnb tommi1
jae tommi1
jnc tommi1
jz tommi1
je tommi1
jnz tommi1
jne tommi1
jbe tommi1
jna tommi1
jnbe tommi1
ja tommi1
js tommi1
jns tommi1
jp tommi1
jpe tommi1
jnp tommi1
jpo tommi1
jl tommi1
jnge tommi1
jnl tommi1
jge tommi1
jle tommi1
jng tommi1
jnle tommi1
jg tommi1
jcxz tommi1
jmp tommi1
jecxz tommi1
[bits 32]
tommi2:
jo tommi2
jno tommi2
jb tommi2
jnae tommi2
jc tommi2
jnb tommi2
jae tommi2
jnc tommi2
jz tommi2
je tommi2
jnz tommi2
jne tommi2
jbe tommi2
jna tommi2
jnbe tommi2
ja tommi2
js tommi2
jns tommi2
jp tommi2
jpe tommi2
jnp tommi2
jpo tommi2
jl tommi2
jnge tommi2
jnl tommi2
jge tommi2
jle tommi2
jng tommi2
jnle tommi2
jg tommi2
jcxz tommi2
jmp tommi2
jecxz tommi2
[bits 64]
tommi3:
jo tommi3
jno tommi3
jb tommi3
jnae tommi3
jc tommi3
jnb tommi3
jae tommi3
jnc tommi3
jz tommi3
je tommi3
jnz tommi3
jne tommi3
jbe tommi3
jna tommi3
jnbe tommi3
ja tommi3
js tommi3
jns tommi3
jp tommi3
jpe tommi3
jnp tommi3
jpo tommi3
jl tommi3
jnge tommi3
jnl tommi3
jge tommi3
jle tommi3
jng tommi3
jnle tommi3
jg tommi3
jmp tommi3
jecxz tommi3
jrcxz tommi3
; Near jumps
[bits 16]
jo near tommi1
jno near tommi1
jb near tommi1
jnae near tommi1
jc near tommi1
jnb near tommi1
jae near tommi1
jnc near tommi1
jz near tommi1
je near tommi1
jnz near tommi1
jne near tommi1
jbe near tommi1
jna near tommi1
jnbe near tommi1
ja near tommi1
js near tommi1
jns near tommi1
jp near tommi1
jpe near tommi1
jnp near tommi1
jpo near tommi1
jl near tommi1
jnge near tommi1
jnl near tommi1
jge near tommi1
jle near tommi1
jng near tommi1
jnle near tommi1
jg near tommi1
jmp near tommi1
[bits 32]
jo near tommi2
jno near tommi2
jb near tommi2
jnae near tommi2
jc near tommi2
jnb near tommi2
jae near tommi2
jnc near tommi2
jz near tommi2
je near tommi2
jnz near tommi2
jne near tommi2
jbe near tommi2
jna near tommi2
jnbe near tommi2
ja near tommi2
js near tommi2
jns near tommi2
jp near tommi2
jpe near tommi2
jnp near tommi2
jpo near tommi2
jl near tommi2
jnge near tommi2
jnl near tommi2
jge near tommi2
jle near tommi2
jng near tommi2
jnle near tommi2
jg near tommi2
jmp near tommi2
[bits 64]
jo near tommi3
jno near tommi3
jb near tommi3
jnae near tommi3
jc near tommi3
jnb near tommi3
jae near tommi3
jnc near tommi3
jz near tommi3
je near tommi3
jnz near tommi3
jne near tommi3
jbe near tommi3
jna near tommi3
jnbe near tommi3
ja near tommi3
js near tommi3
jns near tommi3
jp near tommi3
jpe near tommi3
jnp near tommi3
jpo near tommi3
jl near tommi3
jnge near tommi3
jnl near tommi3
jge near tommi3
jle near tommi3
jng near tommi3
jnle near tommi3
jg near tommi3
jmp near tommi3
; JUMP FORWARD
[bits 16]
jo tommi4
jno tommi4
jb tommi4
jnae tommi4
jc tommi4
jnb tommi4
jae tommi4
jnc tommi4
jz tommi4
je tommi4
jnz tommi4
jne tommi4
jbe tommi4
jna tommi4
jnbe tommi4
ja tommi4
js tommi4
jns tommi4
jp tommi4
jpe tommi4
jnp tommi4
jpo tommi4
jl tommi4
jnge tommi4
jnl tommi4
jge tommi4
jle tommi4
jng tommi4
jnle tommi4
jg tommi4
jcxz tommi4
jmp tommi4
jecxz tommi4
tommi4:
[bits 32]
jo tommi5
jno tommi5
jb tommi5
jnae tommi5
jc tommi5
jnb tommi5
jae tommi5
jnc tommi5
jz tommi5
je tommi5
jnz tommi5
jne tommi5
jbe tommi5
jna tommi5
jnbe tommi5
ja tommi5
js tommi5
jns tommi5
jp tommi5
jpe tommi5
jnp tommi5
jpo tommi5
jl tommi5
jnge tommi5
jnl tommi5
jge tommi5
jle tommi5
jng tommi5
jnle tommi5
jg tommi5
jcxz tommi5
jmp tommi5
jecxz tommi5
tommi5:
[bits 64]
jo tommi6
jno tommi6
jb tommi6
jnae tommi6
jc tommi6
jnb tommi6
jae tommi6
jnc tommi6
jz tommi6
je tommi6
jnz tommi6
jne tommi6
jbe tommi6
jna tommi6
jnbe tommi6
ja tommi6
js tommi6
jns tommi6
jp tommi6
jpe tommi6
jnp tommi6
jpo tommi6
jl tommi6
jnge tommi6
jnl tommi6
jge tommi6
jle tommi6
jng tommi6
jnle tommi6
jg tommi6
jmp tommi6
jecxz tommi6
jrcxz tommi6
tommi6:
; Near jumps
[bits 16]
jo near tommi7
jno near tommi7
jb near tommi7
jnae near tommi7
jc near tommi7
jnb near tommi7
jae near tommi7
jnc near tommi7
jz near tommi7
je near tommi7
jnz near tommi7
jne near tommi7
jbe near tommi7
jna near tommi7
jnbe near tommi7
ja near tommi7
js near tommi7
jns near tommi7
jp near tommi7
jpe near tommi7
jnp near tommi7
jpo near tommi7
jl near tommi7
jnge near tommi7
jnl near tommi7
jge near tommi7
jle near tommi7
jng near tommi7
jnle near tommi7
jg near tommi7
jmp near tommi7
[bits 32]
jo near tommi7
jno near tommi7
jb near tommi7
jnae near tommi7
jc near tommi7
jnb near tommi7
jae near tommi7
jnc near tommi7
jz near tommi7
je near tommi7
jnz near tommi7
jne near tommi7
jbe near tommi7
jna near tommi7
jnbe near tommi7
ja near tommi7
js near tommi7
jns near tommi7
jp near tommi7
jpe near tommi7
jnp near tommi7
jpo near tommi7
jl near tommi7
jnge near tommi7
jnl near tommi7
jge near tommi7
jle near tommi7
jng near tommi7
jnle near tommi7
jg near tommi7
jmp near tommi7
[bits 64]
jo near tommi7
jno near tommi7
jb near tommi7
jnae near tommi7
jc near tommi7
jnb near tommi7
jae near tommi7
jnc near tommi7
jz near tommi7
je near tommi7
jnz near tommi7
jne near tommi7
jbe near tommi7
jna near tommi7
jnbe near tommi7
ja near tommi7
js near tommi7
jns near tommi7
jp near tommi7
jpe near tommi7
jnp near tommi7
jpo near tommi7
jl near tommi7
jnge near tommi7
jnl near tommi7
jge near tommi7
jle near tommi7
jng near tommi7
jnle near tommi7
jg near tommi7
jmp near tommi7
tommi7:
nop
|
test/Succeed/DotSubTermination.agda | shlevy/agda | 1,989 | 681 | -- Andreas, 2014-11-08
-- This used to be a failed test case, but works now.
open import Common.Prelude
postulate
some : Nat
data D : Nat → Set where
d₀ : D some
d₁ : D (suc some)
f : (n : Nat) → D n → Nat
f .some d₀ = zero
f .(suc some) d₁ = f some d₀
-- Since x < suc x for all x in the structural order,
-- some < suc some is a valid descent.
|
3-mid/opengl/source/platform/osmesa/private/thin/swig.ads | charlie5/lace | 20 | 21249 | <reponame>charlie5/lace<gh_stars>10-100
with
interfaces.C,
System;
package Swig
--
-- Contains Swig related C type definitions not found in the 'interfaces.C' family.
--
is
pragma Pure;
-- Elementary types.
--
subtype void is System.Address;
subtype void_ptr is System.Address;
subtype opaque_structure is System.Address;
subtype incomplete_class is System.Address;
subtype long_Long is long_long_Integer;
type unsigned_long_Long is mod 2 ** 64;
type intptr_t is range -(2 ** (Standard'Address_Size - Integer'(1))) .. +(2 ** (Standard'Address_Size - Integer'(1)) - 1);
type uintptr_t is mod 2 ** Standard'Address_Size;
subtype int8_t is interfaces.Integer_8;
subtype int16_t is interfaces.Integer_16;
subtype int32_t is interfaces.Integer_32;
subtype int64_t is interfaces.Integer_64;
subtype uint8_t is interfaces.unSigned_8;
subtype uint16_t is interfaces.unSigned_16;
subtype uint32_t is interfaces.unSigned_32;
subtype uint64_t is interfaces.unSigned_64;
subtype bool is interfaces.c.plain_char;
-- Elementary Arrays
--
type void_ptr_Array is array (interfaces.c.size_t range <>) of aliased swig.void_ptr;
type size_t_Array is array (interfaces.c.size_t range <>) of aliased interfaces.c.Size_t;
type bool_Array is array (interfaces.c.size_t range <>) of aliased swig.bool;
type signed_char_Array is array (interfaces.c.size_t range <>) of aliased interfaces.c.signed_Char;
type unsigned_char_Array is array (interfaces.c.size_t range <>) of aliased interfaces.c.unsigned_Char;
type short_Array is array (interfaces.c.size_t range <>) of aliased interfaces.c.Short;
type int_Array is array (interfaces.c.size_t range <>) of aliased interfaces.c.Int;
type long_Array is array (interfaces.c.size_t range <>) of aliased interfaces.c.Long;
type long_long_Array is array (interfaces.c.size_t range <>) of aliased swig.long_Long;
type unsigned_short_Array is array (interfaces.c.size_t range <>) of aliased interfaces.c.unsigned_Short;
type unsigned_Array is array (interfaces.c.size_t range <>) of aliased interfaces.c.Unsigned;
type unsigned_long_Array is array (interfaces.c.size_t range <>) of aliased interfaces.c.unsigned_Long;
type unsigned_long_long_Array is array (interfaces.c.size_t range <>) of aliased swig.unsigned_long_Long;
type int8_t_Array is array (interfaces.c.size_t range <>) of aliased swig.int8_t;
type int16_t_Array is array (interfaces.c.size_t range <>) of aliased swig.int16_t;
type int32_t_Array is array (interfaces.c.size_t range <>) of aliased swig.int32_t;
type int64_t_Array is array (interfaces.c.size_t range <>) of aliased swig.int64_t;
type uint8_t_Array is array (interfaces.c.size_t range <>) of aliased swig.uint8_t;
type uint16_t_Array is array (interfaces.c.size_t range <>) of aliased swig.uint16_t;
type uint32_t_Array is array (interfaces.c.size_t range <>) of aliased swig.uint32_t;
type uint64_t_Array is array (interfaces.c.size_t range <>) of aliased swig.uint64_t;
type float_Array is array (interfaces.c.size_t range <>) of aliased interfaces.c.c_Float;
type double_Array is array (interfaces.c.size_t range <>) of aliased interfaces.c.Double;
type long_double_Array is array (interfaces.c.size_t range <>) of aliased interfaces.c.long_Double;
end Swig;
|
source/shell-commands-safe.ads | charlie5/aShell | 11 | 20821 | <filename>source/shell-commands-safe.ads
package Shell.Commands.Safe
--
-- Allows commands to be safely run in different tasks.
--
-- Requires the 'ashell_spawn_server' binary to be installed
-- in a folder on the users PATH (such as /usr/bin).
--
is
--- Run - Block until process completes.
--
procedure Run (The_Command : in out Command;
Input : in Data := No_Data;
Raise_Error : in Boolean := False);
function Run (The_Command : in out Command;
Input : in Data := No_Data;
Raise_Error : in Boolean := False) return Command_Results;
procedure Stop_Spawn_Client;
--
-- Called at program completion to halt the spawn client task and spawn server process.
end Shell.Commands.Safe;
|
Agda/Gradual Security/static.agda | kellino/TypeSystems | 2 | 5872 | <gh_stars>1-10
module static where
open import Data.Nat using (ℕ; _+_; zero; suc)
open import Data.Fin using (Fin; toℕ; zero; suc)
open import Data.Vec using (lookup; _∷_; [])
open import Data.Bool using (Bool; true; false)
open import LSsyntax
open import Relation.Binary.PropositionalEquality -- using (_≡_; refl)
-- inference rules for typed terms
data STyped {n} (Γ : Ctx n) : GType → Set where
Sx : ∀ {S} (v : Fin n) → S ≡ lookup v Γ → STyped Γ S
Sb : Bool → (ℓ : Label) → STyped Γ (bool ℓ)
_S∧_ : ∀ {t₁ t₂} → STyped Γ t₁ → STyped Γ t₂ → STyped Γ (bool (getLabel t₁ ~⋎~ getLabel t₂))
_S∨_ : ∀ {t₁ t₂} → STyped Γ t₁ → STyped Γ t₂ → STyped Γ (bool (getLabel t₁ ~⋎~ getLabel t₂))
Sif : ∀ {t t₁ t₂} → STyped Γ t → STyped Γ t₁ → STyped Γ t₂ → STyped Γ (bool (getLabel (t₁ :∨: t₂) ~⋎~ getLabel t))
S∙ : ∀ {t₁ ℓ t₂ t₃} → STyped Γ ((t₁ ⇒ ℓ) t₂) → STyped Γ t₃ → t₃ ≾ t₁ → STyped Γ (bool ((getLabel t₂) ~⋎~ ℓ))
Sλ : ∀ t₁ {t₂} ℓ → STyped (t₁ ∷ Γ) t₂ → STyped Γ ((t₁ ⇒ ℓ) t₂)
erase : ∀ {n} {Γ : Ctx n} {t} → STyped Γ t → Term
erase (Sx v x) = var (toℕ v)
erase (Sb b ℓ) = litBool b ℓ
erase (t₁ S∧ t₂) = (erase t₁) ∧ erase t₂
erase (t₁ S∨ t₂) = (erase t₁) ∨ (erase t₂)
erase (Sif b t₁ t₂) = if (erase b) then (erase t₁) else (erase t₂)
erase (S∙ t₁ t₂ _) = (erase t₁) ∙ (erase t₂)
erase (Sλ t₁ ℓ t) = lam t₁ (erase t) ℓ
data Fromℕ (n : ℕ) : ℕ → Set where
yes : (m : Fin n) → Fromℕ n (toℕ m)
no : (m : ℕ) → Fromℕ n (n + m)
fromℕ : ∀ n m → Fromℕ n m
fromℕ zero m = no m
fromℕ (suc n) zero = yes zero
fromℕ (suc n) (suc m) with fromℕ n m
fromℕ (suc n) (suc .(toℕ m)) | yes m = yes (suc m)
fromℕ (suc n) (suc .(n + m)) | no m = no m
data Check {n} (Γ : Ctx n) : Term → Set where
yes : (τ : GType) (t : STyped Γ τ) → Check Γ (erase t)
no : {e : Term} → Check Γ e
staticCheck : ∀ {n} (Γ : Ctx n) (t : Term) → Check Γ t
staticCheck {n} Γ (var v) with fromℕ n v
staticCheck {n} Γ (var .(toℕ m)) | yes m = yes (lookup m Γ) (Sx m refl)
staticCheck {n} Γ (var .(n + m)) | no m = no
staticCheck Γ (litBool x ℓ) = yes (bool ℓ) (Sb x ℓ)
staticCheck Γ (lam x t ℓ) with staticCheck (x ∷ Γ) t
staticCheck Γ (lam x .(erase t) ℓ) | yes τ t = yes ((x ⇒ ℓ) τ) (Sλ x ℓ t)
staticCheck Γ (lam x t ℓ) | no = no
staticCheck Γ (t ∧ t₁) with staticCheck Γ t | staticCheck Γ t₁
staticCheck Γ (.(erase t₁) ∧ .(erase t)) | yes τ₁ t₁ | (yes τ t) = yes (bool (getLabel τ₁ ~⋎~ getLabel τ)) (t₁ S∧ t)
staticCheck Γ (.(erase t) ∧ t₁) | yes τ t | no = no
staticCheck Γ (t₁ ∧ .(erase t)) | no | yes τ t = no
staticCheck Γ (t ∧ t₁) | no | no = no
staticCheck Γ (t ∨ t₁) with staticCheck Γ t | staticCheck Γ t₁
staticCheck Γ (.(erase t₁) ∨ .(erase t)) | yes τ₁ t₁ | (yes τ t) = yes (bool (getLabel τ₁ ~⋎~ getLabel τ)) (t₁ S∨ t)
staticCheck Γ (.(erase t) ∨ t₁) | yes τ t | no = no
staticCheck Γ (t₁ ∨ .(erase t)) | no | yes τ t = no
staticCheck Γ (t ∨ t₁) | no | no = no
staticCheck Γ (t ∙ t₁) with staticCheck Γ t | staticCheck Γ t₁
staticCheck Γ (.(erase t) ∙ .(erase t₁)) | yes ((τ ⇒ ℓ) τ₂) t | (yes τ₁ t₁) with τ₁ ≾? τ
staticCheck Γ (.(erase t) ∙ .(erase t₁)) | yes ((τ ⇒ ℓ) τ₂) t | (yes τ₁ t₁) | (yes .τ₁ .τ) = yes (bool (getLabel τ₂ ~⋎~ ℓ)) (S∙ t t₁ (yes τ₁ τ))
staticCheck Γ (.(erase t) ∙ .(erase t₁)) | yes ((τ ⇒ ℓ) τ₂) t | (yes τ₁ t₁) | (no .τ₁ .τ) = no
staticCheck Γ (.(erase t) ∙ .(erase t₁)) | yes err t | (yes τ₁ t₁) = no
staticCheck Γ (.(erase t) ∙ .(erase t₁)) | yes (bool x) t | (yes τ₁ t₁) = no
staticCheck Γ (.(erase t) ∙ t₁) | yes τ t | no = no
staticCheck Γ (t₁ ∙ .(erase t)) | no | yes τ t = no
staticCheck Γ (t ∙ t₁) | no | no = no
staticCheck Γ (if b then t₁ else t₂) with staticCheck Γ b
staticCheck Γ (if .(erase t) then t₁ else t₂) | yes τ t with staticCheck Γ t₁ | staticCheck Γ t₂
staticCheck Γ (if .(erase t₂) then .(erase t₁) else .(erase t)) | yes τ₂ t₂ | (yes τ₁ t₁) | (yes τ t) = yes (bool (getLabel (τ₁ :∨: τ) ~⋎~ getLabel τ₂)) (Sif t₂ t₁ t)
staticCheck Γ (if .(erase t₁) then .(erase t) else t₂) | yes τ₁ t₁ | (yes τ t) | no = no
staticCheck Γ (if .(erase t₂) then t₁ else .(erase t)) | yes τ₁ t₂ | no | (yes τ t) = no
staticCheck Γ (if .(erase t) then t₁ else t₂) | yes τ t | no | no = no
staticCheck Γ (if b then t₁ else t₂) | no = no
staticCheck Γ error = no
-- examples from Section 3.5
-- Type : yes ((bool ⊥ ⇒ ⊥) (bool ⊥)) (Sλ (bool ⊥) ⊥ (Sx zero refl S∧ Sx zero refl))
f : Term
f = lam (bool ⊥) (var 0 ∨ var 0) ⊥
-- Type : yes ((bool ✭ ⇒ ⊥) (bool ✭)) (Sλ (bool ✭) ⊥ (Sx zero refl S∨ Sx zero refl))
g : Term
g = lam (bool ✭) (var 0 ∧ var 0) ⊥
-- Type : yes (bool ⊤) (Sb false ⊤)
v : Term
v = litBool false ⊤
test₁ : staticCheck [] (f ∙ v) ≡ no
test₁ = refl
|
source/tasking/machine-w64-mingw32/s-syobab.adb | ytomino/drake | 33 | 14634 | with System.Tasks;
with System.Debug; -- assertions
with C.winbase;
with C.windef;
with C.winerror;
package body System.Synchronous_Objects.Abortable is
use type C.windef.DWORD;
-- queue
procedure Take (
Object : in out Queue;
Item : out Queue_Node_Access;
Params : Address;
Filter : Queue_Filter;
Aborted : out Boolean) is
begin
Aborted := Tasks.Is_Aborted;
Enter (Object.Mutex.all);
declare
Previous : Queue_Node_Access := null;
I : Queue_Node_Access := Object.Head;
begin
Taking : loop
Take_No_Sync (Object, Item, Params, Filter, Previous, I);
exit Taking when Item /= null;
-- not found
declare
Tail_On_Waiting : constant Queue_Node_Access := Object.Tail;
begin
Object.Params := Params;
Object.Filter := Filter;
loop
Object.Waiting := True;
Leave (Object.Mutex.all);
Wait (Object.Event, Aborted => Aborted);
Enter (Object.Mutex.all);
Object.Waiting := False;
exit Taking when Aborted;
exit when Object.Tail /= Tail_On_Waiting;
end loop;
if Tail_On_Waiting /= null then
Previous := Tail_On_Waiting;
I := Tail_On_Waiting.Next;
else
Previous := null;
I := Object.Head;
end if;
end;
end loop Taking;
end;
Leave (Object.Mutex.all);
end Take;
-- event
procedure Wait (
Object : in out Event;
Aborted : out Boolean)
is
Abort_Event : constant access Event := Tasks.Abort_Event;
begin
if Abort_Event /= null then
declare
Handles : aliased array (0 .. 1) of aliased C.winnt.HANDLE :=
(Object.Handle, Abort_Event.Handle);
Signaled : C.windef.DWORD;
begin
Signaled :=
C.winbase.WaitForMultipleObjects (
2,
Handles (0)'Access,
0,
C.winbase.INFINITE);
pragma Check (Debug,
Check =>
Signaled = C.winbase.WAIT_OBJECT_0
or else Signaled = C.winbase.WAIT_OBJECT_0 + 1
or else Debug.Runtime_Error (
"WaitForMultipleObjects failed"));
Aborted := Signaled = C.winbase.WAIT_OBJECT_0 + 1;
end;
else
Wait (Object);
Aborted := Tasks.Is_Aborted;
end if;
end Wait;
procedure Wait (
Object : in out Event;
Timeout : Duration;
Value : out Boolean;
Aborted : out Boolean)
is
Abort_Event : constant access Event := Tasks.Abort_Event;
begin
if Abort_Event /= null then
declare
Handles : aliased array (0 .. 1) of aliased C.winnt.HANDLE :=
(Object.Handle, Abort_Event.Handle);
Milliseconds : constant C.windef.DWORD :=
C.windef.DWORD (Timeout * 1_000);
Signaled : C.windef.DWORD;
begin
Signaled :=
C.winbase.WaitForMultipleObjects (
2,
Handles (0)'Access,
0,
Milliseconds);
pragma Check (Debug,
Check =>
Signaled = C.winbase.WAIT_OBJECT_0
or else Signaled = C.winbase.WAIT_OBJECT_0 + 1
or else Signaled = C.winerror.WAIT_TIMEOUT
or else Debug.Runtime_Error (
"WaitForMultipleObjects failed"));
Value := Signaled = C.winbase.WAIT_OBJECT_0 or else Get (Object);
Aborted := Signaled = C.winbase.WAIT_OBJECT_0 + 1;
end;
else
Wait (Object, Timeout, Value);
Aborted := Tasks.Is_Aborted;
end if;
end Wait;
end System.Synchronous_Objects.Abortable;
|
bootdict/x86/memory.asm | ikysil/ikforth | 8 | 105419 | ;******************************************************************************
;
; memory.asm
; IKForth
;
; Unlicense since 1999 by <NAME>
;
;******************************************************************************
; Memory
;******************************************************************************
; 6.1.0010 !
; Store x to the specified memory address
; D: x addr --
$CODE '!',$STORE,VEF_USUAL
POPDS EBX
POPDS EAX
MOV DWORD [EBX],EAX
$NEXT
; 6.1.0650 @
; Fetch a value from the specified address
; D: addr -- x
$CODE '@',$FETCH,VEF_USUAL
POPDS EBX
PUSHDS <DWORD [EBX]>
$NEXT
; 6.1.0310 2!
; ( x1 x2 a-addr -- )
; Store the cell pair x1 x2 at a-addr, with x2 at a-addr and x1 at the next consecutive cell.
; It is equivalent to the sequence SWAP OVER ! CELL+ !.
$CODE '2!',$TWO_STORE,VEF_USUAL
POPDS EBX
POPDS <DWORD [EBX]>
POPDS <DWORD [EBX + CELL_SIZE]>
$NEXT
; 6.1.0350 2@
; ( a-addr -- x1 x2 )
; Fetch the cell pair x1 x2 stored at a-addr. x2 is stored at a-addr and x1 at the next consecutive cell.
; It is equivalent to the sequence DUP CELL+ @ SWAP @.
$CODE '2@',$TWO_FETCH,VEF_USUAL
POPDS EBX
PUSHDS <DWORD [EBX + CELL_SIZE]>
PUSHDS <DWORD [EBX]>
$NEXT
; 6.1.0850 C!
; Store char value
; D: char addr --
$CODE 'C!',$C_STORE,VEF_USUAL
POPDS EBX
POPDS EAX
MOV BYTE [EBX],AL
$NEXT
; 6.1.0870 C@
; Fetch char value
; D: addr -- char
$CODE 'C@',$C_FETCH,VEF_USUAL
POPDS EBX
XOR EAX,EAX
MOV AL,BYTE [EBX]
PUSHDS EAX
$NEXT
; 6.1.0880 CELL+
; D: addr - addr+cellsize
$CODE 'CELL+',$CELL_PLUS,VEF_USUAL
POPDS EAX
ADD EAX,CELL_SIZE
PUSHDS EAX
$NEXT
; 6.1.0890 CELLS
; D: a - a*cellsize
$CODE 'CELLS',$CELLS,VEF_USUAL
POPDS EAX
ADD EAX,EAX
ADD EAX,EAX
PUSHDS EAX
$NEXT
; 6.1.0897 CHAR+
; D: addr - addr+charsize
$CODE 'CHAR+',$CHAR_PLUS,VEF_USUAL
POPDS EAX
INC EAX
PUSHDS EAX
$NEXT
; 6.1.0898 CHARS
; ( n1 -- n2 )
; n2 is the size in address units of n1 characters.
$CODE 'CHARS',$CHARS
$NEXT
|
programs/oeis/171/A171418.asm | jmorken/loda | 1 | 919 | ; A171418: Expansion of (1+x)^4/(1-x).
; 1,5,11,15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16
mov $4,4
lpb $0
sub $0,1
add $2,$4
add $4,1
trn $4,2
lpe
mov $1,$2
mul $1,2
mov $3,1
trn $3,$4
sub $1,$3
trn $1,4
add $1,1
|
cat.asm | chintu3536/xv6 | 0 | 99396 | <reponame>chintu3536/xv6<filename>cat.asm
_cat: file format elf32-i386
Disassembly of section .text:
00000000 <cat>:
char buf[512];
void
cat(int fd)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
int n;
while((n = read(fd, buf, sizeof(buf))) > 0)
6: eb 15 jmp 1d <cat+0x1d>
write(1, buf, n);
8: 83 ec 04 sub $0x4,%esp
b: ff 75 f4 pushl -0xc(%ebp)
e: 68 80 0b 00 00 push $0xb80
13: 6a 01 push $0x1
15: e8 6c 03 00 00 call 386 <write>
1a: 83 c4 10 add $0x10,%esp
void
cat(int fd)
{
int n;
while((n = read(fd, buf, sizeof(buf))) > 0)
1d: 83 ec 04 sub $0x4,%esp
20: 68 00 02 00 00 push $0x200
25: 68 80 0b 00 00 push $0xb80
2a: ff 75 08 pushl 0x8(%ebp)
2d: e8 4c 03 00 00 call 37e <read>
32: 83 c4 10 add $0x10,%esp
35: 89 45 f4 mov %eax,-0xc(%ebp)
38: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
3c: 7f ca jg 8 <cat+0x8>
write(1, buf, n);
if(n < 0){
3e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
42: 79 17 jns 5b <cat+0x5b>
printf(1, "cat: read error\n");
44: 83 ec 08 sub $0x8,%esp
47: 68 a3 08 00 00 push $0x8a3
4c: 6a 01 push $0x1
4e: e8 9a 04 00 00 call 4ed <printf>
53: 83 c4 10 add $0x10,%esp
exit();
56: e8 0b 03 00 00 call 366 <exit>
}
}
5b: 90 nop
5c: c9 leave
5d: c3 ret
0000005e <main>:
int
main(int argc, char *argv[])
{
5e: 8d 4c 24 04 lea 0x4(%esp),%ecx
62: 83 e4 f0 and $0xfffffff0,%esp
65: ff 71 fc pushl -0x4(%ecx)
68: 55 push %ebp
69: 89 e5 mov %esp,%ebp
6b: 53 push %ebx
6c: 51 push %ecx
6d: 83 ec 10 sub $0x10,%esp
70: 89 cb mov %ecx,%ebx
int fd, i;
if(argc <= 1){
72: 83 3b 01 cmpl $0x1,(%ebx)
75: 7f 12 jg 89 <main+0x2b>
cat(0);
77: 83 ec 0c sub $0xc,%esp
7a: 6a 00 push $0x0
7c: e8 7f ff ff ff call 0 <cat>
81: 83 c4 10 add $0x10,%esp
exit();
84: e8 dd 02 00 00 call 366 <exit>
}
for(i = 1; i < argc; i++){
89: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
90: eb 71 jmp 103 <main+0xa5>
if((fd = open(argv[i], 0)) < 0){
92: 8b 45 f4 mov -0xc(%ebp),%eax
95: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
9c: 8b 43 04 mov 0x4(%ebx),%eax
9f: 01 d0 add %edx,%eax
a1: 8b 00 mov (%eax),%eax
a3: 83 ec 08 sub $0x8,%esp
a6: 6a 00 push $0x0
a8: 50 push %eax
a9: e8 f8 02 00 00 call 3a6 <open>
ae: 83 c4 10 add $0x10,%esp
b1: 89 45 f0 mov %eax,-0x10(%ebp)
b4: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
b8: 79 29 jns e3 <main+0x85>
printf(1, "cat: cannot open %s\n", argv[i]);
ba: 8b 45 f4 mov -0xc(%ebp),%eax
bd: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
c4: 8b 43 04 mov 0x4(%ebx),%eax
c7: 01 d0 add %edx,%eax
c9: 8b 00 mov (%eax),%eax
cb: 83 ec 04 sub $0x4,%esp
ce: 50 push %eax
cf: 68 b4 08 00 00 push $0x8b4
d4: 6a 01 push $0x1
d6: e8 12 04 00 00 call 4ed <printf>
db: 83 c4 10 add $0x10,%esp
exit();
de: e8 83 02 00 00 call 366 <exit>
}
cat(fd);
e3: 83 ec 0c sub $0xc,%esp
e6: ff 75 f0 pushl -0x10(%ebp)
e9: e8 12 ff ff ff call 0 <cat>
ee: 83 c4 10 add $0x10,%esp
close(fd);
f1: 83 ec 0c sub $0xc,%esp
f4: ff 75 f0 pushl -0x10(%ebp)
f7: e8 92 02 00 00 call 38e <close>
fc: 83 c4 10 add $0x10,%esp
if(argc <= 1){
cat(0);
exit();
}
for(i = 1; i < argc; i++){
ff: 83 45 f4 01 addl $0x1,-0xc(%ebp)
103: 8b 45 f4 mov -0xc(%ebp),%eax
106: 3b 03 cmp (%ebx),%eax
108: 7c 88 jl 92 <main+0x34>
exit();
}
cat(fd);
close(fd);
}
exit();
10a: e8 57 02 00 00 call 366 <exit>
0000010f <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
10f: 55 push %ebp
110: 89 e5 mov %esp,%ebp
112: 57 push %edi
113: 53 push %ebx
asm volatile("cld; rep stosb" :
114: 8b 4d 08 mov 0x8(%ebp),%ecx
117: 8b 55 10 mov 0x10(%ebp),%edx
11a: 8b 45 0c mov 0xc(%ebp),%eax
11d: 89 cb mov %ecx,%ebx
11f: 89 df mov %ebx,%edi
121: 89 d1 mov %edx,%ecx
123: fc cld
124: f3 aa rep stos %al,%es:(%edi)
126: 89 ca mov %ecx,%edx
128: 89 fb mov %edi,%ebx
12a: 89 5d 08 mov %ebx,0x8(%ebp)
12d: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
130: 90 nop
131: 5b pop %ebx
132: 5f pop %edi
133: 5d pop %ebp
134: c3 ret
00000135 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
135: 55 push %ebp
136: 89 e5 mov %esp,%ebp
138: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
13b: 8b 45 08 mov 0x8(%ebp),%eax
13e: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
141: 90 nop
142: 8b 45 08 mov 0x8(%ebp),%eax
145: 8d 50 01 lea 0x1(%eax),%edx
148: 89 55 08 mov %edx,0x8(%ebp)
14b: 8b 55 0c mov 0xc(%ebp),%edx
14e: 8d 4a 01 lea 0x1(%edx),%ecx
151: 89 4d 0c mov %ecx,0xc(%ebp)
154: 0f b6 12 movzbl (%edx),%edx
157: 88 10 mov %dl,(%eax)
159: 0f b6 00 movzbl (%eax),%eax
15c: 84 c0 test %al,%al
15e: 75 e2 jne 142 <strcpy+0xd>
;
return os;
160: 8b 45 fc mov -0x4(%ebp),%eax
}
163: c9 leave
164: c3 ret
00000165 <strcmp>:
int
strcmp(const char *p, const char *q)
{
165: 55 push %ebp
166: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
168: eb 08 jmp 172 <strcmp+0xd>
p++, q++;
16a: 83 45 08 01 addl $0x1,0x8(%ebp)
16e: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
172: 8b 45 08 mov 0x8(%ebp),%eax
175: 0f b6 00 movzbl (%eax),%eax
178: 84 c0 test %al,%al
17a: 74 10 je 18c <strcmp+0x27>
17c: 8b 45 08 mov 0x8(%ebp),%eax
17f: 0f b6 10 movzbl (%eax),%edx
182: 8b 45 0c mov 0xc(%ebp),%eax
185: 0f b6 00 movzbl (%eax),%eax
188: 38 c2 cmp %al,%dl
18a: 74 de je 16a <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
18c: 8b 45 08 mov 0x8(%ebp),%eax
18f: 0f b6 00 movzbl (%eax),%eax
192: 0f b6 d0 movzbl %al,%edx
195: 8b 45 0c mov 0xc(%ebp),%eax
198: 0f b6 00 movzbl (%eax),%eax
19b: 0f b6 c0 movzbl %al,%eax
19e: 29 c2 sub %eax,%edx
1a0: 89 d0 mov %edx,%eax
}
1a2: 5d pop %ebp
1a3: c3 ret
000001a4 <strlen>:
uint
strlen(char *s)
{
1a4: 55 push %ebp
1a5: 89 e5 mov %esp,%ebp
1a7: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
1aa: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
1b1: eb 04 jmp 1b7 <strlen+0x13>
1b3: 83 45 fc 01 addl $0x1,-0x4(%ebp)
1b7: 8b 55 fc mov -0x4(%ebp),%edx
1ba: 8b 45 08 mov 0x8(%ebp),%eax
1bd: 01 d0 add %edx,%eax
1bf: 0f b6 00 movzbl (%eax),%eax
1c2: 84 c0 test %al,%al
1c4: 75 ed jne 1b3 <strlen+0xf>
;
return n;
1c6: 8b 45 fc mov -0x4(%ebp),%eax
}
1c9: c9 leave
1ca: c3 ret
000001cb <memset>:
void*
memset(void *dst, int c, uint n)
{
1cb: 55 push %ebp
1cc: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
1ce: 8b 45 10 mov 0x10(%ebp),%eax
1d1: 50 push %eax
1d2: ff 75 0c pushl 0xc(%ebp)
1d5: ff 75 08 pushl 0x8(%ebp)
1d8: e8 32 ff ff ff call 10f <stosb>
1dd: 83 c4 0c add $0xc,%esp
return dst;
1e0: 8b 45 08 mov 0x8(%ebp),%eax
}
1e3: c9 leave
1e4: c3 ret
000001e5 <strchr>:
char*
strchr(const char *s, char c)
{
1e5: 55 push %ebp
1e6: 89 e5 mov %esp,%ebp
1e8: 83 ec 04 sub $0x4,%esp
1eb: 8b 45 0c mov 0xc(%ebp),%eax
1ee: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
1f1: eb 14 jmp 207 <strchr+0x22>
if(*s == c)
1f3: 8b 45 08 mov 0x8(%ebp),%eax
1f6: 0f b6 00 movzbl (%eax),%eax
1f9: 3a 45 fc cmp -0x4(%ebp),%al
1fc: 75 05 jne 203 <strchr+0x1e>
return (char*)s;
1fe: 8b 45 08 mov 0x8(%ebp),%eax
201: eb 13 jmp 216 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
203: 83 45 08 01 addl $0x1,0x8(%ebp)
207: 8b 45 08 mov 0x8(%ebp),%eax
20a: 0f b6 00 movzbl (%eax),%eax
20d: 84 c0 test %al,%al
20f: 75 e2 jne 1f3 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
211: b8 00 00 00 00 mov $0x0,%eax
}
216: c9 leave
217: c3 ret
00000218 <gets>:
char*
gets(char *buf, int max)
{
218: 55 push %ebp
219: 89 e5 mov %esp,%ebp
21b: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
21e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
225: eb 42 jmp 269 <gets+0x51>
cc = read(0, &c, 1);
227: 83 ec 04 sub $0x4,%esp
22a: 6a 01 push $0x1
22c: 8d 45 ef lea -0x11(%ebp),%eax
22f: 50 push %eax
230: 6a 00 push $0x0
232: e8 47 01 00 00 call 37e <read>
237: 83 c4 10 add $0x10,%esp
23a: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
23d: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
241: 7e 33 jle 276 <gets+0x5e>
break;
buf[i++] = c;
243: 8b 45 f4 mov -0xc(%ebp),%eax
246: 8d 50 01 lea 0x1(%eax),%edx
249: 89 55 f4 mov %edx,-0xc(%ebp)
24c: 89 c2 mov %eax,%edx
24e: 8b 45 08 mov 0x8(%ebp),%eax
251: 01 c2 add %eax,%edx
253: 0f b6 45 ef movzbl -0x11(%ebp),%eax
257: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
259: 0f b6 45 ef movzbl -0x11(%ebp),%eax
25d: 3c 0a cmp $0xa,%al
25f: 74 16 je 277 <gets+0x5f>
261: 0f b6 45 ef movzbl -0x11(%ebp),%eax
265: 3c 0d cmp $0xd,%al
267: 74 0e je 277 <gets+0x5f>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
269: 8b 45 f4 mov -0xc(%ebp),%eax
26c: 83 c0 01 add $0x1,%eax
26f: 3b 45 0c cmp 0xc(%ebp),%eax
272: 7c b3 jl 227 <gets+0xf>
274: eb 01 jmp 277 <gets+0x5f>
cc = read(0, &c, 1);
if(cc < 1)
break;
276: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
277: 8b 55 f4 mov -0xc(%ebp),%edx
27a: 8b 45 08 mov 0x8(%ebp),%eax
27d: 01 d0 add %edx,%eax
27f: c6 00 00 movb $0x0,(%eax)
return buf;
282: 8b 45 08 mov 0x8(%ebp),%eax
}
285: c9 leave
286: c3 ret
00000287 <stat>:
int
stat(char *n, struct stat *st)
{
287: 55 push %ebp
288: 89 e5 mov %esp,%ebp
28a: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
28d: 83 ec 08 sub $0x8,%esp
290: 6a 00 push $0x0
292: ff 75 08 pushl 0x8(%ebp)
295: e8 0c 01 00 00 call 3a6 <open>
29a: 83 c4 10 add $0x10,%esp
29d: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
2a0: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2a4: 79 07 jns 2ad <stat+0x26>
return -1;
2a6: b8 ff ff ff ff mov $0xffffffff,%eax
2ab: eb 25 jmp 2d2 <stat+0x4b>
r = fstat(fd, st);
2ad: 83 ec 08 sub $0x8,%esp
2b0: ff 75 0c pushl 0xc(%ebp)
2b3: ff 75 f4 pushl -0xc(%ebp)
2b6: e8 03 01 00 00 call 3be <fstat>
2bb: 83 c4 10 add $0x10,%esp
2be: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
2c1: 83 ec 0c sub $0xc,%esp
2c4: ff 75 f4 pushl -0xc(%ebp)
2c7: e8 c2 00 00 00 call 38e <close>
2cc: 83 c4 10 add $0x10,%esp
return r;
2cf: 8b 45 f0 mov -0x10(%ebp),%eax
}
2d2: c9 leave
2d3: c3 ret
000002d4 <atoi>:
int
atoi(const char *s)
{
2d4: 55 push %ebp
2d5: 89 e5 mov %esp,%ebp
2d7: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
2da: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
2e1: eb 25 jmp 308 <atoi+0x34>
n = n*10 + *s++ - '0';
2e3: 8b 55 fc mov -0x4(%ebp),%edx
2e6: 89 d0 mov %edx,%eax
2e8: c1 e0 02 shl $0x2,%eax
2eb: 01 d0 add %edx,%eax
2ed: 01 c0 add %eax,%eax
2ef: 89 c1 mov %eax,%ecx
2f1: 8b 45 08 mov 0x8(%ebp),%eax
2f4: 8d 50 01 lea 0x1(%eax),%edx
2f7: 89 55 08 mov %edx,0x8(%ebp)
2fa: 0f b6 00 movzbl (%eax),%eax
2fd: 0f be c0 movsbl %al,%eax
300: 01 c8 add %ecx,%eax
302: 83 e8 30 sub $0x30,%eax
305: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
308: 8b 45 08 mov 0x8(%ebp),%eax
30b: 0f b6 00 movzbl (%eax),%eax
30e: 3c 2f cmp $0x2f,%al
310: 7e 0a jle 31c <atoi+0x48>
312: 8b 45 08 mov 0x8(%ebp),%eax
315: 0f b6 00 movzbl (%eax),%eax
318: 3c 39 cmp $0x39,%al
31a: 7e c7 jle 2e3 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
31c: 8b 45 fc mov -0x4(%ebp),%eax
}
31f: c9 leave
320: c3 ret
00000321 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
321: 55 push %ebp
322: 89 e5 mov %esp,%ebp
324: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
327: 8b 45 08 mov 0x8(%ebp),%eax
32a: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
32d: 8b 45 0c mov 0xc(%ebp),%eax
330: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
333: eb 17 jmp 34c <memmove+0x2b>
*dst++ = *src++;
335: 8b 45 fc mov -0x4(%ebp),%eax
338: 8d 50 01 lea 0x1(%eax),%edx
33b: 89 55 fc mov %edx,-0x4(%ebp)
33e: 8b 55 f8 mov -0x8(%ebp),%edx
341: 8d 4a 01 lea 0x1(%edx),%ecx
344: 89 4d f8 mov %ecx,-0x8(%ebp)
347: 0f b6 12 movzbl (%edx),%edx
34a: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
34c: 8b 45 10 mov 0x10(%ebp),%eax
34f: 8d 50 ff lea -0x1(%eax),%edx
352: 89 55 10 mov %edx,0x10(%ebp)
355: 85 c0 test %eax,%eax
357: 7f dc jg 335 <memmove+0x14>
*dst++ = *src++;
return vdst;
359: 8b 45 08 mov 0x8(%ebp),%eax
}
35c: c9 leave
35d: c3 ret
0000035e <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
35e: b8 01 00 00 00 mov $0x1,%eax
363: cd 40 int $0x40
365: c3 ret
00000366 <exit>:
SYSCALL(exit)
366: b8 02 00 00 00 mov $0x2,%eax
36b: cd 40 int $0x40
36d: c3 ret
0000036e <wait>:
SYSCALL(wait)
36e: b8 03 00 00 00 mov $0x3,%eax
373: cd 40 int $0x40
375: c3 ret
00000376 <pipe>:
SYSCALL(pipe)
376: b8 04 00 00 00 mov $0x4,%eax
37b: cd 40 int $0x40
37d: c3 ret
0000037e <read>:
SYSCALL(read)
37e: b8 05 00 00 00 mov $0x5,%eax
383: cd 40 int $0x40
385: c3 ret
00000386 <write>:
SYSCALL(write)
386: b8 10 00 00 00 mov $0x10,%eax
38b: cd 40 int $0x40
38d: c3 ret
0000038e <close>:
SYSCALL(close)
38e: b8 15 00 00 00 mov $0x15,%eax
393: cd 40 int $0x40
395: c3 ret
00000396 <kill>:
SYSCALL(kill)
396: b8 06 00 00 00 mov $0x6,%eax
39b: cd 40 int $0x40
39d: c3 ret
0000039e <exec>:
SYSCALL(exec)
39e: b8 07 00 00 00 mov $0x7,%eax
3a3: cd 40 int $0x40
3a5: c3 ret
000003a6 <open>:
SYSCALL(open)
3a6: b8 0f 00 00 00 mov $0xf,%eax
3ab: cd 40 int $0x40
3ad: c3 ret
000003ae <mknod>:
SYSCALL(mknod)
3ae: b8 11 00 00 00 mov $0x11,%eax
3b3: cd 40 int $0x40
3b5: c3 ret
000003b6 <unlink>:
SYSCALL(unlink)
3b6: b8 12 00 00 00 mov $0x12,%eax
3bb: cd 40 int $0x40
3bd: c3 ret
000003be <fstat>:
SYSCALL(fstat)
3be: b8 08 00 00 00 mov $0x8,%eax
3c3: cd 40 int $0x40
3c5: c3 ret
000003c6 <link>:
SYSCALL(link)
3c6: b8 13 00 00 00 mov $0x13,%eax
3cb: cd 40 int $0x40
3cd: c3 ret
000003ce <mkdir>:
SYSCALL(mkdir)
3ce: b8 14 00 00 00 mov $0x14,%eax
3d3: cd 40 int $0x40
3d5: c3 ret
000003d6 <chdir>:
SYSCALL(chdir)
3d6: b8 09 00 00 00 mov $0x9,%eax
3db: cd 40 int $0x40
3dd: c3 ret
000003de <dup>:
SYSCALL(dup)
3de: b8 0a 00 00 00 mov $0xa,%eax
3e3: cd 40 int $0x40
3e5: c3 ret
000003e6 <getpid>:
SYSCALL(getpid)
3e6: b8 0b 00 00 00 mov $0xb,%eax
3eb: cd 40 int $0x40
3ed: c3 ret
000003ee <sbrk>:
SYSCALL(sbrk)
3ee: b8 0c 00 00 00 mov $0xc,%eax
3f3: cd 40 int $0x40
3f5: c3 ret
000003f6 <sleep>:
SYSCALL(sleep)
3f6: b8 0d 00 00 00 mov $0xd,%eax
3fb: cd 40 int $0x40
3fd: c3 ret
000003fe <uptime>:
SYSCALL(uptime)
3fe: b8 0e 00 00 00 mov $0xe,%eax
403: cd 40 int $0x40
405: c3 ret
00000406 <setprio>:
SYSCALL(setprio)
406: b8 16 00 00 00 mov $0x16,%eax
40b: cd 40 int $0x40
40d: c3 ret
0000040e <getprio>:
SYSCALL(getprio)
40e: b8 17 00 00 00 mov $0x17,%eax
413: cd 40 int $0x40
415: c3 ret
00000416 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
416: 55 push %ebp
417: 89 e5 mov %esp,%ebp
419: 83 ec 18 sub $0x18,%esp
41c: 8b 45 0c mov 0xc(%ebp),%eax
41f: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
422: 83 ec 04 sub $0x4,%esp
425: 6a 01 push $0x1
427: 8d 45 f4 lea -0xc(%ebp),%eax
42a: 50 push %eax
42b: ff 75 08 pushl 0x8(%ebp)
42e: e8 53 ff ff ff call 386 <write>
433: 83 c4 10 add $0x10,%esp
}
436: 90 nop
437: c9 leave
438: c3 ret
00000439 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
439: 55 push %ebp
43a: 89 e5 mov %esp,%ebp
43c: 53 push %ebx
43d: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
440: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
447: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
44b: 74 17 je 464 <printint+0x2b>
44d: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
451: 79 11 jns 464 <printint+0x2b>
neg = 1;
453: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
45a: 8b 45 0c mov 0xc(%ebp),%eax
45d: f7 d8 neg %eax
45f: 89 45 ec mov %eax,-0x14(%ebp)
462: eb 06 jmp 46a <printint+0x31>
} else {
x = xx;
464: 8b 45 0c mov 0xc(%ebp),%eax
467: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
46a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
471: 8b 4d f4 mov -0xc(%ebp),%ecx
474: 8d 41 01 lea 0x1(%ecx),%eax
477: 89 45 f4 mov %eax,-0xc(%ebp)
47a: 8b 5d 10 mov 0x10(%ebp),%ebx
47d: 8b 45 ec mov -0x14(%ebp),%eax
480: ba 00 00 00 00 mov $0x0,%edx
485: f7 f3 div %ebx
487: 89 d0 mov %edx,%eax
489: 0f b6 80 3c 0b 00 00 movzbl 0xb3c(%eax),%eax
490: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
494: 8b 5d 10 mov 0x10(%ebp),%ebx
497: 8b 45 ec mov -0x14(%ebp),%eax
49a: ba 00 00 00 00 mov $0x0,%edx
49f: f7 f3 div %ebx
4a1: 89 45 ec mov %eax,-0x14(%ebp)
4a4: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
4a8: 75 c7 jne 471 <printint+0x38>
if(neg)
4aa: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
4ae: 74 2d je 4dd <printint+0xa4>
buf[i++] = '-';
4b0: 8b 45 f4 mov -0xc(%ebp),%eax
4b3: 8d 50 01 lea 0x1(%eax),%edx
4b6: 89 55 f4 mov %edx,-0xc(%ebp)
4b9: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
4be: eb 1d jmp 4dd <printint+0xa4>
putc(fd, buf[i]);
4c0: 8d 55 dc lea -0x24(%ebp),%edx
4c3: 8b 45 f4 mov -0xc(%ebp),%eax
4c6: 01 d0 add %edx,%eax
4c8: 0f b6 00 movzbl (%eax),%eax
4cb: 0f be c0 movsbl %al,%eax
4ce: 83 ec 08 sub $0x8,%esp
4d1: 50 push %eax
4d2: ff 75 08 pushl 0x8(%ebp)
4d5: e8 3c ff ff ff call 416 <putc>
4da: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
4dd: 83 6d f4 01 subl $0x1,-0xc(%ebp)
4e1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
4e5: 79 d9 jns 4c0 <printint+0x87>
putc(fd, buf[i]);
}
4e7: 90 nop
4e8: 8b 5d fc mov -0x4(%ebp),%ebx
4eb: c9 leave
4ec: c3 ret
000004ed <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
4ed: 55 push %ebp
4ee: 89 e5 mov %esp,%ebp
4f0: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
4f3: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
4fa: 8d 45 0c lea 0xc(%ebp),%eax
4fd: 83 c0 04 add $0x4,%eax
500: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
503: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
50a: e9 59 01 00 00 jmp 668 <printf+0x17b>
c = fmt[i] & 0xff;
50f: 8b 55 0c mov 0xc(%ebp),%edx
512: 8b 45 f0 mov -0x10(%ebp),%eax
515: 01 d0 add %edx,%eax
517: 0f b6 00 movzbl (%eax),%eax
51a: 0f be c0 movsbl %al,%eax
51d: 25 ff 00 00 00 and $0xff,%eax
522: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
525: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
529: 75 2c jne 557 <printf+0x6a>
if(c == '%'){
52b: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
52f: 75 0c jne 53d <printf+0x50>
state = '%';
531: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
538: e9 27 01 00 00 jmp 664 <printf+0x177>
} else {
putc(fd, c);
53d: 8b 45 e4 mov -0x1c(%ebp),%eax
540: 0f be c0 movsbl %al,%eax
543: 83 ec 08 sub $0x8,%esp
546: 50 push %eax
547: ff 75 08 pushl 0x8(%ebp)
54a: e8 c7 fe ff ff call 416 <putc>
54f: 83 c4 10 add $0x10,%esp
552: e9 0d 01 00 00 jmp 664 <printf+0x177>
}
} else if(state == '%'){
557: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
55b: 0f 85 03 01 00 00 jne 664 <printf+0x177>
if(c == 'd'){
561: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
565: 75 1e jne 585 <printf+0x98>
printint(fd, *ap, 10, 1);
567: 8b 45 e8 mov -0x18(%ebp),%eax
56a: 8b 00 mov (%eax),%eax
56c: 6a 01 push $0x1
56e: 6a 0a push $0xa
570: 50 push %eax
571: ff 75 08 pushl 0x8(%ebp)
574: e8 c0 fe ff ff call 439 <printint>
579: 83 c4 10 add $0x10,%esp
ap++;
57c: 83 45 e8 04 addl $0x4,-0x18(%ebp)
580: e9 d8 00 00 00 jmp 65d <printf+0x170>
} else if(c == 'x' || c == 'p'){
585: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
589: 74 06 je 591 <printf+0xa4>
58b: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
58f: 75 1e jne 5af <printf+0xc2>
printint(fd, *ap, 16, 0);
591: 8b 45 e8 mov -0x18(%ebp),%eax
594: 8b 00 mov (%eax),%eax
596: 6a 00 push $0x0
598: 6a 10 push $0x10
59a: 50 push %eax
59b: ff 75 08 pushl 0x8(%ebp)
59e: e8 96 fe ff ff call 439 <printint>
5a3: 83 c4 10 add $0x10,%esp
ap++;
5a6: 83 45 e8 04 addl $0x4,-0x18(%ebp)
5aa: e9 ae 00 00 00 jmp 65d <printf+0x170>
} else if(c == 's'){
5af: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
5b3: 75 43 jne 5f8 <printf+0x10b>
s = (char*)*ap;
5b5: 8b 45 e8 mov -0x18(%ebp),%eax
5b8: 8b 00 mov (%eax),%eax
5ba: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
5bd: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
5c1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
5c5: 75 25 jne 5ec <printf+0xff>
s = "(null)";
5c7: c7 45 f4 c9 08 00 00 movl $0x8c9,-0xc(%ebp)
while(*s != 0){
5ce: eb 1c jmp 5ec <printf+0xff>
putc(fd, *s);
5d0: 8b 45 f4 mov -0xc(%ebp),%eax
5d3: 0f b6 00 movzbl (%eax),%eax
5d6: 0f be c0 movsbl %al,%eax
5d9: 83 ec 08 sub $0x8,%esp
5dc: 50 push %eax
5dd: ff 75 08 pushl 0x8(%ebp)
5e0: e8 31 fe ff ff call 416 <putc>
5e5: 83 c4 10 add $0x10,%esp
s++;
5e8: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
5ec: 8b 45 f4 mov -0xc(%ebp),%eax
5ef: 0f b6 00 movzbl (%eax),%eax
5f2: 84 c0 test %al,%al
5f4: 75 da jne 5d0 <printf+0xe3>
5f6: eb 65 jmp 65d <printf+0x170>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
5f8: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
5fc: 75 1d jne 61b <printf+0x12e>
putc(fd, *ap);
5fe: 8b 45 e8 mov -0x18(%ebp),%eax
601: 8b 00 mov (%eax),%eax
603: 0f be c0 movsbl %al,%eax
606: 83 ec 08 sub $0x8,%esp
609: 50 push %eax
60a: ff 75 08 pushl 0x8(%ebp)
60d: e8 04 fe ff ff call 416 <putc>
612: 83 c4 10 add $0x10,%esp
ap++;
615: 83 45 e8 04 addl $0x4,-0x18(%ebp)
619: eb 42 jmp 65d <printf+0x170>
} else if(c == '%'){
61b: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
61f: 75 17 jne 638 <printf+0x14b>
putc(fd, c);
621: 8b 45 e4 mov -0x1c(%ebp),%eax
624: 0f be c0 movsbl %al,%eax
627: 83 ec 08 sub $0x8,%esp
62a: 50 push %eax
62b: ff 75 08 pushl 0x8(%ebp)
62e: e8 e3 fd ff ff call 416 <putc>
633: 83 c4 10 add $0x10,%esp
636: eb 25 jmp 65d <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
638: 83 ec 08 sub $0x8,%esp
63b: 6a 25 push $0x25
63d: ff 75 08 pushl 0x8(%ebp)
640: e8 d1 fd ff ff call 416 <putc>
645: 83 c4 10 add $0x10,%esp
putc(fd, c);
648: 8b 45 e4 mov -0x1c(%ebp),%eax
64b: 0f be c0 movsbl %al,%eax
64e: 83 ec 08 sub $0x8,%esp
651: 50 push %eax
652: ff 75 08 pushl 0x8(%ebp)
655: e8 bc fd ff ff call 416 <putc>
65a: 83 c4 10 add $0x10,%esp
}
state = 0;
65d: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
664: 83 45 f0 01 addl $0x1,-0x10(%ebp)
668: 8b 55 0c mov 0xc(%ebp),%edx
66b: 8b 45 f0 mov -0x10(%ebp),%eax
66e: 01 d0 add %edx,%eax
670: 0f b6 00 movzbl (%eax),%eax
673: 84 c0 test %al,%al
675: 0f 85 94 fe ff ff jne 50f <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
67b: 90 nop
67c: c9 leave
67d: c3 ret
0000067e <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
67e: 55 push %ebp
67f: 89 e5 mov %esp,%ebp
681: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
684: 8b 45 08 mov 0x8(%ebp),%eax
687: 83 e8 08 sub $0x8,%eax
68a: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
68d: a1 68 0b 00 00 mov 0xb68,%eax
692: 89 45 fc mov %eax,-0x4(%ebp)
695: eb 24 jmp 6bb <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
697: 8b 45 fc mov -0x4(%ebp),%eax
69a: 8b 00 mov (%eax),%eax
69c: 3b 45 fc cmp -0x4(%ebp),%eax
69f: 77 12 ja 6b3 <free+0x35>
6a1: 8b 45 f8 mov -0x8(%ebp),%eax
6a4: 3b 45 fc cmp -0x4(%ebp),%eax
6a7: 77 24 ja 6cd <free+0x4f>
6a9: 8b 45 fc mov -0x4(%ebp),%eax
6ac: 8b 00 mov (%eax),%eax
6ae: 3b 45 f8 cmp -0x8(%ebp),%eax
6b1: 77 1a ja 6cd <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
6b3: 8b 45 fc mov -0x4(%ebp),%eax
6b6: 8b 00 mov (%eax),%eax
6b8: 89 45 fc mov %eax,-0x4(%ebp)
6bb: 8b 45 f8 mov -0x8(%ebp),%eax
6be: 3b 45 fc cmp -0x4(%ebp),%eax
6c1: 76 d4 jbe 697 <free+0x19>
6c3: 8b 45 fc mov -0x4(%ebp),%eax
6c6: 8b 00 mov (%eax),%eax
6c8: 3b 45 f8 cmp -0x8(%ebp),%eax
6cb: 76 ca jbe 697 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
6cd: 8b 45 f8 mov -0x8(%ebp),%eax
6d0: 8b 40 04 mov 0x4(%eax),%eax
6d3: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
6da: 8b 45 f8 mov -0x8(%ebp),%eax
6dd: 01 c2 add %eax,%edx
6df: 8b 45 fc mov -0x4(%ebp),%eax
6e2: 8b 00 mov (%eax),%eax
6e4: 39 c2 cmp %eax,%edx
6e6: 75 24 jne 70c <free+0x8e>
bp->s.size += p->s.ptr->s.size;
6e8: 8b 45 f8 mov -0x8(%ebp),%eax
6eb: 8b 50 04 mov 0x4(%eax),%edx
6ee: 8b 45 fc mov -0x4(%ebp),%eax
6f1: 8b 00 mov (%eax),%eax
6f3: 8b 40 04 mov 0x4(%eax),%eax
6f6: 01 c2 add %eax,%edx
6f8: 8b 45 f8 mov -0x8(%ebp),%eax
6fb: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
6fe: 8b 45 fc mov -0x4(%ebp),%eax
701: 8b 00 mov (%eax),%eax
703: 8b 10 mov (%eax),%edx
705: 8b 45 f8 mov -0x8(%ebp),%eax
708: 89 10 mov %edx,(%eax)
70a: eb 0a jmp 716 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
70c: 8b 45 fc mov -0x4(%ebp),%eax
70f: 8b 10 mov (%eax),%edx
711: 8b 45 f8 mov -0x8(%ebp),%eax
714: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
716: 8b 45 fc mov -0x4(%ebp),%eax
719: 8b 40 04 mov 0x4(%eax),%eax
71c: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
723: 8b 45 fc mov -0x4(%ebp),%eax
726: 01 d0 add %edx,%eax
728: 3b 45 f8 cmp -0x8(%ebp),%eax
72b: 75 20 jne 74d <free+0xcf>
p->s.size += bp->s.size;
72d: 8b 45 fc mov -0x4(%ebp),%eax
730: 8b 50 04 mov 0x4(%eax),%edx
733: 8b 45 f8 mov -0x8(%ebp),%eax
736: 8b 40 04 mov 0x4(%eax),%eax
739: 01 c2 add %eax,%edx
73b: 8b 45 fc mov -0x4(%ebp),%eax
73e: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
741: 8b 45 f8 mov -0x8(%ebp),%eax
744: 8b 10 mov (%eax),%edx
746: 8b 45 fc mov -0x4(%ebp),%eax
749: 89 10 mov %edx,(%eax)
74b: eb 08 jmp 755 <free+0xd7>
} else
p->s.ptr = bp;
74d: 8b 45 fc mov -0x4(%ebp),%eax
750: 8b 55 f8 mov -0x8(%ebp),%edx
753: 89 10 mov %edx,(%eax)
freep = p;
755: 8b 45 fc mov -0x4(%ebp),%eax
758: a3 68 0b 00 00 mov %eax,0xb68
}
75d: 90 nop
75e: c9 leave
75f: c3 ret
00000760 <morecore>:
static Header*
morecore(uint nu)
{
760: 55 push %ebp
761: 89 e5 mov %esp,%ebp
763: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
766: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
76d: 77 07 ja 776 <morecore+0x16>
nu = 4096;
76f: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
776: 8b 45 08 mov 0x8(%ebp),%eax
779: c1 e0 03 shl $0x3,%eax
77c: 83 ec 0c sub $0xc,%esp
77f: 50 push %eax
780: e8 69 fc ff ff call 3ee <sbrk>
785: 83 c4 10 add $0x10,%esp
788: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
78b: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
78f: 75 07 jne 798 <morecore+0x38>
return 0;
791: b8 00 00 00 00 mov $0x0,%eax
796: eb 26 jmp 7be <morecore+0x5e>
hp = (Header*)p;
798: 8b 45 f4 mov -0xc(%ebp),%eax
79b: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
79e: 8b 45 f0 mov -0x10(%ebp),%eax
7a1: 8b 55 08 mov 0x8(%ebp),%edx
7a4: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
7a7: 8b 45 f0 mov -0x10(%ebp),%eax
7aa: 83 c0 08 add $0x8,%eax
7ad: 83 ec 0c sub $0xc,%esp
7b0: 50 push %eax
7b1: e8 c8 fe ff ff call 67e <free>
7b6: 83 c4 10 add $0x10,%esp
return freep;
7b9: a1 68 0b 00 00 mov 0xb68,%eax
}
7be: c9 leave
7bf: c3 ret
000007c0 <malloc>:
void*
malloc(uint nbytes)
{
7c0: 55 push %ebp
7c1: 89 e5 mov %esp,%ebp
7c3: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
7c6: 8b 45 08 mov 0x8(%ebp),%eax
7c9: 83 c0 07 add $0x7,%eax
7cc: c1 e8 03 shr $0x3,%eax
7cf: 83 c0 01 add $0x1,%eax
7d2: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
7d5: a1 68 0b 00 00 mov 0xb68,%eax
7da: 89 45 f0 mov %eax,-0x10(%ebp)
7dd: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
7e1: 75 23 jne 806 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
7e3: c7 45 f0 60 0b 00 00 movl $0xb60,-0x10(%ebp)
7ea: 8b 45 f0 mov -0x10(%ebp),%eax
7ed: a3 68 0b 00 00 mov %eax,0xb68
7f2: a1 68 0b 00 00 mov 0xb68,%eax
7f7: a3 60 0b 00 00 mov %eax,0xb60
base.s.size = 0;
7fc: c7 05 64 0b 00 00 00 movl $0x0,0xb64
803: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
806: 8b 45 f0 mov -0x10(%ebp),%eax
809: 8b 00 mov (%eax),%eax
80b: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
80e: 8b 45 f4 mov -0xc(%ebp),%eax
811: 8b 40 04 mov 0x4(%eax),%eax
814: 3b 45 ec cmp -0x14(%ebp),%eax
817: 72 4d jb 866 <malloc+0xa6>
if(p->s.size == nunits)
819: 8b 45 f4 mov -0xc(%ebp),%eax
81c: 8b 40 04 mov 0x4(%eax),%eax
81f: 3b 45 ec cmp -0x14(%ebp),%eax
822: 75 0c jne 830 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
824: 8b 45 f4 mov -0xc(%ebp),%eax
827: 8b 10 mov (%eax),%edx
829: 8b 45 f0 mov -0x10(%ebp),%eax
82c: 89 10 mov %edx,(%eax)
82e: eb 26 jmp 856 <malloc+0x96>
else {
p->s.size -= nunits;
830: 8b 45 f4 mov -0xc(%ebp),%eax
833: 8b 40 04 mov 0x4(%eax),%eax
836: 2b 45 ec sub -0x14(%ebp),%eax
839: 89 c2 mov %eax,%edx
83b: 8b 45 f4 mov -0xc(%ebp),%eax
83e: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
841: 8b 45 f4 mov -0xc(%ebp),%eax
844: 8b 40 04 mov 0x4(%eax),%eax
847: c1 e0 03 shl $0x3,%eax
84a: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
84d: 8b 45 f4 mov -0xc(%ebp),%eax
850: 8b 55 ec mov -0x14(%ebp),%edx
853: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
856: 8b 45 f0 mov -0x10(%ebp),%eax
859: a3 68 0b 00 00 mov %eax,0xb68
return (void*)(p + 1);
85e: 8b 45 f4 mov -0xc(%ebp),%eax
861: 83 c0 08 add $0x8,%eax
864: eb 3b jmp 8a1 <malloc+0xe1>
}
if(p == freep)
866: a1 68 0b 00 00 mov 0xb68,%eax
86b: 39 45 f4 cmp %eax,-0xc(%ebp)
86e: 75 1e jne 88e <malloc+0xce>
if((p = morecore(nunits)) == 0)
870: 83 ec 0c sub $0xc,%esp
873: ff 75 ec pushl -0x14(%ebp)
876: e8 e5 fe ff ff call 760 <morecore>
87b: 83 c4 10 add $0x10,%esp
87e: 89 45 f4 mov %eax,-0xc(%ebp)
881: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
885: 75 07 jne 88e <malloc+0xce>
return 0;
887: b8 00 00 00 00 mov $0x0,%eax
88c: eb 13 jmp 8a1 <malloc+0xe1>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
88e: 8b 45 f4 mov -0xc(%ebp),%eax
891: 89 45 f0 mov %eax,-0x10(%ebp)
894: 8b 45 f4 mov -0xc(%ebp),%eax
897: 8b 00 mov (%eax),%eax
899: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
89c: e9 6d ff ff ff jmp 80e <malloc+0x4e>
}
8a1: c9 leave
8a2: c3 ret
|
Syntax/Number.agda | Lolirofle/stuff-in-agda | 6 | 1033 | <filename>Syntax/Number.agda
module Syntax.Number where
import Lvl
open import Logic.Propositional
open import Numeral.Natural
open import Type
record Numeral {ℓ} (T : Type{ℓ}) : Typeω where
field
{restriction-ℓ} : Lvl.Level
restriction : ℕ → Type{restriction-ℓ}
num : (n : ℕ) → ⦃ _ : restriction(n) ⦄ → T
open Numeral ⦃ ... ⦄ public using (num)
{-# BUILTIN FROMNAT num #-}
InfiniteNumeral = Numeral
module InfiniteNumeral {ℓ} {T : Type{ℓ}} where
intro : (ℕ → T) → InfiniteNumeral(T)
Numeral.restriction-ℓ (intro(_)) = Lvl.𝟎
Numeral.restriction (intro(_)) _ = ⊤
Numeral.num (intro(f)) n ⦃ _ ⦄ = f(n)
-- record InfiniteNumeral {ℓ} (T : Type{ℓ}) : Type{ℓ} where
-- record InfiniteNumeral {ℓ} (T : Type{ℓ}) : Type{ℓ} where
-- field
-- num : ℕ → T
-- instance
-- Numeral-from-InfiniteNumeral : ∀{ℓ}{T} → ⦃ _ : InfiniteNumeral{ℓ}(T) ⦄ → Numeral{ℓ}(T)
-- Numeral.restriction-ℓ ( Numeral-from-InfiniteNumeral ) = Lvl.𝟎
-- Numeral.restriction ( Numeral-from-InfiniteNumeral ) (_) = ⊤
-- num ⦃ Numeral-from-InfiniteNumeral ⦃ infNum ⦄ ⦄ (n) ⦃ _ ⦄ = InfiniteNumeral.num(infNum) (n)
instance
ℕ-InfiniteNumeral : InfiniteNumeral (ℕ)
ℕ-InfiniteNumeral = InfiniteNumeral.intro(id) where
id : ℕ → ℕ
id x = x
instance
Level-InfiniteNumeral : InfiniteNumeral (Lvl.Level)
Level-InfiniteNumeral = InfiniteNumeral.intro(f) where
f : ℕ → Lvl.Level
f(ℕ.𝟎) = Lvl.𝟎
f(ℕ.𝐒(n)) = Lvl.𝐒(f(n))
record NegativeNumeral {ℓ} (T : Type{ℓ}) : Typeω where
field
{restriction-ℓ} : Lvl.Level
restriction : ℕ → Type{restriction-ℓ}
num : (n : ℕ) → ⦃ _ : restriction(n) ⦄ → T
open NegativeNumeral ⦃ ... ⦄ public using () renaming (num to -num)
{-# BUILTIN FROMNEG -num #-}
InfiniteNegativeNumeral = NegativeNumeral
module InfiniteNegativeNumeral {ℓ} {T : Type{ℓ}} where
intro : (ℕ → T) → InfiniteNegativeNumeral(T)
NegativeNumeral.restriction-ℓ (intro(_)) = Lvl.𝟎
NegativeNumeral.restriction (intro(_)) _ = ⊤
NegativeNumeral.num (intro(f)) n ⦃ _ ⦄ = f(n)
-- record InfiniteNegativeNumeral {ℓ} (T : Type{ℓ}) : Type{ℓ} where
-- field
-- num : ℕ → T
-- open InfiniteNegativeNumeral ⦃ ... ⦄ public
-- instance
-- NegativeNumeral-from-InfiniteNegativeNumeral : ∀{ℓ}{T} → ⦃ _ : InfiniteNegativeNumeral{ℓ}(T) ⦄ → NegativeNumeral{ℓ}(T)
-- NegativeNumeral.restriction-ℓ ( NegativeNumeral-from-InfiniteNegativeNumeral ) = Lvl.𝟎
-- NegativeNumeral.restriction ( NegativeNumeral-from-InfiniteNegativeNumeral ) (_) = ⊤
-- -num ⦃ NegativeNumeral-from-InfiniteNegativeNumeral ⦃ infNegNum ⦄ ⦄ (n) ⦃ _ ⦄ = InfiniteNegativeNumeral.num(infNegNum) (n)
|
test/Succeed/Issue3903.agda | shlevy/agda | 1,989 | 6923 | <reponame>shlevy/agda
open import Agda.Builtin.Unit
open import Agda.Builtin.Bool
open import Agda.Builtin.Nat
open import Agda.Builtin.Equality
open import Agda.Builtin.IO
open import Agda.Builtin.String
postulate
putStr : String → IO ⊤
{-# FOREIGN GHC import qualified Data.Text.IO #-}
{-# COMPILE GHC putStr = Data.Text.IO.putStr #-}
data Sing : Nat → Set where
sing : Sing zero
data Vec : Nat → Set where
nil : Vec zero
cons : ∀ n → Vec n → Vec (suc n)
isTailNil : ∀ m n → Sing m → Vec n → Bool
isTailNil .0 .1 sing (cons zero v) = true -- two `zero`s are buried in the dot patterns, which to resurrect?
isTailNil _ _ _ _ = false
shouldBeFalse = isTailNil 0 2 sing (cons 1 (cons 0 nil))
isFalse : false ≡ shouldBeFalse
isFalse = refl
magic : false ≡ true → String
magic ()
f : (b : Bool) → false ≡ b → String
f false eq = "Phew!"
f true eq = magic eq
main = putStr (f shouldBeFalse refl)
|
audio/sfx/snare1_4.asm | adhi-thirumala/EvoYellow | 16 | 83082 | SFX_Snare1_4_Ch7: ; 841ec
unknownnoise0x20 0, 193, 51
endchannel
|
programs/oeis/262/A262376.asm | neoneye/loda | 22 | 93820 | ; A262376: a(n) = Sum_{k=0..n} (k! - k).
; 1,1,1,4,24,139,853,5886,46198,409069,4037859,43954648,522956236,6749977023,93928268209,1401602636194,22324392524178,378011820620161,6780385526348143,128425485935180124,2561327494111820104,53652269665821260083,1177652997443428940061,27029669736328405580038,647478071469567844940014,16158688114800553828939989,419450149241406189412939963,11308319599659758350180939936,316196664211373618851684939908,9157958657951075573395300939879,274410818470142134209703780939849,8497249472648064951935266660939818,271628086406341595119153278820939786
mov $2,$0
add $2,1
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
mov $4,0
sub $4,$0
seq $0,33312 ; a(n) = n! - 1.
add $4,$0
add $4,1
add $1,$4
lpe
mov $0,$1
|
oeis/019/A019526.asm | neoneye/loda-programs | 11 | 87733 | ; A019526: Poincaré series [or Poincare series] for depths of roots in a certain root system.
; Submitted by <NAME>(s3)
; 4,5,8,13,24,44,83,158,303,582,1120,2157,4156,8009,15436,29752,57347,110538,213067,410698,791644,1525941,2941344,5669621,10928544,21065444,40604947,78268550,150867479,290806414,560547384,1080489821,2082711092,4014554705,7738302996,14916058608,28751627395,55420543698,106826532691,205914762386,396913466164,765075304933,1474730066168,2842633599645,5479352436904,10561791407644,20358507510355,39242284954542,75641936309439,145804520181974,281047248956304,541735990402253,1044229695849964
add $0,2
mov $2,1
lpb $0
sub $0,1
add $5,$1
mov $1,$3
sub $3,$4
mov $4,$2
mov $2,$3
add $5,$4
mov $3,$5
add $3,2
lpe
mov $0,$2
add $0,2
|
Practice/Assignments assembly class/20.asm | WardunIslam/CSE331L_Section_7_Summer_2020_NSU | 0 | 10963 | org 100h
L1: NOP
CNGSB: MOV BL, 0FFH
XOR BL, 080H
L2: HLT
ret
|
programs/oeis/165/A165864.asm | neoneye/loda | 22 | 14911 | ; A165864: Totally multiplicative sequence with a(p) = 43.
; 1,43,43,1849,43,1849,43,79507,1849,1849,43,79507,43,1849,1849,3418801,43,79507,43,79507,1849,1849,43,3418801,1849,1849,79507,79507,43,79507,43,147008443,1849,1849,1849,3418801,43,1849,1849,3418801,43,79507,43,79507,79507,1849,43,147008443,1849,79507,1849,79507,43,3418801,1849,3418801,1849,1849,43,3418801,43,1849,79507,6321363049,1849,79507,43,79507,1849,79507,43,147008443,43,1849,79507,79507,1849,79507,43,147008443,3418801,1849,43,3418801,1849,1849,1849,3418801,43,3418801,1849,79507,1849,1849,1849,6321363049,43,79507,79507,3418801
seq $0,1222 ; Number of prime divisors of n counted with multiplicity (also called bigomega(n) or Omega(n)).
mov $1,43
pow $1,$0
mov $0,$1
|
libsrc/graphics/undraw.asm | Toysoft/z88dk | 0 | 163768 | ;
; Z88 Graphics Functions - Small C+ stubs
;
; Written around the Interlogic Standard Library
;
; Stubs Written by <NAME> - 30/9/98
;
;
; $Id: undraw.asm,v 1.7 2016-04-13 21:09:09 dom Exp $
;
SECTION code_clib
PUBLIC undraw
PUBLIC _undraw
EXTERN swapgfxbk
EXTERN __graphics_end
EXTERN Line
EXTERN respixel
.undraw
._undraw
push ix
ld ix,2
add ix,sp
ld l,(ix+6) ;y0
ld h,(ix+8) ;x0
ld e,(ix+2) ;y1
ld d,(ix+4) ;x1
call swapgfxbk
push hl
push de
call respixel
pop de
pop hl
ld ix,respixel
call Line
jp __graphics_end
|
agda-aplas14/Substitution.agda | ryanakca/strong-normalization | 32 | 1971 | module Substitution where
open import Library
open import Terms
-- VarTm n specifies whether the substitution produces variables or terms.
-- The index is used to impose an order on the constructors
-- and so pass termination checking in lift/subst.
data VarTm : ℕ → Set where
`Var : VarTm 0
`Tm : VarTm 1
max01 : ℕ → ℕ → ℕ
max01 0 m = m
max01 n m = n
_∙VT_ : ∀ {m n} → VarTm m → VarTm n → VarTm (max01 m n)
`Var ∙VT vt = vt
`Tm ∙VT vt = `Tm
VT : ∀ {m} → VarTm m → Cxt → Ty → Set
VT `Var Γ a = Var Γ a
VT `Tm Γ a = Tm Γ a
vt2tm : ∀ {Γ a m} vt → VT {m} vt Γ a → Tm Γ a
vt2tm `Var x = var x
vt2tm `Tm t = t
RenSub : ∀ {m} → VarTm m → Cxt → Cxt → Set
RenSub vt Γ Δ = ∀ {a} → Var Γ a → VT vt Δ a
mutual
-- Lifiting a substitution
lifts : ∀ {m vt Γ Δ a} → RenSub {m} vt Γ Δ → RenSub vt (a ∷ Γ) (a ∷ Δ)
lifts {vt = `Var} σ (zero) = zero
lifts {vt = `Var} σ (suc x) = suc (σ x)
lifts {vt = `Tm} σ (zero) = var (zero)
lifts {vt = `Tm} σ (suc x) = subst {vt = `Var} suc (σ x)
-- Performing a substitution
subst : ∀ {m vt Γ Δ τ} → RenSub {m} vt Γ Δ → Tm Γ τ → Tm Δ τ
subst σ (abs t) = abs (subst (lifts σ) t)
subst σ (app t u) = app (subst σ t) (subst σ u)
subst σ (var x) = vt2tm _ (σ x)
-- Performing substitution, inductive specification
data IndSubst {m vt Γ Δ} (σ : RenSub {m} vt Γ Δ) : ∀ {τ} → Tm Γ τ → Tm Δ τ → Set where
var : ∀{a t} (x : Var Γ a)
→ vt2tm _ (σ x) ≡ t
→ IndSubst σ (var x) t
abs : ∀{a b} {t : Tm (a ∷ Γ) b} {t'}
→ IndSubst (lifts σ) t t'
→ IndSubst σ (abs t) (abs t')
app : ∀{a b} {t : Tm Γ (a →̂ b)} {u t' u'}
→ IndSubst σ t t'
→ IndSubst σ u u'
→ IndSubst σ (app t u) (app t' u')
-- Performing renaming, inductive specification
data IndRen {Γ Δ} (σ : RenSub `Var Γ Δ) : ∀ {τ} → Tm Γ τ → Tm Δ τ → Set where
var : ∀{a y} (x : Var Γ a)
→ (σ x) ≡ y
→ IndRen σ (var x) (var y)
abs : ∀{a b} {t : Tm (a ∷ Γ) b} {t'}
→ IndRen (lifts σ) t t'
→ IndRen σ (abs t) (abs t')
app : ∀{a b} {t : Tm Γ (a →̂ b)} {u t' u'}
→ IndRen σ t t'
→ IndRen σ u u'
→ IndRen σ (app t u) (app t' u')
-- Logical equivalence between inductive and algorithmic substitution
IndS→prop : ∀ {m vt Γ Δ} (σ : RenSub {m} vt Γ Δ) {τ} {t : Tm Γ τ} {t' : Tm Δ τ} → IndSubst σ t t' → subst σ t ≡ t'
IndS→prop σ (var x ≡.refl) = ≡.refl
IndS→prop σ (abs t) = ≡.cong abs (IndS→prop (lifts σ) t)
IndS→prop σ (app t t₁) = ≡.cong₂ app (IndS→prop σ t) (IndS→prop σ t₁)
prop→IndS' : ∀ {m vt Γ Δ} (σ : RenSub {m} vt Γ Δ) {τ} (t : Tm Γ τ) → IndSubst σ t (subst σ t)
prop→IndS' σ (var x) = var x ≡.refl
prop→IndS' σ (abs t) = abs (prop→IndS' (lifts σ) t)
prop→IndS' σ (app t u) = app (prop→IndS' σ t) (prop→IndS' σ u)
prop→IndS : ∀ {m vt Γ Δ} (σ : RenSub {m} vt Γ Δ) {τ} {t : Tm Γ τ} {t' : Tm Δ τ} → subst σ t ≡ t' → IndSubst σ t t'
prop→IndS _ ≡.refl = prop→IndS' _ _
-- Logical equivalence between inductive and algorithmic renaming
Ind→prop : ∀ {Γ Δ} (σ : RenSub `Var Γ Δ) {τ} {t : Tm Γ τ} {t' : Tm Δ τ} → IndRen σ t t' → subst σ t ≡ t'
Ind→prop σ (var x ≡.refl) = ≡.refl
Ind→prop σ (abs t) = ≡.cong abs (Ind→prop (lifts σ) t)
Ind→prop σ (app t t₁) = ≡.cong₂ app (Ind→prop σ t) (Ind→prop σ t₁)
prop→Ind' : ∀ {Γ Δ} (σ : RenSub `Var Γ Δ) {τ} (t : Tm Γ τ) → IndRen σ t (subst σ t)
prop→Ind' σ (var x) = var x ≡.refl
prop→Ind' σ (abs t) = abs (prop→Ind' (lifts σ) t)
prop→Ind' σ (app t u) = app (prop→Ind' σ t) (prop→Ind' σ u)
prop→Ind : ∀ {Γ Δ} (σ : RenSub `Var Γ Δ) {τ} {t : Tm Γ τ} {t' : Tm Δ τ} → subst σ t ≡ t' → IndRen σ t t'
prop→Ind _ ≡.refl = prop→Ind' _ _
-- Identity substitution
ids : ∀ {i vt Γ} → RenSub {i} vt Γ Γ
ids {vt = `Var} x = x
ids {vt = `Tm } x = var x
-- substitution composition
_•s_ : ∀ {Γ₀ Γ₁ Γ₂}
{n}{vt2 : VarTm n}(τ : RenSub vt2 Γ₁ Γ₂)
{m}{vt1 : VarTm m}(σ : RenSub vt1 Γ₀ Γ₁) → RenSub (vt1 ∙VT vt2) Γ₀ Γ₂
_•s_ τ {vt1 = `Var} σ x = τ (σ x)
_•s_ τ {vt1 = `Tm } σ x = subst τ (σ x)
-- Term substitution
Subst : Cxt → Cxt → Set
Subst Γ Δ = ∀ {a : Ty} → Var Γ a → Tm Δ a
-- Extending a substitution
_∷s_ : ∀ {Γ Δ a} → Tm Γ a → Subst Δ Γ → Subst (a ∷ Δ) Γ
(t ∷s σ) (zero) = t
(t ∷s σ) (suc x) = σ x
-- Substitution for 0th variable
sgs : ∀ {Γ a} → Tm Γ a → Subst (a ∷ Γ) Γ
sgs t = t ∷s ids
-- Substituting for the 0th variable [u/0]t
subst0 : ∀ {Γ a b} → Tm Γ a → Tm (a ∷ Γ) b → Tm Γ b
subst0 u = subst (sgs u)
-- Renamings
Ren : (Γ Δ : Cxt) → Set
Ren = RenSub `Var
_≤_ : (Γ Δ : Cxt) → Set
_≤_ Γ Δ = RenSub `Var Δ Γ
rename : ∀ {Γ Δ : Cxt} {a : Ty} (η : Γ ≤ Δ) (x : Tm Δ a) → Tm Γ a
rename = subst
-- Weakening renaming
weak : ∀{Γ a} → (a ∷ Γ) ≤ Γ
weak = suc
-- Weakening substitution
weaks : ∀{n}{vt : VarTm n}{a Γ Δ} (σ : RenSub vt Γ Δ) → RenSub vt (Γ) (a ∷ Δ)
weaks {vt = `Var} σ x = suc (σ x)
weaks {vt = `Tm} σ x = rename suc (σ x)
-- Properties
_≡s_ : ∀ {Γ Δ} {m n vt1 vt2} → (f : RenSub {m} vt1 Γ Δ)(g : RenSub {n} vt2 Γ Δ) → Set
f ≡s g = (∀ {a} x → vt2tm _ (f {a} x) ≡ vt2tm _ (g x))
mutual
subst-ext : ∀ {Γ Δ} {m n vt1 vt2} {f : RenSub {m} vt1 Γ Δ}{g : RenSub {n} vt2 Γ Δ} → f ≡s g → ∀ {a} (t : Tm Γ a) → subst f t ≡ subst g t
subst-ext f≐g (var v) = (f≐g v)
subst-ext {f = f} {g = g} f≐g (abs t) = ≡.cong abs (subst-ext (lifts-ext {f = f} {g = g} f≐g) t)
subst-ext f≐g (app t t₁) = ≡.cong₂ app (subst-ext f≐g t) (subst-ext f≐g t₁)
lifts-ext : ∀ {Γ Δ b} {m n vt1 vt2} {f : RenSub {m} vt1 Γ Δ}{g : RenSub {n} vt2 Γ Δ} → f ≡s g → lifts {a = b} f ≡s lifts g
lifts-ext {vt1 = `Var} {`Var} f≐g (zero) = ≡.refl
lifts-ext {vt1 = `Var} {`Var} {f} {g} f≐g (suc x) with f x | g x | f≐g x
lifts-ext {Γ} {Δ} {b} {._} {._} {`Var} {`Var} f≐g (suc x) | z | .z | ≡.refl = ≡.refl
lifts-ext {vt1 = `Var} {`Tm} f≐g (zero) = ≡.refl
lifts-ext {vt1 = `Var} {`Tm} f≐g (suc x) rewrite ≡.sym (f≐g x) = ≡.refl
lifts-ext {vt1 = `Tm} {`Var} f≐g (zero) = ≡.refl
lifts-ext {vt1 = `Tm} {`Var} f≐g (suc x) rewrite (f≐g x) = ≡.refl
lifts-ext {vt1 = `Tm} {`Tm} f≐g (zero) = ≡.refl
lifts-ext {vt1 = `Tm} {`Tm} f≐g (suc x) = ≡.cong (subst suc) (f≐g x)
mutual
subst-∙ : ∀ {Γ₀ Γ₁ Γ₂}
{n}{vt2 : VarTm n}(τ : RenSub vt2 Γ₁ Γ₂)
{m}{vt1 : VarTm m}(σ : RenSub vt1 Γ₀ Γ₁) → ∀ {a} (t : Tm Γ₀ a) → subst (τ •s σ) t ≡ subst τ (subst σ t)
subst-∙ τ {vt1 = `Var} σ (var x) = ≡.refl
subst-∙ τ {vt1 = `Tm} σ (var x) = ≡.refl
subst-∙ τ σ (abs t) = ≡.cong abs (≡.trans (subst-ext (lifts-∙ τ σ) t) (subst-∙ (lifts τ) (lifts σ) t))
subst-∙ τ σ (app t t₁) = ≡.cong₂ app (subst-∙ τ σ t) (subst-∙ τ σ t₁)
lifts-∙ : ∀ {Γ₀ Γ₁ Γ₂}
{n}{vt2 : VarTm n}(τ : RenSub vt2 Γ₁ Γ₂)
{m}{vt1 : VarTm m}(σ : RenSub vt1 Γ₀ Γ₁) → ∀ {a} → lifts {a = a} (τ •s σ) ≡s (lifts τ •s lifts σ)
lifts-∙ {vt2 = `Var} τ {vt1 = `Var} σ (zero) = ≡.refl
lifts-∙ {vt2 = `Tm} τ {vt1 = `Var} σ (zero) = ≡.refl
lifts-∙ {vt2 = `Var} τ {vt1 = `Var} σ (suc x) = ≡.refl
lifts-∙ {vt2 = `Tm} τ {vt1 = `Var} σ (suc x) = ≡.refl
lifts-∙ {vt2 = `Var} τ {vt1 = `Tm} σ (zero) = ≡.refl
lifts-∙ {vt2 = `Tm} τ {vt1 = `Tm} σ (zero) = ≡.refl
lifts-∙ {vt2 = `Var} τ {vt1 = `Tm} σ (suc x) = ≡.trans (≡.sym (subst-∙ suc τ (σ x))) (subst-∙ (lifts τ) suc (σ x))
lifts-∙ {vt2 = `Tm} τ {vt1 = `Tm} σ (suc x) = ≡.trans (≡.sym (subst-∙ suc τ (σ x))) (subst-∙ (lifts τ) suc (σ x))
mutual
subst-id : ∀ {m vt Γ a} → (t : Tm Γ a) → subst (ids {m} {vt}) t ≡ t
subst-id {vt = `Var} (var v) = ≡.refl
subst-id {vt = `Tm} (var v) = ≡.refl
subst-id {m} {vt} {Γ} (abs t) = ≡.cong abs (≡.trans (subst-ext {n = m} {vt2 = vt} (lifts-id {m} {vt}) t) (subst-id t))
subst-id (app t t₁) = ≡.cong₂ app (subst-id t) (subst-id t₁)
lifts-id : ∀ {m vt Γ b} → lifts {a = b} (ids {m} {vt} {Γ = Γ}) ≡s ids {m} {vt} {Γ = b ∷ Γ}
lifts-id {vt = `Var} (zero) = ≡.refl
lifts-id {vt = `Var} (suc x) = ≡.refl
lifts-id {vt = `Tm} (zero) = ≡.refl
lifts-id {vt = `Tm} (suc x) = ≡.refl
sgs-lifts : ∀ {m vt Γ Δ a} {σ : RenSub {m} vt Γ Δ} {u : Tm Γ a} → (sgs (subst σ u) •s lifts σ) ≡s (σ •s sgs u)
sgs-lifts {vt = `Var} = (λ { (zero) → ≡.refl ; (suc x) → ≡.refl })
sgs-lifts {vt = `Tm} {σ = σ} {u} = (λ { (zero) → ≡.refl ; (suc x) → ≡.sym (≡.trans (≡.sym (subst-id (σ x)))
(subst-∙ (sgs (subst σ u)) {vt1 = `Var} suc (σ x))) })
sgs-lifts-term : ∀ {m vt Γ Δ a b} {σ : RenSub {m} vt Γ Δ} {u : Tm Γ a}{t : Tm (a ∷ Γ) b}
→ subst (sgs (subst σ u)) (subst (lifts σ) t) ≡ subst σ (subst (sgs u) t)
sgs-lifts-term {σ = σ} {u} {t} = (≡.trans (≡.sym (subst-∙ (sgs (subst σ u)) (lifts σ) t))
(≡.trans (subst-ext sgs-lifts t)
(subst-∙ σ (sgs u) t)))
renId : ∀ {Γ a}{t : Tm Γ a} → rename id t ≡ t
renId = subst-id _
contract : ∀ {a Γ} → RenSub `Var (a ∷ a ∷ Γ) (a ∷ Γ)
contract (zero) = zero
contract (suc x) = x
contract-sgs : ∀ {a Γ} → contract {a} {Γ} ≡s sgs (var zero)
contract-sgs (zero) = ≡.refl
contract-sgs (suc x) = ≡.refl
sgs-weak₀ : ∀ {Γ a} {u : Tm Γ a} {b} (x : Var Γ b) → sgs u (suc x) ≡ var x
sgs-weak₀ x = ≡.refl
sgs-weak₁ : ∀ {Γ a} {u : Tm Γ a} → (sgs u ∘ suc) ≡s (ids {vt = `Tm})
sgs-weak₁ x = ≡.refl
sgs-weak : ∀ {Γ a} {u : Tm Γ a} → (sgs u •s weak) ≡s (ids {vt = `Tm})
sgs-weak x = ≡.refl
cons-to-sgs : ∀ {Γ Δ a} (u : Tm Δ a) (σ : Subst Γ Δ)
→ (u ∷s σ) ≡s (sgs u •s lifts σ)
cons-to-sgs u σ (zero) = ≡.refl
cons-to-sgs u σ (suc x) = begin
σ x ≡⟨ ≡.sym (subst-id (σ x)) ⟩
subst (ids {vt = `Tm}) (σ x) ≡⟨ subst-ext (λ _ → ≡.refl) (σ x) ⟩
subst (sgs u •s weak) (σ x) ≡⟨ subst-∙ (sgs u) weak (σ x) ⟩
subst (sgs u) (subst suc (σ x))
∎
where open ≡-Reasoning
-- -}
|
oeis/069/A069731.asm | neoneye/loda-programs | 11 | 3340 | ; A069731: Number of unicursal planar maps with n edges rooted at a vertex of odd valency (unicursal means that exactly two vertices are of odd valency; there is an Eulerian path).
; Submitted by <NAME>
; 1,5,28,168,1056,6864,45760,311168,2149888,15049216,106502144,760729600,5477253120,39710085120,289650032640,2124100239360,15651264921600,115819360419840,860372391690240
mov $1,$0
add $0,2
seq $0,108 ; Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!).
lpb $1
mul $0,2
sub $1,1
lpe
div $0,2
|
src/tools/dictord.adb | spr93/whitakers-words | 204 | 3145 | -- WORDS, a Latin dictionary, by <NAME> (USAF, Retired)
--
-- Copyright <NAME> (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
with Text_IO;
with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package;
--with Latin_Utils.Latin_File_Names; use Latin_Utils.Latin_File_Names;
with Latin_Utils.Inflections_Package; use Latin_Utils.Inflections_Package;
with Latin_Utils.Dictionary_Package; use Latin_Utils.Dictionary_Package;
--with Support_Utils.Line_Stuff; use Support_Utils.Line_Stuff;
with Support_Utils.Dictionary_Form;
procedure Dictord is
-- DICTORD.IN -> DICTORD.OUT
-- Takes DICTLINE form, puts # and dictionary form at beginning,
-- a file that can be sorted to produce word order of paper dictionary
package Integer_IO is new Text_IO.Integer_IO (Integer);
use Text_IO;
use Dictionary_Entry_IO;
use Part_Entry_IO;
use Kind_Entry_IO;
use Translation_Record_IO;
use Age_Type_IO;
use Area_Type_IO;
Start_Stem_1 : constant := 1;
Start_Stem_2 : constant := Start_Stem_1 + Max_Stem_Size + 1;
Start_Stem_3 : constant := Start_Stem_2 + Max_Stem_Size + 1;
Start_Stem_4 : constant := Start_Stem_3 + Max_Stem_Size + 1;
Start_Part : constant := Start_Stem_4 + Max_Stem_Size + 1;
Input, Output : Text_IO.File_Type;
De : Dictionary_Entry;
S : String (1 .. 400) := (others => ' ');
Blank_Line : constant String (1 .. 400) := (others => ' ');
L, Last : Integer := 0;
J : constant Integer := 1;
begin
Put_Line ("DICTORD.IN -> DICTORD.OUT For dictionary updates.");
Put_Line ("Takes DICTLINE form, puts # and dictionary form at beginning,");
Put_Line ("a file for sorting to produce word order of paper dictionary");
Create (Output, Out_File, "DICTORD.OUT");
Open (Input, In_File, "DICTORD.IN");
Over_Lines :
while not End_Of_File (Input) loop
S := Blank_Line;
Get_Line (Input, S, Last);
if Trim (S (1 .. Last)) /= "" then -- Rejecting blank lines
Form_De :
begin
De.Stems (1) :=
S (Start_Stem_1 .. Max_Stem_Size);
De.Stems (2) :=
S (Start_Stem_2 .. Start_Stem_2 + Max_Stem_Size - 1);
De.Stems (3) :=
S (Start_Stem_3 .. Start_Stem_3 + Max_Stem_Size - 1);
De.Stems (4) :=
S (Start_Stem_4 .. Start_Stem_4 + Max_Stem_Size - 1);
Get (S (Start_Part .. Last), De.Part, L);
--GET (S (L+1 .. LAST), DE.PART.POFS, DE.KIND, L);
Get (S (L + 1 .. Last), De.Tran.Age, L);
Get (S (L + 1 .. Last), De.Tran.Area, L);
De.Mean := Head (S (L + 2 .. Last), Max_Meaning_Size);
-- Note that this allows initial blanks
-- L+2 skips over the SPACER, required because this is STRING,
-- not ENUM
exception
when others =>
Put_Line ("Exception");
Put_Line (S (1 .. Last));
Integer_IO.Put (J); New_Line;
Put (De); New_Line;
end Form_De;
Put (Output, "#" & Support_Utils.Dictionary_Form (De));
Set_Col (Output, 81); Put_Line (Output, S (1 .. Last));
end if; -- Rejecting blank lines
end loop Over_Lines;
Close (Output);
exception
when Text_IO.Data_Error =>
null;
when others =>
Put_Line (S (1 .. Last));
Integer_IO.Put (J); New_Line;
Close (Output);
end Dictord;
|
programs/oeis/117/A117866.asm | karttu/loda | 0 | 97900 | <filename>programs/oeis/117/A117866.asm
; A117866: Number of palindromes (in base 7) below 7^n.
; 6,12,54,96,390,684,2742,4800,19206,33612,134454,235296,941190,1647084,6588342,11529600,46118406,80707212,322828854,564950496,2259801990,3954653484,15818613942,27682574400,110730297606,193778020812,775112083254,1356446145696,5425784582790,9495123019884,37980492079542,66465861139200,265863444556806,465261027974412,1861044111897654,3256827195820896
mov $5,$0
mov $7,$0
add $7,1
lpb $7,1
mov $0,$5
sub $7,1
sub $0,$7
div $0,2
mul $3,7
pow $3,$0
add $4,5
mov $0,$4
mov $6,6
mov $8,5
lpb $0,1
mov $0,4
mov $2,$3
mul $2,$6
gcd $3,$8
lpe
add $1,$2
lpe
|
programs/oeis/017/A017356.asm | neoneye/loda | 22 | 103880 | <reponame>neoneye/loda
; A017356: a(n) = (10*n+7)^4.
; 2401,83521,531441,1874161,4879681,10556001,20151121,35153041,57289761,88529281,131079601,187388721,260144641,352275361,466948881,607573201,777796321,981506241,1222830961,1506138481,1836036801,2217373921,2655237841,3154956561,3722098081,4362470401,5082121521,5887339441,6784652161,7780827681,8882874001,10098039121,11433811041,12897917761,14498327281,16243247601,18141126721,20200652641,22430753361,24840596881,27439591201,30237384321,33243864241,36469158961,39923636481,43617904801,47562811921,51769445841,56249134561,61013446081,66074188401,71443409521,77133397441,83156680161,89526025681,96254442001,103355177121,110841719041,118727795761,127027375281,135754665601,144924114721,154550410641,164648481361,175233494881,186320859201,197926222321,210065472241,222754736961,236010384481,249849022801,264287499921,279342903841,295032562561,311374044081,328385156401,346083947521,364488705441,383617958161,403490473681,424125260001,445541565121,467758877041,490796923761,514675673281,539415333601,565036352721,591559418641,619005459361,647395642881,676751377201,707094310321,738446330241,770829564961,804266382481,838779390801,874391437921,911125611841,949005240561,988053892081
mul $0,10
add $0,7
pow $0,4
|
commands/apps/meetingbar/meetingbar-join-meeting.applescript | daviddzhou/script-commands | 3,305 | 3799 | #!/usr/bin/osascript
# Dependencies:
# MeetingBar: https://github.com/leits/MeetingBar
# Recommended installation:
# brew install --cask meetingbar
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Join Meeting
# @raycast.mode silent
# Optional parameters:
# @raycast.icon images/meetingbar.png
# @raycast.packageName MeetingBar
# Documentation:
# @raycast.author <NAME>
# @raycast.authorURL https://github.com/jaklan
# @raycast.description Join the ongoing or upcoming meeting.
on run
try
runMeetingBar()
joinMeeting()
return
on error errorMessage
closeMenu()
return errorMessage
end try
end run
### Functions ###
on joinMeeting()
openMenu()
tell application "System Events" to tell application process "MeetingBar"
tell menu 1 of menu bar item 1 of menu bar 2
if menu item "Join current event meeting" exists then
click menu item "Join current event meeting"
else if menu item "Join next event meeting" exists then
click menu item "Join next event meeting"
else
error "No meetings found"
end if
end tell
end tell
end joinMeeting
on MeetingBarIsRunning()
return application "MeetingBar" is running
end MeetingBarIsRunning
on runMeetingBar()
if not MeetingBarIsRunning() then do shell script "open -a 'MeetingBar'"
end runMeetingBar
on menuIsOpen()
tell application "System Events" to tell application process "MeetingBar"
return menu 1 of menu bar item 1 of menu bar 2 exists
end tell
end menuIsOpen
on openMenu()
set killDelay to 0
repeat
tell application "System Events" to tell application process "MeetingBar"
if my menuIsOpen() then return
ignoring application responses
click menu bar item 1 of menu bar 2
end ignoring
end tell
set killDelay to killDelay + 0.1
delay killDelay
do shell script "killall System\\ Events"
end repeat
end openMenu
on closeMenu()
if menuIsOpen() then tell application "System Events" to key code 53
end closeMenu |
libsrc/target/rx78/graphics/plotpixl.asm | jpoikela/z88dk | 38 | 103121 | ;
; Plot pixel at (x,y) coordinate.
SECTION code_clib
PUBLIC plotpixel
defc NEEDplot = 1
.plotpixel
INCLUDE "pixel.asm"
|
programs/oeis/323/A323535.asm | karttu/loda | 1 | 703 | <filename>programs/oeis/323/A323535.asm<gh_stars>1-10
; A323535: a(n) = Product_{k=1..n} (binomial(k-1,7) + binomial(n-k,7)).
; 1,0,0,0,0,0,0,0,0,0,0,0,0,0
add $2,1
lpb $0,1
add $2,$2
sub $0,1
lpe
add $1,2
sub $1,$2
|
hrm/40_prime_factory.asm | glupmjoed/puzzles | 0 | 168920 | <reponame>glupmjoed/puzzles
-- HUMAN RESOURCE MACHINE PROGRAM --
-- primfac(in1), ... -> out
COPYFROM 24
COPYTO 20
COPYTO 0
BUMPUP 0
BUMPUP 0 -- a[0] = 2
COPYTO 1
BUMPUP 1 -- a[1] = 3
ADD 0
COPYTO 2 -- a[2] = 5
ADD 0
COPYTO 3 -- a[3] = 7
ADD 0
ADD 0
COPYTO 4 -- a[4] = 11
ADD 0
COPYTO 5 -- a[5] = 13
ADD 0
ADD 0
COPYTO 6 -- a[6] = 17
ADD 0
COPYTO 7 -- a[7] = 19
JUMP b
a:
COPYFROM 24
COPYTO 20 -- i = 0
b:
INBOX -- inbox -> n
c:
COPYTO 15
d: -- find n % a[i]
SUB [20]
JUMPN e
JUMP d
e:
ADD [20]
JUMPZ f
BUMPUP 20 -- n % a[i] != 0, i++
COPYFROM 15
JUMP d
f:
COPYFROM [20] -- n % a[i] == 0
OUTBOX -- a[i] -> outbox
COPYFROM 24
COPYTO 16 -- d = 0
g: -- find d = n / a[i]
COPYFROM 15
SUB [20]
JUMPZ h
COPYTO 15 -- n -= a[i]
BUMPUP 16 -- d++
JUMP g
h:
COPYFROM 16
JUMPZ a
BUMPUP 16
JUMP c -- n = d
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_54_440.asm | ljhsiun2/medusa | 9 | 25871 | <filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_54_440.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x1eb8e, %rbx
nop
nop
nop
xor %r15, %r15
and $0xffffffffffffffc0, %rbx
vmovaps (%rbx), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %r14
nop
nop
nop
nop
nop
add $32047, %r10
lea addresses_D_ht+0x3bc2, %rsi
lea addresses_normal_ht+0x15fe, %rdi
clflush (%rsi)
nop
and $29037, %r8
mov $60, %rcx
rep movsb
nop
nop
nop
nop
mfence
lea addresses_WC_ht+0x45d2, %rcx
nop
nop
nop
nop
nop
add %rdi, %rdi
movl $0x61626364, (%rcx)
nop
nop
xor %rsi, %rsi
lea addresses_normal_ht+0x5348, %rsi
lea addresses_normal_ht+0x32c2, %rdi
dec %r8
mov $50, %rcx
rep movsl
nop
cmp %r8, %r8
lea addresses_UC_ht+0x6042, %r15
clflush (%r15)
cmp $16975, %rsi
movl $0x61626364, (%r15)
nop
nop
dec %r8
lea addresses_WC_ht+0x17c2, %rsi
lea addresses_normal_ht+0x19954, %rdi
nop
nop
nop
xor $29201, %r15
mov $120, %rcx
rep movsq
nop
nop
nop
cmp %r14, %r14
lea addresses_normal_ht+0xa3c2, %rbx
nop
nop
add %rsi, %rsi
mov $0x6162636465666768, %rcx
movq %rcx, (%rbx)
nop
inc %r15
lea addresses_WT_ht+0x16aa2, %rsi
lea addresses_UC_ht+0xf8c2, %rdi
clflush (%rsi)
nop
and $55686, %r10
mov $59, %rcx
rep movsq
nop
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_normal_ht+0xc7c2, %rsi
lea addresses_D_ht+0x107c2, %rdi
and %r14, %r14
mov $52, %rcx
rep movsw
dec %rsi
lea addresses_normal_ht+0x6fc2, %r10
nop
and $52952, %rcx
mov (%r10), %r8
nop
add %rbx, %rbx
lea addresses_WT_ht+0xdad2, %rcx
cmp %rsi, %rsi
movw $0x6162, (%rcx)
nop
nop
nop
nop
dec %r14
lea addresses_A_ht+0x12c42, %rcx
nop
nop
nop
nop
add $34990, %r15
mov $0x6162636465666768, %r10
movq %r10, %xmm1
vmovups %ymm1, (%rcx)
nop
nop
nop
cmp $50892, %r14
lea addresses_UC_ht+0x18be2, %rsi
lea addresses_normal_ht+0x1b9c2, %rdi
clflush (%rdi)
nop
nop
nop
xor $10216, %rbx
mov $61, %rcx
rep movsq
nop
sub $38337, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %r15
push %rbx
push %rdx
push %rsi
// Store
lea addresses_D+0x1bab2, %rsi
nop
nop
nop
nop
nop
xor %rdx, %rdx
mov $0x5152535455565758, %r10
movq %r10, %xmm0
vmovups %ymm0, (%rsi)
inc %rsi
// Store
mov $0x33538a0000000fc2, %r15
nop
nop
cmp $22086, %r12
mov $0x5152535455565758, %rsi
movq %rsi, %xmm5
movups %xmm5, (%r15)
nop
xor %r10, %r10
// Store
lea addresses_WC+0xd302, %rsi
nop
inc %r14
movw $0x5152, (%rsi)
nop
nop
nop
sub $6639, %rsi
// Store
mov $0x2313c700000002a2, %r14
nop
nop
nop
nop
dec %r10
movb $0x51, (%r14)
nop
nop
nop
cmp %r10, %r10
// Store
lea addresses_A+0xdb92, %rdx
nop
nop
nop
nop
nop
xor %r10, %r10
mov $0x5152535455565758, %r15
movq %r15, %xmm1
movups %xmm1, (%rdx)
nop
nop
and $35768, %r15
// Faulty Load
lea addresses_RW+0xf3c2, %r14
nop
nop
nop
nop
nop
add %r12, %r12
movups (%r14), %xmm3
vpextrq $1, %xmm3, %r15
lea oracles, %rbx
and $0xff, %r15
shlq $12, %r15
mov (%rbx,%r15,1), %r15
pop %rsi
pop %rdx
pop %rbx
pop %r15
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_RW', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 32, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_RW', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': True, 'size': 8, 'congruent': 8, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'32': 54}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1133.asm | ljhsiun2/medusa | 9 | 96293 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1a074, %rsi
lea addresses_UC_ht+0xb7d4, %rdi
inc %r10
mov $90, %rcx
rep movsl
cmp %rdi, %rdi
lea addresses_WC_ht+0x4b4, %rax
nop
nop
nop
xor %r8, %r8
movb (%rax), %r13b
nop
add $16446, %rdi
lea addresses_WT_ht+0x1c71c, %rsi
nop
nop
nop
nop
nop
and %r8, %r8
mov (%rsi), %cx
nop
nop
nop
nop
sub $1849, %rdi
lea addresses_WT_ht+0x137d4, %r8
nop
nop
nop
sub %rcx, %rcx
movl $0x61626364, (%r8)
nop
nop
nop
cmp %r13, %r13
lea addresses_D_ht+0x8fd4, %rsi
lea addresses_WC_ht+0x5d4, %rdi
nop
nop
and $9951, %r11
mov $21, %rcx
rep movsl
nop
nop
nop
nop
nop
cmp $32329, %rcx
lea addresses_normal_ht+0x1ee78, %rsi
lea addresses_normal_ht+0x3006, %rdi
nop
nop
inc %r11
mov $85, %rcx
rep movsq
nop
nop
nop
nop
add %r10, %r10
lea addresses_UC_ht+0x135d4, %rdi
nop
nop
cmp $37540, %rsi
movb $0x61, (%rdi)
nop
nop
sub %rax, %rax
lea addresses_WC_ht+0x17fd4, %r8
nop
nop
nop
nop
xor %rax, %rax
mov $0x6162636465666768, %rdi
movq %rdi, (%r8)
nop
cmp $606, %r8
lea addresses_WT_ht+0x16dd4, %rsi
lea addresses_A_ht+0xd114, %rdi
nop
nop
nop
nop
and $1426, %rax
mov $16, %rcx
rep movsb
cmp $56215, %rcx
lea addresses_UC_ht+0xdbd4, %rax
nop
and $45870, %r11
mov $0x6162636465666768, %rsi
movq %rsi, %xmm4
vmovups %ymm4, (%rax)
nop
nop
cmp %r11, %r11
lea addresses_A_ht+0x125d4, %r8
nop
and $8934, %r11
mov (%r8), %rdi
nop
nop
nop
cmp $6133, %r11
lea addresses_WT_ht+0x11fd4, %r8
nop
nop
nop
nop
add $49966, %r11
mov $0x6162636465666768, %rdi
movq %rdi, %xmm1
movups %xmm1, (%r8)
nop
nop
nop
nop
nop
add %r8, %r8
lea addresses_WT_ht+0x95da, %rsi
lea addresses_A_ht+0x1ec10, %rdi
nop
nop
xor %r13, %r13
mov $78, %rcx
rep movsl
nop
nop
nop
add $12281, %r13
lea addresses_UC_ht+0x18646, %rsi
lea addresses_WC_ht+0x11bd4, %rdi
add $23047, %r13
mov $86, %rcx
rep movsw
nop
nop
nop
cmp %r10, %r10
lea addresses_UC_ht+0x1d254, %rcx
nop
nop
sub %r11, %r11
movb (%rcx), %r10b
nop
nop
nop
nop
nop
sub %r13, %r13
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
// Store
lea addresses_A+0x103d4, %rbp
nop
nop
nop
nop
nop
and $42402, %r9
mov $0x5152535455565758, %r15
movq %r15, (%rbp)
nop
nop
dec %r13
// Store
lea addresses_WT+0xa7d4, %r15
nop
nop
nop
cmp $27691, %rbp
mov $0x5152535455565758, %rsi
movq %rsi, %xmm2
movups %xmm2, (%r15)
nop
nop
nop
nop
nop
add $42955, %rbp
// Store
lea addresses_normal+0x8ab4, %rbp
xor $8520, %r14
movw $0x5152, (%rbp)
nop
nop
nop
nop
cmp %r9, %r9
// REPMOV
lea addresses_RW+0x2074, %rsi
lea addresses_A+0x5a59, %rdi
nop
and $22955, %r9
mov $113, %rcx
rep movsb
nop
nop
and $34081, %rdi
// Store
lea addresses_A+0x103d4, %r10
cmp %rdi, %rdi
mov $0x5152535455565758, %r15
movq %r15, (%r10)
nop
nop
nop
nop
nop
cmp $45525, %rbp
// Store
lea addresses_WT+0x19268, %rdi
cmp $31361, %r14
mov $0x5152535455565758, %r15
movq %r15, (%rdi)
nop
nop
xor %rbp, %rbp
// Faulty Load
lea addresses_A+0x103d4, %rbp
nop
nop
nop
nop
nop
cmp $26740, %r9
vmovups (%rbp), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %rdi
lea oracles, %r10
and $0xff, %rdi
shlq $12, %rdi
mov (%r10,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A', 'congruent': 0}}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_normal', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 0, 'type': 'addresses_A'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_RW'}}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT', 'congruent': 0}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WC_ht', 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT_ht', 'congruent': 3}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC_ht', 'congruent': 9}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 5, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC_ht', 'congruent': 8}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A_ht', 'congruent': 9}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT_ht', 'congruent': 9}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 1, 'type': 'addresses_UC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC_ht', 'congruent': 6}}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
Cubical/Homotopy/Group/Pi4S3/Summary.agda | xekoukou/cubical | 0 | 15874 | {-
This file contains a summary of the proof that π₄(S³) ≡ ℤ/2ℤ
The --experimental-lossy-unification flag is used to speed up type checking.
The file still type checks without it, but it's a lot slower (about 10 times).
-}
{-# OPTIONS --safe --experimental-lossy-unification #-}
module Cubical.Homotopy.Group.Pi4S3.Summary where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Pointed
open import Cubical.Data.Nat.Base
open import Cubical.Data.Sigma.Base
open import Cubical.HITs.Sn
open import Cubical.HITs.SetTruncation
open import Cubical.Homotopy.HopfInvariant.Base
open import Cubical.Homotopy.HopfInvariant.Homomorphism
open import Cubical.Homotopy.HopfInvariant.HopfMap
open import Cubical.Homotopy.HopfInvariant.Brunerie
open import Cubical.Homotopy.Whitehead
open import Cubical.Homotopy.Group.Base hiding (π)
open import Cubical.Homotopy.Group.Pi3S2
open import Cubical.Homotopy.Group.Pi4S3.BrunerieNumber
open import Cubical.Algebra.Group.Base
open import Cubical.Algebra.Group.Instances.Bool
open import Cubical.Algebra.Group.Morphisms
open import Cubical.Algebra.Group.GroupPath
open import Cubical.Algebra.Group.MorphismProperties
open import Cubical.Algebra.Group.Instances.Int
open import Cubical.Algebra.Group.Instances.IntMod
open import Cubical.Algebra.Group.ZAction
-- Homotopy groups (shifted version of π'Gr to get nicer numbering)
π : ℕ → Pointed₀ → Group₀
π n X = π'Gr (predℕ n) X
-- Nicer notation for the spheres (as pointed types)
𝕊² 𝕊³ : Pointed₀
𝕊² = S₊∙ 2
𝕊³ = S₊∙ 3
-- The Brunerie number; defined in Cubical.Homotopy.Group.Pi4S3.BrunerieNumber
-- as "abs (HopfInvariant-π' 0 ([ (∣ idfun∙ _ ∣₂ , ∣ idfun∙ _ ∣₂) ]×))"
β : ℕ
β = Brunerie
-- The connection to π₄(S³) is then also proved in the BrunerieNumber
-- file following Corollary 3.4.5 in <NAME>'s PhD thesis.
βSpec : GroupEquiv (π 4 𝕊³) (ℤGroup/ β)
βSpec = BrunerieIso
-- Ideally one could prove that β is 2 by normalization, but this does
-- not seem to terminate before we run out of memory. To try normalize
-- this use "C-u C-c C-n β≡2" (which normalizes the term, ignoring
-- abstract's). So instead we prove this by hand as in the second half
-- of Guillaume's thesis.
β≡2 : β ≡ 2
β≡2 = Brunerie≡2
-- This involves a lot of theory, for example that π₃(S²) ≃ ℤGroup where
-- the underlying map is induced by the Hopf invariant (which involves
-- the cup product on cohomology).
_ : GroupEquiv (π 3 𝕊²) ℤGroup
_ = hopfInvariantEquiv
-- Which is a consequence of the fact that π₃(S²) is generated by the
-- Hopf map.
_ : gen₁-by (π 3 𝕊²) ∣ HopfMap ∣₂
_ = π₂S³-gen-by-HopfMap
-- etc. For more details see the proof of "Brunerie≡2".
-- Combining all of this gives us the desired equivalence of groups:
π₄S³≃ℤ/2ℤ : GroupEquiv (π 4 𝕊³) (ℤGroup/ 2)
π₄S³≃ℤ/2ℤ = subst (GroupEquiv (π 4 𝕊³)) (cong ℤGroup/_ β≡2) βSpec
-- By the SIP this induces an equality of groups:
π₄S³≡ℤ/2ℤ : π 4 𝕊³ ≡ ℤGroup/ 2
π₄S³≡ℤ/2ℤ = GroupPath _ _ .fst π₄S³≃ℤ/2ℤ
-- As a sanity check we also establish the equality with Bool:
π₄S³≡Bool : π 4 𝕊³ ≡ BoolGroup
π₄S³≡Bool = π₄S³≡ℤ/2ℤ ∙ GroupPath _ _ .fst (GroupIso→GroupEquiv ℤGroup/2≅Bool)
|
test/asm/shift-negative.asm | ISSOtm/rgbds-deb | 0 | 28239 | m: MACRO
shift -3
ENDM
m
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.