Files
chipyard/tests/passthrough.c
Ryan Lund 35cba5dfae Dsptools examples (#457)
* Add c test files for DSPTools example

* Update tests Makefile to build DSPTools c tests

* Add DSPTools example configs to ConfigMixins and RocketConfigs

* Add dsptools and rocket-dsptools as dependancies for example

* Add Scala implementations of DSPTools test blocks

* Clean up GenericFIR scala

* Modify dsptools blocks and mixins to match 'CanHave' when adding peripherial

* Update documentation, will need reworking once FIR is characterized as fixed point

* Update naming of Passthrough to Streaming Passthrough. Update naming of Thing to Chain and remove old Chain

* Fix capitalization in docs (#419)

* Add c test files for DSPTools example

* Update tests Makefile to build DSPTools c tests

* Add DSPTools example configs to ConfigMixins and RocketConfigs

* Add dsptools and rocket-dsptools as dependancies for example

* Add Scala implementations of DSPTools test blocks

* Clean up GenericFIR scala

* Modify dsptools blocks and mixins to match 'CanHave' when adding peripherial

* Update documentation, will need reworking once FIR is characterized as fixed point

* Update naming of Passthrough to Streaming Passthrough. Update naming of Thing to Chain and remove old Chain

* Update docs/Customization/Dsptools-Blocks.rst

Co-Authored-By: alonamid <alonamid@eecs.berkeley.edu>

* Docummentation update for clarity and to explain how this can be applied to a generalized block

* Some refactoring to get dsptools working with these examples

* Oops, old files crept in

Co-authored-by: Ryan Lund <ryan.lund@bwrcrdsl-4.eecs.berkeley.edu>
Co-authored-by: Sagar Karandikar <sagark@eecs.berkeley.edu>
Co-authored-by: alonamid <alonamid@eecs.berkeley.edu>
Co-authored-by: Paul Rigge <rigge@berkeley.edu>
2020-04-20 10:33:03 -07:00

50 lines
1.1 KiB
C

#define PASSTHROUGH_WRITE 0x2000
#define PASSTHROUGH_WRITE_COUNT 0x2008
#define PASSTHROUGH_READ 0x2100
#define PASSTHROUGH_READ_COUNT 0x2108
#include "mmio.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
int main(void)
{
printf("Starting writing\n");
uint32_t test_vector[7] = {3, 2, 1, 0, -1, -2, -3} ;
for (int i = 0; i < 7; i++) {
reg_write64(PASSTHROUGH_WRITE, test_vector[i]);
}
printf("Done writing\n");
uint32_t rcnt = reg_read32(PASSTHROUGH_READ_COUNT);
printf("Write count: %d\n", reg_read32(PASSTHROUGH_WRITE_COUNT));
printf("Read count: %d\n", rcnt);
int failed = 0;
if (rcnt != 0) {
for (int i = 0; i < 7; i++) {
uint32_t res = reg_read32(PASSTHROUGH_READ);
uint32_t expected = test_vector[i];
if (res == expected) {
printf("\n\nPass: Got %d Expected %d\n\n", res, test_vector[i]);
} else {
failed = 1;
printf("\n\nFail: Got %d Expected %d\n\n", res, test_vector[i]);
}
}
} else {
failed = 1;
}
if (failed) {
printf("\n\nSome tests failed\n\n");
} else {
printf("\n\nAll tests passed\n\n");
}
return 0;
}