Skip to content

Instantly share code, notes, and snippets.

View anta40's full-sized avatar

Andre Tampubolon anta40

  • Jakarta, Indonesia
  • 05:20 (UTC +07:00)
View GitHub Profile
/**
* Copyright (c) E.Y. Baskoro, Research In Motion Limited.
*
* 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
public static void deleteFile(String path) {
if (path.startsWith("file://")) {
// do nothing
} else if (!path.startsWith("/"))
path = "file:///" + path;
else if (path.startsWith("//"))
path = "file:/" + path;
else
path = "file://" + path;
/**
* This is how to use ScreenSplash.java
*/
package com.durianapp.brandapp;
import com.durianapp.brandapp.ui.ScreenSplash;
public class BrandApp extends UiApplication {
public BrandApp() {
@anta40
anta40 / Lakban.java
Last active August 29, 2015 14:06 — forked from amrishodiq/Lakban.java
package com.durianapp.kertasdanlakban;
import net.rim.device.api.ui.UiApplication;
public class Lakban extends UiApplication {
public Lakban() {
pushScreen(new LakbanScreen());
}
public static void main(String[] args) {
/**
* Method to get all bytes from a file.
*
* @param path
* @return
* @throws IOException
*/
public static byte[] getFileContent(String path) throws IOException {
FileConnection file = null;
/**
* I use this method to get contents of JSON formatted file that I put into res
* directory to deliver default data for my application.
* Visit my blog at http://web.durianapp.com
*/
public static String getResFileContent(String filename) {
InputStream is = null;
try {
/**
* To use this example, you need to grap my repository on
* https://github.com/amrishodiq/Blackberry-Development-Tutorial/tree/master/TakingPicture/src/com/durianberry/takingpicture
*/
public final class TakingPictureScreen extends MainScreen implements
PictureTakerListener, FieldChangeListener {
private ButtonField button;
private BitmapField photoField;
public TakingPictureScreen() {
public static synchronized String saveToFile(String basePath, byte[] data)
throws IOException {
try {
if (basePath.startsWith("file://")) {
// do nothing
} else if (!basePath.startsWith("/"))
basePath = "file:///" + basePath;
else if (basePath.startsWith("//"))
basePath = "file:/" + basePath;
else

Foreward

This document was originally written several years ago. At the time I was working as an execution core verification engineer at Arm. The following points are coloured heavily by working in and around the execution cores of various processors. Apply a pinch of salt; points contain varying degrees of opinion.

It is still my opinion that RISC-V could be much better designed; though I will also say that if I was building a 32 or 64-bit CPU today I'd likely implement the architecture to benefit from the existing tooling.

Mostly based upon the RISC-V ISA spec v2.0. Some updates have been made for v2.2

Original Foreword: Some Opinion

The RISC-V ISA has pursued minimalism to a fault. There is a large emphasis on minimizing instruction count, normalizing encoding, etc. This pursuit of minimalism has resulted in false orthogonalities (such as reusing the same instruction for branches, calls and returns) and a requirement for superfluous instructions which impacts code density both in terms of size and