public RISCVIntegrationContext WithEndpoint(RISCVIntegrationEndpoint endpoint)
        {
            var result = Clone();

            result.Endpoint = endpoint;

            return(result);
        }
Beispiel #2
0
        public static async Task <uint[]> Asm(RISCVIntegrationEndpoint endpoint, string asmSource)
        {
            using (var client = new HttpClient())
            {
                var url      = $"{endpoint.RISCV}/asm";
                var response = await client.PostAsync(url, new StringContent(asmSource));

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    var message = await response.Content.ReadAsStringAsync();

                    throw new Exception(message);
                }

                var content = await response.Content.ReadAsByteArrayAsync();

                return(ToInstructions(content).ToArray());
            }
        }
Beispiel #3
0
        public static async Task <bool> HealthCheck(RISCVIntegrationEndpoint endpoint)
        {
            var url = $"{endpoint.HealthCheck}/IsAlive";

            try
            {
                using (var client = new HttpClient())
                {
                    var response = await client.GetAsync(url);

                    return(response.StatusCode == HttpStatusCode.OK);
                }
            }
            catch
            {
                Console.WriteLine($"RISCV toolchain is not available: {url}");
                return(false);
            }
        }